[z3] trying sqlos on zope3 trunk

Sidnei da Silva sidnei at enfoldsystems.com
Mon Aug 22 05:27:21 CEST 2005


On Sun, Aug 21, 2005 at 09:55:04AM +0200, Adam Groszer wrote:
| I'm trying to use sqlos with the current Zope3 trunk.
| 
| I'm trying to get the example working that is described in the
| 
| readme.txt. (I use the package "sot" instead of "myproject")
| 
| 
| 
| I had to do a small fix:
| 
| ===================================================================
| 
| --- subscriber.py       (revision 15900)
| 
| +++ subscriber.py       (working copy)
| 
| @@ -23,9 +23,12 @@
| 
|      # If we don't do this, the cache will be cleared
| 
|      # and if we try to re-fetch the object we will
| 
|      # lose the new values.
| 
| -    obj.syncUpdate()
| 
| +    unproxied = removeSecurityProxy(obj)
| 
| +    #obj.syncUpdate()
| 
| +    unproxied.syncUpdate()
| 
|  
| 
| -    expired(obj)
| 
| +    #expired(obj)
| 
| +    expired(unproxied)
| 
|  
| 
|  sqlobjectCreatedSubscriber = sqlobjectModifiedSubscriber
| 
| 
| 
| to get it working.

Humm... Smells like you didn't declare the right permission settings
for your object. I usually do something like this:

  <content class="sip.project.Project">

    <require
        permission="sip.ViewProject"
        interface="sqlos.interfaces.ISQLObject"
        />

  </content>


| 
| After that the container and editform is working fine, but I cannot
| 
| add a new Person. There is no item to add on the left side.
| 
| 
| 
| If I try to
| 
| <browser:addform
| 
|     schema="sot.interfaces.IPerson"
| 
|     label="New Person"
| 
|     name="AddPerson.html"
| 
|     permission="zope.ManageContent" 
| 
|     >
| 
| </browser:addform>
| 
| 
| 
| <browser:addMenuItem
| 
|     title="Person"
| 
|     class="sot.app.Person"
| 
|     permission="zope.ManageContent"
| 
|     view="AddPerson.html"
| 
|     />
| 
| it fails even on diplaying the container itself, with:
| 
| ...
| 
|   File "f:\w\pyt\sqlos\container\__init__.py", line 150, in __len__
| 
|     for k in self.keys(): i += 1
| 
|   File "f:\w\pyt\sqlos\container\__init__.py", line 87, in keys
| 
|     for name, obj in self.items(): yield name
| 
|   File "f:\w\pyt\sqlos\container\__init__.py", line 104, in items
| 
|     for obj in factory.select():
| 
| AttributeError: 'NoneType' object has no attribute 'select'
| 
| 
| 
| As I checked SQLObjectContainer.allowedFactories() returns also the
| 
| BrowserAdd__sot.app.Person factory. In turn factory =
| 
| getFactory(factoryName) fails as it returns None.
| 


Uhm. I use a specific factory:

  <sqlos:factory
      id="sip.Project"
      title="Project"
      component="sip.project.Project"
      />


-- 
Sidnei da Silva
Enfold Systems, LLC.
http://enfoldsystems.com


More information about the z3 mailing list