[Zope-dev] zpatterns-0.4: creating an item in "virtual mode"
Jephte CLAIN
Jephte.Clain@univ-reunion.fr
Wed, 05 Jul 2000 11:14:49 +0400
Hello,
I use virtual attribute access to provide access to my SQL database.
However, I want to use the Rack.newItem facility to create new records
in the database.
But it fails because in virtual mode, an item always exists.
This patch solves the problem, at least for me
--- Rack.py.orig Mon Jun 26 11:35:25 2000
+++ Rack.py Wed Jul 5 11:13:04 2000
@@ -125,7 +125,8 @@
# Create a new object, identified by key
- item = self.getItem(key)
+ a = self.loadAttrib
+ item = not a and self.getItem(key) or None
# XXX What if all items potentially exist?
@@ -134,7 +135,6 @@
item = self._RawItem(key)
- a = self.loadAttrib
if not a:
slot = self._writeableSlot(key)
slot[SelfKey] = item.aq_base # strip acquisition
wrapping
comments?
regards,
jephte.clain@univ-reunion.fr