Re: [Zope3-Users] Guidance on accessing MySQL db.
Admittedly there has not been much documentation of connecting Zope 3 to a relational database like MySQL. - Personally I don't have much experience either. Some hints anyway: The preferred way is to use an ORM * either SQLObject - then use sqlos http://codespeak.net/z3/sqlos/ * or sqlalchemy - then you have two choices - the older one: http://svn.zope.org/z3c.zalchemy/trunk demos: z3c.zalchemy/trunk/src/z3c/zalchemy/demo - the younger one: http://svn.zope.org/z3c.sqlalchemy/trunk/ (I would go for z3c.sqlalchemy) Also have a look at http://svn.zope.org/mysqldbda/trunk/ for a connection without an ORM (not sure in what shape that code is) Maybe the authors of those packages can give better advice. -Andreas On Fri, Mar 30, 2007 at 03:32:16PM -0700, Rich C wrote: Hello all, I've just started using Zope 3 and am having some difficulty finding examples on a good way to access a MySQL database. For the moment, I'd just like to be able to read from the database and display it in a web page with decent formatting. I've read examples from Zope 2 where they used a DTML page that called a ZSQL method such as the following: dtml-in river_info dtml-var river_id dtml-var river_name /dtml-in ZSQL method would then contain: SELECT river_id, river_name FROM river_info In Zope 3, I only see an option to add a SQL script which I'm pretty sure is not the same thing as a ZSQL method since I've copied the above into a SQL script and Testing the script by itself does in fact read from the MySQL database, but I can not access the SQL script from a DTML page. I get the following error: KeyError A server error occurred. So, some very basic questions : What is the suggested way to access a MySQL database from Zope 3. Should I even be creating DTML scripts, my understanding was that there are better ways of doing things than with DTML in Zope 3. Basically, I just want to be able to customize the displaying of whats in the database. On this list, there was a posting of someone creating a content type to access the database. Maybe this is what I need to be doing. Seems like a lot of overhead, as compared to Zope 2. Here is a link to that thread: http://mail.zope.org/pipermail/zope3-users/2006-February/002476.html Basically, I'm looking for guidance/suggestions on the right way to go about doing this. Any help would be greatly appreciated. Thanks, Rich Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. http://games.yahoo.com/games/front ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users !DSPAM:460d9c8b229491637432971! ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Guidance on accessing MySQL db.
I've read examples from Zope 2 where they used a DTML page that called a ZSQL method such as the following: dtml-in river_info dtml-var river_id dtml-var river_name /dtml-in ZSQL method would then contain: SELECT river_id, river_name FROM river_info In Zope 3, I only see an option to add a SQL script which I'm pretty sure is not the same thing as a ZSQL It is the same thing, at last in the way it works. method since I've copied the above into a SQL script and Testing the script by itself does in fact read from the MySQL database, but I can not access the SQL script from a DTML page. I get the following error: KeyError A server error occurred. Take look at site error log or at log/transcript.log to see full traceback. Simplest thing you should do is to 1. Create database connection object. For MySQL you should use: http://www.zope.org/Products/Zope3-Packages/mysqldbda/view Create this object TTW, enter proper connection string and check if it works with Test tab. Then click at Registration tab and register connection object under specific name. 2. Create SQLScript object At the add form you should see Connection field and you should be able to chose connection you've created at point 1 (that is why your connection had to be registered). 3. Enter SQL statements into SQLScript object, save and test it 4. create view to display data from SQLScript Read about relational database connectivity in Zope2 book. A lot of thing is valid with zope3 too. So, some very basic questions : What is the suggested way to access a MySQL database from Zope 3. In fact you may use traditional way (as above) or use ORMs like SQLObject or SQLAlchemy. Not sure what is preffered. For me this is up to personal preferences. -- Maciej Wisniowski ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Guidance on accessing MySQL db.
Am Samstag, 31. März 2007 00:32 schrieb Rich C: Hello all, I've just started using Zope 3 and am having some difficulty finding examples on a good way to access a MySQL database. For the moment, I'd just like to be able to read from the database and display it in a web page with decent formatting. I'd also recommend to use z3c.zalchemy, as an ORM integrates far better with the concepts of Zope3. Regards, Hermann -- [EMAIL PROTECTED] GPG key ID: 299893C7 (on keyservers) FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] z.a.component.vocabulary.UtilityNameTerm bad implementation ?
On Sat, Mar 31, 2007 at 08:51:44AM +0300, Shaar Gabriel wrote: hi using zope3.3.0 on gentoo zope.app.component.vocabulary.UtilityNameTerm is marked as implementing ITokenizedTerm, but in fact tries to implement ITitledTokenizedTerm, and fails at that, because token and title are implemented as methods not properties. bug ? I think so. BTW, the UtilityName vocabulary that uses UtilityNameTerms does not appear to be used anywhere. Marius Gedminas -- You'll find creativity working hand in hand with engineering. It will feel strange and you might feel like things are out of control. Relax - they are. -- Richard Gabriel on software http://www.dreamsongs.net/LessonsFromNothing.html signature.asc Description: Digital signature ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] z.a.component.vocabulary.UtilityNameTerm bad implementation ?
On Saturday 31 March 2007 19:41:35 Marius Gedminas wrote: On Sat, Mar 31, 2007 at 08:51:44AM +0300, Shaar Gabriel wrote: hi using zope3.3.0 on gentoo zope.app.component.vocabulary.UtilityNameTerm is marked as implementing ITokenizedTerm, but in fact tries to implement ITitledTokenizedTerm, and fails at that, because token and title are implemented as methods not properties. bug ? I think so. BTW, the UtilityName vocabulary that uses UtilityNameTerms does not appear to be used anywhere. Marius Gedminas I've found a use for it when i was fixing the zope3 wrapper code for textindexng3 (3.2.0), which as far as i can tell was broken. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users