<?xml version="1.0"?>
<ZopeData>
  <record id="1" aka="AAAAAAAAAAE=">
    <pickle>
      <tuple>
        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
        <tuple/>
      </tuple>
    </pickle>
    <pickle>
      <dictionary>
        <item>
            <key> <string>Script_magic</string> </key>
            <value> <int>3</int> </value>
        </item>
        <item>
            <key> <string>_bind_names</string> </key>
            <value>
              <object>
                <klass>
                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
                </klass>
                <tuple/>
                <state>
                  <dictionary>
                    <item>
                        <key> <string>_asgns</string> </key>
                        <value>
                          <dictionary>
                            <item>
                                <key> <string>name_container</string> </key>
                                <value> <string>container</string> </value>
                            </item>
                            <item>
                                <key> <string>name_context</string> </key>
                                <value> <string>context</string> </value>
                            </item>
                            <item>
                                <key> <string>name_m_self</string> </key>
                                <value> <string>script</string> </value>
                            </item>
                            <item>
                                <key> <string>name_subpath</string> </key>
                                <value> <string>traverse_subpath</string> </value>
                            </item>
                          </dictionary>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>_body</string> </key>
            <value> <string>"""Send the permanent link by email"""\n
#TODO: Remove hardcoding\n
notification_message = context.NotificationTool_getDocumentValue(reference="cloudooo-document.share.link")\n
\n
mapping_dict = {\'link_url\': context.Document_getPermanentUrl()}\n
\n
#asText required auditor proxy\n
mail_text = notification_message.asText(\n
  substitution_method_parameter_dict={\'mapping_dict\':mapping_dict})\n
\n
\n
#We can not use portal_notifications.sendMessage, because we doesn\'t create person with email list\n
support_email = "no-reply@cloudooo.com"\n
message_title = notification_message.getTitle()\n
for email in recipient_email:\n
  context.Event_viewMimeMessage(\n
    mto=email,\n
    subject=message_title,\n
    mfrom=support_email,\n
    body=mail_text,\n
    encoding=\'utf-8\'\n
  )\n
\n
message = context.Base_translateString("Your document link was sended by email.")\n
context.Base_redirect(\'view\',keep_items={\'portal_status_message\': message})\n
</string> </value>
        </item>
        <item>
            <key> <string>_code</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>recipient_email</string> </value>
        </item>
        <item>
            <key> <string>_proxy_roles</string> </key>
            <value>
              <tuple>
                <string>Auditor</string>
              </tuple>
            </value>
        </item>
        <item>
            <key> <string>errors</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
        <item>
            <key> <string>func_code</string> </key>
            <value>
              <object>
                <klass>
                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
                </klass>
                <tuple/>
                <state>
                  <dictionary>
                    <item>
                        <key> <string>co_argcount</string> </key>
                        <value> <int>1</int> </value>
                    </item>
                    <item>
                        <key> <string>co_varnames</string> </key>
                        <value>
                          <tuple>
                            <string>recipient_email</string>
                            <string>_getattr_</string>
                            <string>context</string>
                            <string>notification_message</string>
                            <string>mapping_dict</string>
                            <string>mail_text</string>
                            <string>support_email</string>
                            <string>message_title</string>
                            <string>_getiter_</string>
                            <string>email</string>
                            <string>message</string>
                          </tuple>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>func_defaults</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>Document_sendLinkByEmail</string> </value>
        </item>
        <item>
            <key> <string>warnings</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
