<?xml version="1.0"?>
<ZopeData>
  <record id="1" aka="AAAAAAAAAAE=">
    <pickle>
      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
    </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 encoding="cdata"><![CDATA[

import json\n
\n
portal = context.getPortalObject()\n
person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n
\n
if person is None:\n
  raise ValueError("User Not Found")\n
\n
document_path = ""\n
\n
if context.getPortalType() in ["Hosting Subscription", "Computer"]:\n
  document_path = "/%s" % context.getRelativeUrl()\n
\n
web_site = context.getWebSiteValue()\n
request_url = "%s/feed%s" % (web_site.absolute_url(), document_path)\n
\n
# XXX - Cannot search in catalog with parameter url_string\n
access_token = None\n
for token_item in portal.portal_catalog(\n
  portal_type="Restricted Access Token",\n
  default_agent_uid=person.getUid(),\n
  validation_state=\'validated\'\n
  ):\n
  if token_item.getUrlString() == request_url:\n
    access_token = token_item\n
    reference = access_token.getReference()\n
    break\n
\n
if access_token is None:\n
  access_token = portal.access_token_module.newContent(\n
    portal_type="Restricted Access Token",\n
    url_string=request_url,\n
    url_method="GET",\n
  )\n
  access_token.setAgentValue(person)\n
  reference = access_token.getReference()  \n
  access_token.validate()\n
\n
url = "%s/feed%s?portal_skin=RSS&access_token=%s&access_token_secret=%s" % (\n
        web_site.absolute_url(),\n
        document_path,\n
        access_token.getId(),\n
        reference)\n
\n
request = context.REQUEST\n
response = request.RESPONSE\n
response.setHeader(\'Content-Type\', "application/json")\n
return json.dumps({\'restricted_access_url\': url})\n


]]></string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string></string> </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>Base_generateRssRestrictedAccessTokenFromJS</string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
