<?xml version="1.0"?>
<ZopeData>
  <record id="1" aka="AAAAAAAAAAE=">
    <pickle>
      <tuple>
        <tuple>
          <string>Products.PythonScripts.PythonScript</string>
          <string>PythonScript</string>
        </tuple>
        <none/>
      </tuple>
    </pickle>
    <pickle>
      <dictionary>
        <item>
            <key> <string>Python_magic</string> </key>
            <value> <string encoding="base64">O/INCg==</string> </value>
        </item>
        <item>
            <key> <string>Script_magic</string> </key>
            <value> <int>3</int> </value>
        </item>
        <item>
            <key> <string>__ac_local_roles__</string> </key>
            <value>
              <none/>
            </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># Updates attributes of an Zope document\n
# which is in a class inheriting from ERP5 Base\n
\n
\n
from Products.Formulator.Errors import ValidationError, FormValidationError\n
from string import join\n
from ZTUtils import make_query\n
\n
request=context.REQUEST\n
\n
\n
\n
#Exceptions for Base_edit\n
if dialog_method == \'Base_edit\':\n
  return context.Base_edit( form_id=form_id\n
                                       , dialog_id=dialog_id\n
                                       , selection_name=selection_name\n
                                       )\n
#Exceptions for Workflow\n
if dialog_method == \'Workflow_statusModify\':\n
  return context.Workflow_statusModify( form_id=form_id\n
                                       , dialog_id=dialog_id\n
                                       )\n
