dataflake.org

Home Documentation Software Old Stuff

Removed ZLOGLogger objects prevent LDAPUserFolder migration (Resolved)

Request LDAP User Folder -- bug report -- by Martijn Pieters
Posted on Sep 19, 2007 12:37 pm
Subscribe

Enter your email address to receive mail on every change to this issue.

Entries (Latest first)


  Comment by Jens Vagelpohl on Sep 20, 2007 4:44 am
  Thanks for the patch, it's checked in now:

http://svn.dataflake.org/?view=rev&revision=1432

As for the attachments, there's way too many automated attempts at spreading mischief already, I don't want to offer yet another route to annoy me by trying to exploit something that is available anonymously...
 

  Comment by =?ISO-8859-1?Q?Martijn_Pieters_=B7_Plone_Solutions?= on Sep 20, 2007 4:26 am
  Heh, if your tracker strips attachments there is not much point in
sending them. ;-)

Patch copied and pasted below my sig.


Index: LDAPDelegate.py
===================================================================
- --- LDAPDelegate.py (revision 1431)
+++ LDAPDelegate.py (working copy)
@@ -53,6 +53,18 @@
results - Sequence of results
"""
+ def __setstate__(self, v):
+ """
+ __setstate__ is called whenever the instance is loaded
+ from the ZODB, like when Zope is restarted.
+ """
+ # Call inherited __setstate__ methods if they exist
+ LDAPDelegate.inheritedAttribute('__setstate__')(self, v)
+
+ # Delete old-style logger instances
+ if getattr(self, '_logger', None) is not None:
+ del self._logger
+
def __init__( self, server='', login_attr='', users_base='',
rdn_attr=''
, use_ssl=0, bind_dn='', bind_pwd='', read_only=0
):
Index: LDAPUserSatellite.py
===================================================================
- --- LDAPUserSatellite.py (revision 1431)
+++ LDAPUserSatellite.py (working copy)
@@ -92,7 +92,11 @@
if not hasattr(self, '_hash'):
self._hash = '%s%s' % (self.meta_type, str(time.time()))
+ # Delete old-style logger instances
+ if getattr(self, '_logger', None) is not None:
+ del self._logger
+
def __init__(self, luf, title='', recurse=0):
""" Create a new LDAPUserSatellite instance """
self._hash = '%s%s' % (self.meta_type, str(time.time()))

 

  Comment by Jens Vagelpohl on Sep 20, 2007 4:16 am
  What patch?
 

  Comment by =?ISO-8859-1?Q?Martijn_Pieters_=B7_Plone_Solutions?= on Sep 19, 2007 3:46 pm
  On 19. sep. 2007, at 19.10, JTracker wrote:
> Nearly there. LDAPDelegate and LDAPUserSatellite have _logger
> attributes too. :-)


Attached a patch that solves the issue completely for me. Thanks, Jens!

 

  Comment by Martijn Pieters on Sep 19, 2007 1:10 pm
  Nearly there. LDAPDelegate and LDAPUserSatellite have _logger attributes too. :-)
 

  Resolve by Jens Vagelpohl on Sep 19, 2007 1:01 pm
  No problem, here it is:

http://svn.dataflake.org/?view=rev&revision=1431

 

  Initial Request by Martijn Pieters on Sep 19, 2007 12:37 pm
  In 2.7, LDAPUserFolder switched to the logger module, and stopped using the deprecated ZLOG module.

However, and site that once used LDAPUserFolder 2.6 or older will still have persistent _logger attributes in various places. These are now OFS.UnInstalled.BrokenClass instances, which prevent you from migrating to PlonePAS with Plone 2.5. Deleting these objects by hand before migration solves this problem.

Perhaps you could add a __setstate__ hook that deletes these fossils where they occured.