Skip to content

Commit

Permalink
Encode _p_oid that can be text when the DB was migrated from py2
Browse files Browse the repository at this point in the history
  • Loading branch information
pbauer committed Mar 14, 2019
1 parent 5bfaa7e commit e6a408e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions five/intid/keyreference.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from five.intid.site import get_root
from zope.lifecycleevent.interfaces import IObjectAddedEvent

import six


@adapter(IPersistent)
@implementer(IConnection)
Expand Down Expand Up @@ -93,6 +95,8 @@ def root(self):
# object. Asking the root object on the wrong db can trigger
# an POSKeyError.
connection = IConnection(self.object).get_connection(self.root_dbname)
if isinstance(self.root_oid, six.text_type):
self.root_oid = self.root_oid.encode('utf8')
return connection[self.root_oid]

@property
Expand Down

0 comments on commit e6a408e

Please sign in to comment.