Re: [ZODB-Dev] ZEO for GUI applications

2007-04-01 Thread Dieter Maurer
Robert Gravina wrote at 2007-4-1 00:31 +0900:
 ...
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()

Am I going about this the right way?

Recently, Chris Withers reported a strange AssertionError
after a call of loadBefore. The following discussion lead to the
conclusion that the current ZODB code (its MVCC part) may not allow to call
invalidate when the objects was not modified.

If, on the other hand, the object was modified, invalidate is
called automatically. No need to do it yourself.


Furthermore, be aware that Connection.sync aborts the current transaction.


-- 
Dieter
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] ZEO for GUI applications

2007-03-31 Thread Robert Gravina


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

___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] ZEO for GUI applications

2007-03-31 Thread Robert Gravina


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?

Robert



___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] ZEO for GUI applications

2007-03-31 Thread Robert Gravina


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()

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@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@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] ZEO for GUI applications

2007-03-30 Thread Robert Gravina


On Mar 30, 2007, at 5:55 AM, Robert Gravina wrote:



On Mar 30, 2007, at 5:24 AM, Rodrigo Senra wrote:



That is precisely what I did in the first example I have mentioned,
and it worked just fine.


Just responding to this thread again to ask if anyone has used ZEO as  
the basis for a networked app on a larger scale that Rodrigo's test?  
What I'd like to know is how I will go if I have several (lets say,  
100 max) GUI clients connected to one ZEO, assuming the application  
has relatively few writes.


I'd just like to know if anyone else out there is using ZEO in this  
way, or if developers think this is a bad idea.


Programming-wise, I couldn't be happier. It is simply amazing to be  
able to share a object database over a network like this (to my  
little brain anyway).


Robert

___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] ZEO for GUI applications

2007-03-29 Thread Robert Gravina


On Mar 30, 2007, at 5:24 AM, Rodrigo Senra wrote:



[ Robert Gravina ]:

|short version:
|
|Is anyone using ZEO to build mutliuser networked applications outside
|of Zope?

Well, I have developed a trivial in-house desktop-based
employee activity control (Argh!) a couple of years ago.
It started as a ZODB+wxPython standalone exercise, and changing
one line the application (from FileStorage to ClientStorage) ;o)
... and adding ZEO ... it became a client/server desktop apps.


It always amazes me that in ZEO you can do that. When I'm coding apps  
for users to manage some kind of shared data, that's the kind of  
level I like programming at. Why is it with other frameworks I have  
to jump through hoops to do something which, to me, seems like every  
multi-user networked application is going to need?




It impressed some folks down here and it was in production use
until it was finally replaced for a Web version integrated to
our Zope/Plone portal.



Yeah everyone wants to go web these days. I don't understand how  
users put up with web pages trying to be GUI forms when they could  
just have a proper GUI :) Anyway I'm getting off topic...



Having said that, I believe that is not the list to discuss it.
:o)

|longer version:
|
|I've been designing and coding (and re-designing and re-coding) a
|multi-user GUI application in Python for some time now. At this
|stage, it's mainily just GUI forms for editing data and some logic to
|share objects with users, keep them from editing the same entry at
|the same time etc. I'm currently using Twisted and a a python object-
|reational DB called Axiom, built on top of sqllite.

I did a curious experiment during a cross-language event that took
place in Sao Paulo/Brazil. Several guys presented their favorite
programming languages and frameworks: Java-something, Rails, PHP- 
something

and Python (me). While the Java presentation was taking place, I have
coded (on the fly) the same example presented there.
As an introduction to my talk (last in the day) I presented to the  
audience
my crude ZODB+Twisted version, that had the strengths of all  
frameworks
and yet was much smaller and coded by a mediocre developer while  
distracted

by a Java-something talk ;o)



:) I actually was using ZODB+Twisted before I used Axiom+Twisted, but  
without ZEO it really doesn't matter what DB I use.


It's a shame to have wasted all this time I've spent on the Twisted  
version, when really I should have written a small ZEO test  
application to see if my ideas would work out. I think this weekend I  
will do just that, and think about if I should spend the time  
porting my app to ZEO. There are so many ways I can think of this  
cutting down on the code I write - e.g. GUI forms for editing the  
main types of objects in the app could start a transaction when they  
are created, allow the user to modify the attributes as they see fit,  
and commit when Save is clicked, or rollback if there was a  
validation error. Currently there is so much code in my app for a  
simple update like this - first I make deep copies of objects so  
users don't edit the original versions, then if it validates OK I  
send to the server where it  copies attributes accross and updates  
lists etc. etc. then notifies clients that the object has changed.


It's not that I am lazy, I just don't trust the code I write to do  
all this and keep clients in sync, even with tests. It's a hard  
problem to solve.


The full history is here [1], even though in Portuguese, the Python  
code

is Universally readable.
[1] http://article.gmane.org/gmane.comp.python.brasil/21504/ 
match=senra+zodb+twisted+tempo+real





thanks


That is precisely what I did in the first example I have mentioned,
and it worked just fine. But I had a very controlled environment (our
tiny little company) and very savy user base (all Python developers).
If your application have many more reads than writes you will be
fine. In case you want to discuss this in PVT, feel free to
email me.


Yes, my application definitely will have more reads than writes.

i think I'll spend some time trying to get the current incarnation of  
the app going with ZEO over the weekend and see how I go.


Robert




Abração,
Senra

-
Rodrigo Senra
GPr Sistemas
http://www.gpr.com.br
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@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@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev