<?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 encoding="cdata"><![CDATA[

# Updates attributes of an Zope document\n
# which is in a class inheriting from ERP5 Base\n
#\n
# TODO\n
#   - Implement validation of matrix fields\n
#   - Implement validation of list fields\n
#\n
\n
from Products.Formulator.Errors import ValidationError, FormValidationError\n
\n
request=context.REQUEST\n
\n
try:\n
  # Define form basic fields\n
  form = getattr(context,form_id)\n
  # Validate\n
  form.validate_all_to_request(request)\n
  # Basic attributes\n
  kw = {}\n
  # Parse attributes\n
  for f in form.get_fields():\n
    k = f.id\n
    v = getattr(request,k,None)\n
    if v is not None:\n
      if k[0:3] == \'my_\':\n
        # We only take into account\n
        # the object attributes\n
        k = k[3:]\n
        kw[k] = v\n
  # Update listbox attributes\n
  listbox = request.get(\'listbox\')\n
  if listbox is not None:\n
    listbox_field = form.get_field(\'listbox\')\n
    gv = {}\n
    if listbox_field.has_value(\'global_attributes\'):\n
      hidden_attributes = map(lambda x:x[0], listbox_field.get_value(\'global_attributes\'))\n
      for k in hidden_attributes:\n
        gv[k] = getattr(request, k,None)\n
    for property, v in listbox.items():\n
      v.update(gv)\n
      context.setCriterion(property, **v)\n
  # Update basic attributes\n
  context.edit(REQUEST=request,**kw)\n
  context.reindexObject()\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
else:\n
  if not selection_index:\n
    redirect_url = \'%s/%s?%s\' % ( context.absolute_url()\n
                              , form_id\n
                              , \'portal_status_message=Data+Updated.\'\n
                              )\n
  else:\n
    redirect_url = \'%s/%s?selection_index=%s&selection_name=%s&%s\' % ( context.absolute_url()\n
                              , form_id\n
                              , selection_index\n
                              , selection_name\n
                              , \'portal_status_message=Data+Updated.\'\n
                              )\n
\n
\n
\n
request[ \'RESPONSE\' ].redirect( redirect_url )\n


]]></string> </value>
        </item>
        <item>
            <key> <string>_code</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>_filepath</string> </key>
            <value> <string>Script (Python):/nexedi/portal_skins/local_erp5/Predicate_edit</string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>form_id, selection_index=0, selection_name=\'\'</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>3</int> </value>
                    </item>
                    <item>
                        <key> <string>co_varnames</string> </key>
                        <value>
                          <tuple>
                            <string>form_id</string>
                            <string>selection_index</string>
                            <string>selection_name</string>
                            <string>Products.Formulator.Errors</string>
                            <string>ValidationError</string>
                            <string>FormValidationError</string>
                            <string>_getattr_</string>
<string>context</string>
                            <string>request</string>
                            <string>getattr</string>
                            <string>form</string>
                            <string>kw</string>
                            <string>_getiter_</string>
                            <string>f</string>
                            <string>k</string>
                            <string>None</string>
                            <string>v</string>
                            <string>_getitem_</string>
                            <string>_write_</string>
                            <string>listbox</string>
                            <string>listbox_field</string>
                            <string>gv</string>
                            <string>map</string>
                            <string>hidden_attributes</string>
                            <string>property</string>
                            <string>_apply_</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>
                <int>0</int>
                <string></string>
              </tuple>
            </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>Predicate_edit</string> </value>
        </item>
        <item>
            <key> <string>warnings</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
