Re: [Zope3-Users] Help: I cannot login after installing z3c.formjs

2008-07-17 Thread kevin gill
Thanks for the analysis. I did some digging and found that it was entirely
my own fault. I have some code in the SessionCredentials object which
stores the request annotations. I do this to handle extra information on
the login form, e.g. login groups.


> Hmm, I've never gotten an error like that.  It probably wouldn't be
> too difficult to patch jsclientevent.py by making sure caught events
> have security proxies removed before they are stored.  But I wonder
> why any request related data is being stored in the database.  My
> understanding is that session data gets stored in the database but is
> totally separate from the request.  A cookie (stored in the request)
> is used to lookup the session data from the database.  My gut instinct
> is that there is something wrong with the credentials plugin you are
> using because request annotations should never be persisted across
> multiple requests.  I am using SessionCredentials myself without any
> problems.  Can you find the code path that tries to store the request
> annotation?
>
> From a z3c.formjs perspective, if you want the caught events to not be
> security proxied, you could create another object event listener (like
> the one in z3c/formjs/jsclientevent.py) that goes through the caught
> events and removes security proxies.  In the end this is a fragile
> solution because you can't guarantee the order in which events are
> handled, and unfortunately the way the zcml configuration is split up
> (not at all), it would be difficult to override this default event
> handler using an exclude directive.
>
> I'm currently making some improvements to z3c.formjs and will make
> sure to split up the zcml files more so doing such a customization is
> easier.  There should be new releases of z3c.form and z3c.formjs in
> the next couple of weeks with these changes.

I will be interested in seeing where you are going with formjs. I am
really using it to get the AjaxRequestHandler at the moment.

Thanks

Kevin

>
> - Paul
>
> On Tue, Jul 15, 2008 at 7:51 AM, kevin gill <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> I am integrating z3c.formjs to a new site. After installing z3c.formjs I
>> can no longer login. If I remove it, I can login again.
>>
>> It causes a problem with the SessionCredentials mechanism that I am
>> using.
>> The SessionCredentials annotations now contains event handlers of type
>> z3c.formjs.jsclientevent.caughtEvents. These cannot be pickled.
>>
>> I tried both the PersisentSessionDataContainer and the RamSessionData
>> Container.
>>
>> Does anyone have suggestions on how I might proceed with this?
>>
>> Thanks,
>>
>> Kevin
>>
>>
>> This is the tail of the exception
>>
>> 2008-07-15T15:31:38 ERROR SiteError rm.commit(self)
>> --
>> 2008-07-15T15:31:38 ERROR SiteError   File
>> "/opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/Connection.py",
>> line 541, in commit
>> --
>> 2008-07-15T15:31:38 ERROR SiteError self._commit(transaction)
>> --
>> 2008-07-15T15:31:38 ERROR SiteError   File
>> "/opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/Connection.py",
>> line 586, in _commit
>> --
>> 2008-07-15T15:31:38 ERROR SiteError
>> self._store_objects(ObjectWriter(obj), transaction)
>> --
>> 2008-07-15T15:31:38 ERROR SiteError   File
>> "/opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/Connection.py",
>> line 613, in _store_objects
>> --
>> 2008-07-15T15:31:38 ERROR SiteError p = writer.serialize(obj)  #
>> This
>> calls __getstate__ of obj
>> --
>> 2008-07-15T15:31:38 ERROR SiteError   File
>> "/opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/serialize.py",
>> line 408, in serialize
>> --
>> 2008-07-15T15:31:38 ERROR SiteError return self._dump(meta,
>> obj.__getstate__())
>> --
>> 2008-07-15T15:31:38 ERROR SiteError   File
>> "/opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/serialize.py",
>> line 420, in _dump
>> --
>> 2008-07-15T15:31:38 ERROR SiteError self._p.dump(state)
>>
>>
>>
>> I investigated the offending object, and it is the SessionCredentials.
>> After adding the ajax handlers, the SessionCredentials object is no
>> longer
>> pickleable.
>>
>> (pdb) state=obj.__getstate__()
>> (Pdb) cPickle.dumps(state)
>> *** UnpickleableError: Cannot pickle > 'zope.security._proxy._Proxy'>
>> objects
>> (Pdb) state
>> 'credentials', > object at 0xafea8fcc>),),),)
>> (Pdb) credentials=state[0][0][0][1]
>> (Pdb) credentials.request_annotations
>> {'zope.app.publisher.browser.IUserPreferredLanguages': {'cached':
>> ['en-gb', 'en']}, 'z3c.formjs.jsclientevent.caughtEvents':
>> [> 0xafea8e4c>, > at 0xafea8dac>, > object at 0xafea8dcc>,
>> > object at 0xafeb1b4c>,
>> > object at 0xafeb1dac>,
>> > object at 0xafeb1d2c>,
>> > object at 0xafeb1c6c>,
>> > object at 0xafeb1ccc>,
>> > object at 0xafeb1c8c>,
>> > object at 0xafeb1bcc>,
>> > object at 0xafeb322c>,
>> > object at 0xafeb344c>,
>> > object at 0xafeb33cc>,
>> > obj

Re: [Zope3-Users] Help: I cannot login after installing z3c.formjs

2008-07-15 Thread Paul Carduner
Hmm, I've never gotten an error like that.  It probably wouldn't be
too difficult to patch jsclientevent.py by making sure caught events
have security proxies removed before they are stored.  But I wonder
why any request related data is being stored in the database.  My
understanding is that session data gets stored in the database but is
totally separate from the request.  A cookie (stored in the request)
is used to lookup the session data from the database.  My gut instinct
is that there is something wrong with the credentials plugin you are
using because request annotations should never be persisted across
multiple requests.  I am using SessionCredentials myself without any
problems.  Can you find the code path that tries to store the request
annotation?

>From a z3c.formjs perspective, if you want the caught events to not be
security proxied, you could create another object event listener (like
the one in z3c/formjs/jsclientevent.py) that goes through the caught
events and removes security proxies.  In the end this is a fragile
solution because you can't guarantee the order in which events are
handled, and unfortunately the way the zcml configuration is split up
(not at all), it would be difficult to override this default event
handler using an exclude directive.

I'm currently making some improvements to z3c.formjs and will make
sure to split up the zcml files more so doing such a customization is
easier.  There should be new releases of z3c.form and z3c.formjs in
the next couple of weeks with these changes.

- Paul

On Tue, Jul 15, 2008 at 7:51 AM, kevin gill <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am integrating z3c.formjs to a new site. After installing z3c.formjs I
> can no longer login. If I remove it, I can login again.
>
> It causes a problem with the SessionCredentials mechanism that I am using.
> The SessionCredentials annotations now contains event handlers of type
> z3c.formjs.jsclientevent.caughtEvents. These cannot be pickled.
>
> I tried both the PersisentSessionDataContainer and the RamSessionData
> Container.
>
> Does anyone have suggestions on how I might proceed with this?
>
> Thanks,
>
> Kevin
>
>
> This is the tail of the exception
>
> 2008-07-15T15:31:38 ERROR SiteError rm.commit(self)
> --
> 2008-07-15T15:31:38 ERROR SiteError   File
> "/opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/Connection.py",
> line 541, in commit
> --
> 2008-07-15T15:31:38 ERROR SiteError self._commit(transaction)
> --
> 2008-07-15T15:31:38 ERROR SiteError   File
> "/opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/Connection.py",
> line 586, in _commit
> --
> 2008-07-15T15:31:38 ERROR SiteError
> self._store_objects(ObjectWriter(obj), transaction)
> --
> 2008-07-15T15:31:38 ERROR SiteError   File
> "/opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/Connection.py",
> line 613, in _store_objects
> --
> 2008-07-15T15:31:38 ERROR SiteError p = writer.serialize(obj)  # This
> calls __getstate__ of obj
> --
> 2008-07-15T15:31:38 ERROR SiteError   File
> "/opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/serialize.py",
> line 408, in serialize
> --
> 2008-07-15T15:31:38 ERROR SiteError return self._dump(meta,
> obj.__getstate__())
> --
> 2008-07-15T15:31:38 ERROR SiteError   File
> "/opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/serialize.py",
> line 420, in _dump
> --
> 2008-07-15T15:31:38 ERROR SiteError self._p.dump(state)
>
>
>
> I investigated the offending object, and it is the SessionCredentials.
> After adding the ajax handlers, the SessionCredentials object is no longer
> pickleable.
>
> (pdb) state=obj.__getstate__()
> (Pdb) cPickle.dumps(state)
> *** UnpickleableError: Cannot pickle 
> objects
> (Pdb) state
> 'credentials',  object at 0xafea8fcc>),),),)
> (Pdb) credentials=state[0][0][0][1]
> (Pdb) credentials.request_annotations
> {'zope.app.publisher.browser.IUserPreferredLanguages': {'cached':
> ['en-gb', 'en']}, 'z3c.formjs.jsclientevent.caughtEvents':
> [ 0xafea8e4c>,  at 0xafea8dac>,  object at 0xafea8dcc>,  object at 0xafeb1b4c>,  object at 0xafeb1dac>,  object at 0xafeb1d2c>,  object at 0xafeb1c6c>,  object at 0xafeb1ccc>,  object at 0xafeb1c8c>,  object at 0xafeb1bcc>,  object at 0xafeb322c>,  object at 0xafeb344c>,  object at 0xafeb33cc>,  object at 0xafeb348c>,  object at 0xafeb354c>,  object at 0xafeb35ec>,  object at 0xafeb318c>,  object at 0xafeb362c>,  object at 0xafeb1a4c>,  object at 0xafeb1b6c>,  object at 0xafeb1f8c>,  object at 0xafeb190c>,  object at 0xafeb16ac>,  object at 0xafeb18cc>,  object at 0xafeb172c>,  object at 0xafeb18ac>]}
> (Pdb)
> credentials.request_annotations['z3c.formjs.jsclientevent.caughtEvents'][0]
> 
> (Pdb)
> cPickle.dumps(credentials.request_annotations['z3c.formjs.jsclientevent.caughtEvents'][0])
> *** UnpickleableError: Cannot pickle 
> objects
>
> (Pdb) ev =
> credentials.request_annotations['z3c.formjs.jscliente

[Zope3-Users] Help: I cannot login after installing z3c.formjs

2008-07-15 Thread kevin gill
Hi,

I am integrating z3c.formjs to a new site. After installing z3c.formjs I
can no longer login. If I remove it, I can login again.

It causes a problem with the SessionCredentials mechanism that I am using.
The SessionCredentials annotations now contains event handlers of type
z3c.formjs.jsclientevent.caughtEvents. These cannot be pickled.

I tried both the PersisentSessionDataContainer and the RamSessionData
Container.

Does anyone have suggestions on how I might proceed with this?

Thanks,

Kevin


This is the tail of the exception

2008-07-15T15:31:38 ERROR SiteError rm.commit(self)
--
2008-07-15T15:31:38 ERROR SiteError   File
"/opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/Connection.py",
line 541, in commit
--
2008-07-15T15:31:38 ERROR SiteError self._commit(transaction)
--
2008-07-15T15:31:38 ERROR SiteError   File
"/opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/Connection.py",
line 586, in _commit
--
2008-07-15T15:31:38 ERROR SiteError
self._store_objects(ObjectWriter(obj), transaction)
--
2008-07-15T15:31:38 ERROR SiteError   File
"/opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/Connection.py",
line 613, in _store_objects
--
2008-07-15T15:31:38 ERROR SiteError p = writer.serialize(obj)  # This
calls __getstate__ of obj
--
2008-07-15T15:31:38 ERROR SiteError   File
"/opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/serialize.py",
line 408, in serialize
--
2008-07-15T15:31:38 ERROR SiteError return self._dump(meta,
obj.__getstate__())
--
2008-07-15T15:31:38 ERROR SiteError   File
"/opt/zope3-eggs/ZODB3-3.9.0_dev_r77011-py2.4-linux-i686.egg/ZODB/serialize.py",
line 420, in _dump
--
2008-07-15T15:31:38 ERROR SiteError self._p.dump(state)



I investigated the offending object, and it is the SessionCredentials.
After adding the ajax handlers, the SessionCredentials object is no longer
pickleable.

(pdb) state=obj.__getstate__()
(Pdb) cPickle.dumps(state)
*** UnpickleableError: Cannot pickle 
objects
(Pdb) state
'credentials', ),),),)
(Pdb) credentials=state[0][0][0][1]
(Pdb) credentials.request_annotations
{'zope.app.publisher.browser.IUserPreferredLanguages': {'cached':
['en-gb', 'en']}, 'z3c.formjs.jsclientevent.caughtEvents':
[, , , , , , , , , , , , , , , , , , , , , , , , , ]}
(Pdb)
credentials.request_annotations['z3c.formjs.jsclientevent.caughtEvents'][0]

(Pdb)
cPickle.dumps(credentials.request_annotations['z3c.formjs.jsclientevent.caughtEvents'][0])
*** UnpickleableError: Cannot pickle 
objects

(Pdb) ev =
credentials.request_annotations['z3c.formjs.jsclientevent.caughtEvents'][0]
(Pdb) ev.object

(Pdb) cPickle.dumps(ev.object)
*** UnpickleableError: Cannot pickle 
objects
(Pdb) cPickle.dumps(ev.request)
*** TypeError: a class that defines __slots__ without defining
__getstate__ cannot be pickled




___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users