According to the zope book it should be possible to store dicts in session.
When I try to assign a dictionary to a ordinary zope 2 session, with lists there is no problem. why?:

       requestlist = {}
       for i in self.request.form:
           key = i
           value = self.request.form[i]
           requestlist[i] = self.request.form[i]
       sess = self.context.REQUEST.SESSION
       sess['pr_reqlist'] = requestlist

I get the following error:

Traceback (innermost last):

   * Module ZPublisher.Publish, line 196, in publish_module_standard
   * Module Products.PlacelessTranslationService.PatchStringIO, line
     34, in new_publish
   * Module ZPublisher.Publish, line 146, in publish
   * Module Zope2.App.startup, line 222, in zpublisher_exception_hook
   * Module ZPublisher.Publish, line 121, in publish
   * Module Zope2.App.startup, line 240, in commit
   * Module transaction._manager, line 96, in commit
   * Module transaction._transaction, line 380, in commit
   * Module transaction._transaction, line 378, in commit
   * Module transaction._transaction, line 433, in _commitResources
   * Module ZODB.Connection, line 484, in commit
   * Module ZODB.Connection, line 526, in _commit
   * Module ZODB.Connection, line 553, in _store_objects
   * Module ZODB.serialize, line 407, in serialize
   * Module ZODB.serialize, line 416, in _dump
   * Module copy_reg, line 69, in _reduce_ex

TypeError: can't pickle instancemethod objects (Also, the following error occurred while attempting to render the standard error message, please see the event log for full details: An operation previously failed, with traceback: File "C:\Python\Zope\Zope\lib\python\ZServer\PubCore\", line 23, in __init__ response=response) File "C:\Python\Zope\Zope\lib\python\ZPublisher\", line 395, in publish_module environ, debug, request, response) File "C:\Python\Zope\Zope\lib\python\ZPublisher\", line 196, in publish_module_standard response = publish(request, module_name, after_list, debug=debug) File "C:\Python\Zope\Instance\Products\PlacelessTranslationService\", line 34, in new_publish x = Publish.old_publish(request, module_name, after_list, debug) File "C:\Python\Zope\Zope\lib\python\ZPublisher\", line 121, in publish transactions_manager.commit() File "C:\Python\Zope\Zope\lib\python\Zope2\App\", line 240, in commit transaction.commit() File "C:\Python\Zope\Zope\lib\python\transaction\", line 96, in commit return self.get().commit(sub, deprecation_wng=False) File "C:\Python\Zope\Zope\lib\python\transaction\", line 380, in commit self._saveCommitishError() # This raises! File "C:\Python\Zope\Zope\lib\python\transaction\", line 378, in commit self._commitResources() File "C:\Python\Zope\Zope\lib\python\transaction\", line 433, in _commitResources rm.commit(self) File "C:\Python\Zope\Zope\lib\python\ZODB\", line 484, in commit self._commit(transaction) File "C:\Python\Zope\Zope\lib\python\ZODB\", line 526, in _commit self._store_objects(ObjectWriter(obj), transaction) File "C:\Python\Zope\Zope\lib\python\ZODB\", line 553, in _store_objects p = writer.serialize(obj) # This calls __getstate__ of obj File "C:\Python\Zope\Zope\lib\python\ZODB\", line 407, in serialize return self._dump(meta, obj.__getstate__()) File "C:\Python\Zope\Zope\lib\python\ZODB\", line 416, in _dump self._p.dump(state) File "C:\Python\Zope\Python\lib\", line 69, in _reduce_ex raise TypeError, "can't pickle %s objects" % base.__name__ TypeError: can't pickle instancemethod objects )

Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to