[PEAK] PEAK CVS vs. ZODB CVS :: [pP]ersistence :: Round 1, Fight!
Bob Ippolito
bob at redivi.com
Sun Feb 22 02:52:45 EST 2004
On Feb 20, 2004, at 12:16 PM, Phillip J. Eby wrote:
> At 12:11 PM 2/20/04 -0500, Bob Ippolito wrote:
>
>> On Feb 20, 2004, at 11:59 AM, Phillip J. Eby wrote:
>>> However, my plan for alpha 4 was to drop the use of ZODB altogether
>>> and go with a PEAK-specific persistence mechanism. But I haven't
>>> designed that mechanism yet, so it's not a quick fix.
>>
>> I'm pretty sure that the latest ZODB 3.3 doesn't use ExtensionClass,
>> it uses a new style class (written in C).
>
> I may investigate that if I have the time, but I'm concerned that if
> the semantics of the 3.3 version are different from ZODB4, I may waste
> a lot of time hacking how PEAK wraps it that would be better spent
> replacing it altogether.
On further inspection.. the ZODB 3.3 that I'm using (ZODB in the CVS
repo) has a module called "persistent" which seems equivalent to the
"persistence" module that PEAK uses, with a few small changes (i.e. it
doesn't seem to have the stupid 2.2 hack, so I made the metaclass
type). I did have to make a small patch to the persistent module such
that it gets Interface and Attribute from protocols if ZODB isn't
available (otherwise it uses garbage old style classes in place).
Index: src/peak/persistence.py
===================================================================
RCS file: /cvsroot/PEAK/src/peak/persistence.py,v
retrieving revision 1.5
diff -u -r1.5 persistence.py
--- src/peak/persistence.py 2003/06/05 16:19:55 1.5
+++ src/peak/persistence.py 2004/02/22 07:04:09
@@ -10,12 +10,12 @@
import __main__
md = __main__.__dict__
-Persistent = importString('persistence:Persistent', md)
-PersistentMetaClass =
importString('persistence:PersistentMetaClass', md)
-GHOST =
importString('persistence._persistence:GHOST', md)
-IPersistent =
importString('persistence.interfaces:IPersistent', md)
+Persistent = importString('persistent:Persistent', md)
+PersistentMetaClass = type
+GHOST = importString('persistent:GHOST', md)
+IPersistent =
importString('persistent.interfaces:IPersistent', md)
IPersistentDataManager = importString(
- 'persistence.interfaces:IPersistentDataManager', md
+ 'persistent.interfaces:IPersistentDataManager', md
)
def isGhost(obj):
I also changed the setup.py to check for ZEO instead of zope.component,
because ZODB installs ZConfig too -- but that's more of a hack.
All of the tests pass, except one related to ZConfig.. something about
u'/Library/Python/2.3_PEAK/ZConfig/doc/schema.dtd' not being a valid
URL type.. on further inspection, it seems that it's not normalizing
the relative path against the document's base.. it's trying to use
'../../ZConfig/doc/schema.dtd' directly, instead of os.path.join(base,
'../../blah') and ends up trying to load it as a url when that fails.
It actually gets ends up with the correct path when it *does* do the
normalization, but it doesn't stick "file://" in front of it. I'm
going to file a bug against PyXML and maybe Python on this one.
>
/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/
site-packages/_xmlplus/sax/saxutils.py(515)prepare_input_source()
-> f = urllib2.urlopen(source.getSystemId())
(Pdb) source.getSystemId()
u'/Library/Python/2.3_PEAK/ZConfig/doc/schema.dtd'
-bob
More information about the PEAK
mailing list