[ZODB-Dev] ZEO for GUI applications

Robert Gravina robert at gravina.com
Sat Mar 31 11:51:37 EDT 2007


On Apr 1, 2007, at 12:31 AM, Robert Gravina wrote:

>
> On Mar 31, 2007, at 11:41 PM, Robert Gravina wrote:
>
>>
>> On Mar 31, 2007, at 11:13 PM, Robert Gravina wrote:
>>
>>>
>>> On Mar 31, 2007, at 10:32 PM, Stephan Richter wrote:
>>>
>>>> On Thursday 29 March 2007 15:14, Robert Gravina wrote:
>>>>> Is anyone using ZEO to build mutliuser networked applications  
>>>>> outside
>>>>> of Zope?
>>>>
>>>> Uwe Oestermeier and his team built Bebop. While the server  
>>>> component uses Zope
>>>> 3, it uses a full wxPython GUI as client.
>>>>
>>>> http://svn.kmrc.de/
>>>
>>> Wow, that looks very impressive. I'll checkout the source and  
>>> have a look around to see what I can learn.
>>>
>>> Thanks,
>>>
>>> Robert
>>>
>>
>> I'm still a little bit unsure about how to update the GUI when  
>> objects are changed.
>>
>> I noticed a previous thread on a similar topic which suggested to  
>> customise ZODB.DB.invalidate.
>> http://www.mail-archive.com/zodb-dev@zope.org/msg01969.html
>>
>> I thought I could check the type of object, and generally that  
>> will be enough for me to decide which parts of the UI need a  
>> refresh. It seems though, that when I change data from one client  
>> other clients, although getting invalidate messages, are still  
>> displaying old data.
>>
>> I tried subclassing DB, and printing out the object as a test, but  
>> it's always "None" (even when I have a few clients connected). The  
>> code there to get the object from the cache I don't quite  
>> understand, I just copied it from ZODB.DB.invalidate and hoped for  
>> the best :)
>>
>> class UpdatedDB(DB):
>>     def invalidate(self, tid, oids, connection=None, version=''):
>>         DB.invalidate(self, tid, oids, connection, version)
>>         for oid in oids.keys():
>>             h = hash(oid) % 131
>>             o = self._miv_cache.get(h, None)
>>             print o
>>
>> Is there anything else I need to do/doing wrong?
>>
>
> Woohoo! I realised Connection.sync() does exactly what I need, but  
> this still doesn't work as expected.
>
> class UpdatedDB(DB):
>     def invalidate(self, tid, oids, connection=None, version=''):
>         DB.invalidate(self, tid, oids, connection, version)
>         if connection is not None:
>             connection.sync()
>

OK, I realised the connection passed in is the one that committed the  
transaction, but we want to refresh the connection for the current  
client, so I've changed the code to do that (but still no luck).  
(here ApplicationPresenter is a singleton that holds a reference to  
the connection (well, reachable from it anyway)).

class UpdatedDB(DB):
     def invalidate(self, tid, oids, connection=None, version=''):
         DB.invalidate(self, tid, oids, connection, version)
         appmodel = ApplicationPresenter.getInstance().model
         if connection is not appmodel.connection:
             appmodel.connection.sync()

> Am I going about this the right way?
>
> Thanks,
>
> Robert
>
>
>> Robert
>>
>>
>>
>> _______________________________________________
>> For more information about ZODB, see the ZODB Wiki:
>> http://www.zope.org/Wikis/ZODB/
>>
>> ZODB-Dev mailing list  -  ZODB-Dev at zope.org
>> http://mail.zope.org/mailman/listinfo/zodb-dev
>
> _______________________________________________
> For more information about ZODB, see the ZODB Wiki:
> http://www.zope.org/Wikis/ZODB/
>
> ZODB-Dev mailing list  -  ZODB-Dev at zope.org
> http://mail.zope.org/mailman/listinfo/zodb-dev



More information about the ZODB-Dev mailing list