<?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>from Products.ZSQLCatalog.SQLCatalog import Query\n
from Products.ERP5Type.DateUtils import atTheEndOfPeriod\n
request = container.REQUEST\n
portal = context.getPortalObject()\n
from_date = request.get(\'from_date\', None)\n
to_date = request.get(\'at_date\', None)\n
aggregation_level = request.get(\'aggregation_level\', None)\n
if to_date is not None:\n
  to_date = atTheEndOfPeriod(to_date, period=aggregation_level)\n
# build query based on dates\n
query=None\n
if from_date is not None and to_date is not None:  \n
  params = {"delivery.start_date":(from_date, to_date)}\n
  query = Query(range="minmax", **params)\n
elif from_date is not None:\n
  params = {"delivery.start_date":from_date}\n
  query = Query(range="min", **params)\n
elif to_date is not None:\n
  params = {"delivery.start_date":to_date}\n
  query = Query(range="max", **params)\n
\n
event_type_list = portal.getPortalEventTypeList()\n
# get events where user is either source or destination\n
source_event_list = portal.portal_catalog(portal_type=event_type_list, default_source_uid=context.getUid(),query=query)\n
dest_event_list = portal.portal_catalog(portal_type=event_type_list, default_destination_uid=context.getUid(),query=query)\n
\n
event_list = list(source_event_list)+list(dest_event_list)\n
\n
def sortDate(a, b):\n
  return cmp(a.getStartDate(), b.getStartDate())\n
\n
event_list.sort(sortDate)\n
\n
return event_list\n
</string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>**kw</string> </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>FreeFiberRequest_getFreeFiberequestDetailedEventList</string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