if dialog_method == \'Base_configureUI\':\n
  return context.Base_configureUI( form_id=form_id\n
                             , selection_name=selection_name\n
                             , field_columns=getattr(request,\'field_columns\')\n
                             , stat_columns=getattr(request,\'stat_columns\')\n
                             )\n
if dialog_method == \'Base_configureSortOn\':\n
  return context.Base_configureSortOn( form_id=form_id\n
                             , selection_name=selection_name\n
                             , field_sort_on=getattr(request,\'field_sort_on\')\n
                             , field_sort_order=getattr(request,\'field_sort_order\')\n
                             )\n
\n
error_message = \'\'\n
MARKER = \'marker\'\n
try:\n
  # Validate the form\n
  form = getattr(context,dialog_id)\n
  form.validate_all_to_request(request)\n
  kw =  { \'form_id\'             : form_id\n
        , \'selection_name\'      : selection_name \n
        , \'selection_index\'     : None\n
        , \'dialog_id\'           : dialog_id\n
        } # Missing selection_index\n
  has_listbox = 0   \n
  for f in form.get_fields():\n
    k = f.id\n
    v = getattr(request,k, MARKER)\n
    if v is not MARKER:\n
      if k[0:3] == \'my_\':\n
        k = k[3:]\n
        kw[k] = v\n
      elif k in (\'import_file\', \'listbox\'):\n
        if f.meta_type == \'ListBox\': has_listbox = 1\n
        kw[k] = v\n
  # Add some properties required by UI\n
  kw[\'cancel_url\'] = cancel_url\n
  # Redirect if possible, or call directly else\n
  if kw.has_key(\'import_file\'):\n
    # We can not redirect if we do an import\n
    import_file = kw[\'import_file\']\n
    return getattr(context,dialog_method)(**kw)\n
  if has_listbox:\n
    listbox_line_list = []\n
    listbox = getattr(request,\'listbox\',None)\n
    listbox_keys = listbox.keys()\n
    listbox_keys.sort()\n
    for key in listbox_keys:\n
      listbox_line = listbox[key]\n
      listbox_line[\'listbox_key\'] = key\n
      listbox_line_list.append(listbox[key])\n
    listbox_line_list = tuple(listbox_line_list)\n
    kw[\'listbox\'] = listbox_line_list\n
    return getattr(context,dialog_method)(**kw)\n
  url_params_string = make_query(kw)\n
  # Check if the selection did not changed\n
  if previous_md5_object_uid_list is not None:\n
    selection_list = context.portal_selections.callSelectionFor(selection_name, context=context)\n
    if selection_list is not None:\n
      object_uid_list = map(lambda x:x.getObject().getUid(),selection_list)\n
      error = context.portal_selections.selectionHasChanged(previous_md5_object_uid_list,object_uid_list)\n
      if error:\n
        error_message = \'Sorry+your+selection+has+changed\'\n
  url_params_string = make_query(**kw)\n
except FormValidationError, validation_errors:\n
  # Pack errors into the request\n
  field_errors = form.ErrorFields(validation_errors)\n
  request.set(\'field_errors\', field_errors)\n
  return form(request)\n
\n
if error_message != \'\':\n
  redirect_url = \'%s/%s?%s\' % ( context.absolute_url(), form_id\n
                                , \'portal_status_message=%s\' % error_message\n
                                )\n
elif url_params_string != \'\':\n
  redirect_url = \'%s/%s?%s\' % ( context.absolute_url()\n
                            , dialog_method\n
                            , url_params_string\n
                            )\n
else:\n
  redirect_url = \'%s/%s\' % ( context.absolute_url()\n
                            , dialog_method\n
                            )\n
\n
return request.RESPONSE.redirect( redirect_url )\n
</string> </value>
        </item>
        <item>
            <key> <string>_code</string> </key>
            <value> <string encoding="base64">YwAAAAAAAAAAAgAAAEAAAABzEAAAAGUAAGQBAIQBAFoBAGQAAFMoAgAAAE5jBgAAAC0AAAAeAAAA
[encoded data, 5390 characters]
ZT4BAAAAcwAAAAA=</string> </value>
        </item>
        <item>
            <key> <string>_dav_writelocks</string> </key>
            <value>
              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
            </value>
        </item>
        <item>
            <key> <string>_filepath</string> </key>
            <value> <string>Script (Python):/nexedi/portal_skins/local_erp5/Base_callViewDialogMethod</string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>form_id,cancel_url,dialog_method,selection_name,dialog_id,previous_md5_object_uid_list=None</string> </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>6</int> </value>
                    </item>
                    <item>
                        <key> <string>co_varnames</string> </key>
                        <value>
                          <tuple>
                            <string>form_id</string>
                            <string>cancel_url</string>
                            <string>dialog_method</string>
                            <string>selection_name</string>
                            <string>dialog_id</string>
                            <string>previous_md5_object_uid_list</string>
                            <string>Products.Formulator.Errors</string>
                            <string>ValidationError</string>
                            <string>FormValidationError</string>
                            <string>string</string>
                            <string>join</string>
                            <string>ZTUtils</string>
                            <string>make_query</string>
                            <string>_getattr_</string>
                            <string>context</string>
                            <string>request</string>
                            <string>getattr</string>
                            <string>error_message</string>
                            <string>MARKER</string>
                            <string>form</string>
                            <string>None</string>
                            <string>kw</string>
                            <string>has_listbox</string>
                            <string>_getiter_</string>
                            <string>f</string>
                            <string>k</string>
                            <string>v</string>
                            <string>_getitem_</string>
                            <string>_write_</string>
                            <string>import_file</string>
                            <string>_apply_</string>
                            <string>listbox_line_list</string>
                            <string>listbox</string>
                            <string>listbox_keys</string>
                            <string>key</string>
                            <string>listbox_line</string>
                            <string>tuple</string>
                            <string>url_params_string</string>
                            <string>selection_list</string>
                            <string>map</string>
                            <string>object_uid_list</string>
                            <string>error</string>
                            <string>validation_errors</string>
                            <string>field_errors</string>
                            <string>redirect_url</string>
                          </tuple>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>func_defaults</string> </key>
            <value>
              <tuple>
                <none/>
              </tuple>
            </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>Base_callViewDialogMethod</string> </value>
        </item>
        <item>
            <key> <string>warnings</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
  <record id="2" aka="AAAAAAAAAAI=">
    <pickle>
      <tuple>
        <tuple>
          <string>Persistence</string>
          <string>PersistentMapping</string>
        </tuple>
        <none/>
      </tuple>
    </pickle>
    <pickle>
      <dictionary>
        <item>
            <key> <string>_container</string> </key>
            <value>
              <dictionary/>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
