[Zope] Question about AdvancedQuery
Hi, I want use a query like : query['getPresta_chambres'] = { 'query': [15], 'range': 'min' } But with AdvancedQuery I don't see how make it : - query = And(Eq('portal_type', 'Meubles')) query = query Eq('review_state', 'published') # This query don't run : query = query Eq('getPresta_chambres', { 'query': [15],'range': 'min' }) - Could you help me :p ? Julian ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Re: Question about AdvancedQuery
You can use Le and Ge: query = query Le('getPresta_chambres', 15) Thank you very much, It's exactly the solution :p ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Unit Testing DTML and ZPT
On 7/26/07, Chris Gray [EMAIL PROTECTED] wrote: Is there any standard way of unit testing the two page templating methods in Zope 2? Chris If you're trying to test the output produced by a dtml/zpt, you could try to invoke it, inside a zopetestcase. Something like: self.app.index_html = PageTemplateFile(path_to_your_template, globals()) x = self.app.index_html(); self.assertEquals(some_string, x); I'm using here PageTemplateFile, but you can do it with standard ZopePageTemplate. The problem is what you're trying to test (and, therefore, to assert). Checking for equality is too fine grained, where you would check for the structure of the zpt, for example. A little parser could be useful. Regards Marco -- Marco Bizzarri http://iliveinpisa.blogspot.com/ ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Telling Psycopgda2 to return unicode strings
Hi, I don't know if this is common knowledge, but I couldn't find anything about it on the web. So I hacked it myself. When querying a Postgresql database using unicode in Zope 2.10 via ZPsycopgda2, the adapter will return unicode data in plain strings. To force unicode strings to be returned go to your Products folder and create a directory like ZPsycopgda2SetUnicode. In this directory put an __init__.py file containing this code: import psycopg2 import psycopg2.extensions psycopg2.extensions.register_type(psycopg2.extensions.UNICODE) After this restart Zope. ZPsycopgda2 should now return unicode strings. - Andreas ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] ZCatalog indexes and unit testing
Hello, I have created a ZCatalog object where I declare the following index: self.addIndex('featureType','FieldIndex') which works fine in my application But when I run it in my unit tests, I get the following error: self.addIndex('featureType','FieldIndex') File /opt/Plone3/lib/python/Products/ZCatalog/ZCatalog.py, line 971, in addIndex raise ValueError, Index of type %s not found % type ValueError: Index of type FieldIndex not found I am using the unitest package, I have declare a lot of stuff in configurationSetUp, but something is probably missing: (is there something to import from PluginIndexes ?) import unittest from zope.component.testing import setUp, tearDown from zope.configuration.xmlconfig import XMLConfig from zope.testing import doctest from zope.testing.doctestunit import DocFileSuite def configurationSetUp(self): setUp() import Products.zgeo import zope.component import zope.annotation import zope.app.publisher.browser import Products.Five import Products.Archetypes import Products.CMFCore import Products.GenericSetup XMLConfig('meta.zcml', zope.component)() XMLConfig('meta.zcml', zope.app.publisher.browser)() XMLConfig('meta.zcml', Products.Five)() XMLConfig('meta.zcml', Products.GenericSetup)() XMLConfig('meta.zcml', Products.CMFCore)() XMLConfig('configure.zcml', zope.annotation)() XMLConfig('configure.zcml', Products.Five)() XMLConfig('configure.zcml', Products.GenericSetup)() XMLConfig('configure.zcml', Products.Archetypes)() XMLConfig('configure.zcml', Products.zgeo)() Thanks, Eric ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Re: ZCatalog indexes and unit testing
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Eric Bréhault wrote: Hello, I have created a ZCatalog object where I declare the following index: self.addIndex('featureType','FieldIndex') which works fine in my application But when I run it in my unit tests, I get the following error: self.addIndex('featureType','FieldIndex') File /opt/Plone3/lib/python/Products/ZCatalog/ZCatalog.py, line 971, in addIndex raise ValueError, Index of type %s not found % type ValueError: Index of type FieldIndex not found I am using the unitest package, I have declare a lot of stuff in configurationSetUp, but something is probably missing: (is there something to import from PluginIndexes ?) import unittest from zope.component.testing import setUp, tearDown from zope.configuration.xmlconfig import XMLConfig from zope.testing import doctest from zope.testing.doctestunit import DocFileSuite def configurationSetUp(self): setUp() import Products.zgeo import zope.component import zope.annotation import zope.app.publisher.browser import Products.Five import Products.Archetypes import Products.CMFCore import Products.GenericSetup XMLConfig('meta.zcml', zope.component)() XMLConfig('meta.zcml', zope.app.publisher.browser)() XMLConfig('meta.zcml', Products.Five)() XMLConfig('meta.zcml', Products.GenericSetup)() XMLConfig('meta.zcml', Products.CMFCore)() XMLConfig('configure.zcml', zope.annotation)() XMLConfig('configure.zcml', Products.Five)() XMLConfig('configure.zcml', Products.GenericSetup)() XMLConfig('configure.zcml', Products.Archetypes)() XMLConfig('configure.zcml', Products.zgeo)() You need to get the 'PluginIndexes' product initialization triggered. Look into ZopeTestCase's 'installProduct' helper function. Tres. - -- === Tres Seaver +1 540-429-0999 [EMAIL PROTECTED] Palladion Software Excellence by Designhttp://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGqLxU+gerLs4ltQ4RAsF7AJ9HzKOCqIVefVxtKpViXsbK/AFS7QCg15IT Nzc/HTM4C1ksfOV/03CIwJg= =65tV -END PGP SIGNATURE- ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] ANN: eGenix EuroPython 2007 Presentations Videos
eGenix EuroPython 2007 Presentations Videos eGenix is pleased to announce the immediate availability of PDF and Flash video versions of the presentations we gave at this years EuroPython 2007 conference in Vilnius. This announcement is also available on our web-site for online reading: http://www.egenix.com/company/news/EuroPython-2007-Presentations.html INTRODUCTION The EuroPython Conference is the one of the premier conferences for Python Zope users and developers. This year it was being held from the 9th to 11th July in Vilnius, Lithuania. eGenix was one of the founding members of the EuroPython conference team and played a major role in organizing the first EuroPython conference in the year 2002. Since then we have attended every EuroPython conference to meet up face-to-face with the people from the Python Zope communities and have given regular talks at these conferences. TALKS AT EUROPYTHON 2007 We gave the following two talks at the conference. The presentations are available for viewing and download from our Presentations and Talks section: http://www.egenix.com/library/presentations/ As special feature, we have added talk videos in addition to providing the slide PDFs. You can view the talks online if you have the Adobe Flash Player 8 or later installed. * Parsing Languages with mxTextTools mxTextTools comes with a high performance Tagging Engine for text and Unicode data which can be used to tokenize and parse languages. The resulting abstract syntax tree can then be hooked up to a generator to build a complete and fast compiler in pure Python. The talk gives a short introduction to the way the mxTextTools Tagging Engine works and how it can be used to build compilers. mxTextTools is an eGenix Open Source product available as part of the eGenix mx Base Distribution. * An introduction to working with relational databases from Zope Although Zope has been around for quite a while, it continues to find new users particularly amongst non-programmers who are looking for a way to work with existing data which is usually in some relational database (PostgreSQL, MySQL, MS SQL, Oracle, DB2, etc.). One of the reasons for this is that Zope provides an extremely powerful, yet secure, through-the-web programming environment. The presentation is directed towards new users and will provide a brief introduction by example into the Zope way of doing things. At the same time it highlights how working within Zope is automatic training in good programming methodology: data management is delegated to ZSQL methods, PythonScripts act as controllers and Zope Page Templates provide the views. Together they encourage modularity and reusability. The sample application and database are available for download. Enjoy, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Jul 26 2007) Python/Zope Consulting and Support ...http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/ Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Unit Testing DTML and ZPT
On Thu, Jul 26, 2007 at 01:09:54PM +0200, Marco Bizzarri wrote: The problem is what you're trying to test (and, therefore, to assert). Checking for equality is too fine grained, where you would check for the structure of the zpt, for example. A little parser could be useful. testbrowser might come in handy: http://plone.org/documentation/tutorial/testing/functional-tests/view?searchterm=import It's also good to keep the design for testing adage in mind. Keep it granular. Do as much logic and data preparation as possible in product methods or scripts, which can be tested individually. Then your templates simply present this data. -- Paul Winkler http://www.slinkp.com ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Extracting all files from Zope DB
In order to migrate from Zope to ... (I don't know yet), we are trying to extract all the information located inside the Zope database. What do you mean by information? Code? I've found the FTP interface to the Zope database, I can browse inside the subfolder but, I can see any files !? If I post a new file via the web page, a folder is created (I see it via FTP) but the folder is empty ?! What do you mean by 'post a new file via web page'? What is 'web page'? Your application? ZMI? (Zope Management Interface)? How do you 'post' a file? Could you please tell me if there is a way to do that ? Could you please give me some hints ? Zope database is object database, what means it stores objects, not files, so you shouldn't expect files to be there. These are all objects. Even 'File' is instance of class 'File'. Some of these objects have methods that allow them to 'answer' to FTP requests, and you can see them in your FTP client. If some objects are not 'FTP enabled' you will not be able to use them via FTP. Take a look at group archives. AFAIR there were similiar questions some time ago. -- Maciej Wisniowski ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope-Checkins] SVN: Zope/trunk/ Merged r78365 from 2.10 branch.
Log message for revision 78366: Merged r78365 from 2.10 branch. Changed: U Zope/trunk/doc/CHANGES.txt U Zope/trunk/lib/python/Products/PageTemplates/ZopePageTemplate.py U Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py -=- Modified: Zope/trunk/doc/CHANGES.txt === --- Zope/trunk/doc/CHANGES.txt 2007-07-26 22:04:15 UTC (rev 78365) +++ Zope/trunk/doc/CHANGES.txt 2007-07-26 22:10:30 UTC (rev 78366) @@ -132,6 +132,9 @@ Bugs Fixed + - ZopePageTemplate's pt_edit did not recognize content type arguments +which had a charset information included. + - version.txt file was being written to the wrong place by the Makefile, causing Zope to report unreleased version even for released versions. Modified: Zope/trunk/lib/python/Products/PageTemplates/ZopePageTemplate.py === --- Zope/trunk/lib/python/Products/PageTemplates/ZopePageTemplate.py 2007-07-26 22:04:15 UTC (rev 78365) +++ Zope/trunk/lib/python/Products/PageTemplates/ZopePageTemplate.py 2007-07-26 22:10:30 UTC (rev 78366) @@ -126,7 +126,7 @@ encoding = None output_encoding = None -if content_type in ('text/xml',): +if content_type.startswith('text/xml'): if is_unicode: encoding = None @@ -134,9 +134,8 @@ else: encoding = encodingFromXMLPreamble(text) output_encoding = 'utf-8' - -elif content_type in ('text/html',) : +elif content_type.startswith('text/html'): charset = charsetFromMetaEquiv(text) @@ -156,8 +155,8 @@ output_encoding = 'iso-8859-15' else: -utext, encoding = convertToUnicode(text, - content_type, +utext, encoding = convertToUnicode(text, + content_type, preferred_encodings) output_encoding = encoding Modified: Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py === --- Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py 2007-07-26 22:04:15 UTC (rev 78365) +++ Zope/trunk/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py 2007-07-26 22:10:30 UTC (rev 78366) @@ -165,6 +165,13 @@ self.assertEqual(zpt.read(), s) self.assertEqual(isinstance(zpt.read(), unicode), True) +def testEditWithContentTypeCharset(self): +manage_addPageTemplate(self.app, 'test', xml_utf8, encoding='utf-8') +zpt = self.app['test'] +xml_unicode = unicode(xml_utf8, 'utf-8').strip() +zpt.pt_edit(xml_unicode, 'text/xml') +zpt.pt_edit(xml_unicode, 'text/xml; charset=utf-8') +self.assertEqual(zpt.read(), xml_unicode) def _createZPT(self): manage_addPageTemplate(self.app, 'test', text=utf8_str, encoding='utf-8') ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-dev] Zope Tests: 5 OK
Summary of messages to the zope-tests list. Period Wed Jul 25 12:00:00 2007 UTC to Thu Jul 26 12:00:00 2007 UTC. There were 5 messages: 5 from Zope Unit Tests. Tests passed OK --- Subject: OK : Zope-2.7 Python-2.3.6 : Linux From: Zope Unit Tests Date: Wed Jul 25 20:52:52 EDT 2007 URL: http://mail.zope.org/pipermail/zope-tests/2007-July/008087.html Subject: OK : Zope-2.8 Python-2.3.6 : Linux From: Zope Unit Tests Date: Wed Jul 25 20:54:23 EDT 2007 URL: http://mail.zope.org/pipermail/zope-tests/2007-July/008088.html Subject: OK : Zope-2.9 Python-2.4.4 : Linux From: Zope Unit Tests Date: Wed Jul 25 20:55:54 EDT 2007 URL: http://mail.zope.org/pipermail/zope-tests/2007-July/008089.html Subject: OK : Zope-2.10 Python-2.4.4 : Linux From: Zope Unit Tests Date: Wed Jul 25 20:57:24 EDT 2007 URL: http://mail.zope.org/pipermail/zope-tests/2007-July/008090.html Subject: OK : Zope-trunk Python-2.4.4 : Linux From: Zope Unit Tests Date: Wed Jul 25 20:58:55 EDT 2007 URL: http://mail.zope.org/pipermail/zope-tests/2007-July/008091.html ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [ZWeb] cvs.zope.com issues
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 26 Jul 2007, at 21:27, Mark W. Alexander wrote: Could someone be attempting to mirror via HTTP and inadvertently glomming the cvs views? Just FYI, the only true mirror I am aware of, the one set up by Christian Theune at http://svn.zope.de/zope.org/, uses the svnsync utility to poll for changes every 5 minutes. As far as I know this is not using the htp protocol. I may be wrong, I'm trying to find where it stores the source URLs to query and cannot see it. jens -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (Darwin) iD8DBQFGqQaERAx5nvEhZLIRApRnAJ9bxfbuLr1ifFKOacbQTiwg3YbVoQCeMab+ iLnkos8y/K/u3Kwfjt3zuYc= =ug5N -END PGP SIGNATURE- ___ Zope-web maillist - Zope-web@zope.org http://mail.zope.org/mailman/listinfo/zope-web
[Zope-DB] ANN: eGenix EuroPython 2007 Presentations Videos
eGenix EuroPython 2007 Presentations Videos eGenix is pleased to announce the immediate availability of PDF and Flash video versions of the presentations we gave at this years EuroPython 2007 conference in Vilnius. This announcement is also available on our web-site for online reading: http://www.egenix.com/company/news/EuroPython-2007-Presentations.html INTRODUCTION The EuroPython Conference is the one of the premier conferences for Python Zope users and developers. This year it was being held from the 9th to 11th July in Vilnius, Lithuania. eGenix was one of the founding members of the EuroPython conference team and played a major role in organizing the first EuroPython conference in the year 2002. Since then we have attended every EuroPython conference to meet up face-to-face with the people from the Python Zope communities and have given regular talks at these conferences. TALKS AT EUROPYTHON 2007 We gave the following two talks at the conference. The presentations are available for viewing and download from our Presentations and Talks section: http://www.egenix.com/library/presentations/ As special feature, we have added talk videos in addition to providing the slide PDFs. You can view the talks online if you have the Adobe Flash Player 8 or later installed. * Parsing Languages with mxTextTools mxTextTools comes with a high performance Tagging Engine for text and Unicode data which can be used to tokenize and parse languages. The resulting abstract syntax tree can then be hooked up to a generator to build a complete and fast compiler in pure Python. The talk gives a short introduction to the way the mxTextTools Tagging Engine works and how it can be used to build compilers. mxTextTools is an eGenix Open Source product available as part of the eGenix mx Base Distribution. * An introduction to working with relational databases from Zope Although Zope has been around for quite a while, it continues to find new users particularly amongst non-programmers who are looking for a way to work with existing data which is usually in some relational database (PostgreSQL, MySQL, MS SQL, Oracle, DB2, etc.). One of the reasons for this is that Zope provides an extremely powerful, yet secure, through-the-web programming environment. The presentation is directed towards new users and will provide a brief introduction by example into the Zope way of doing things. At the same time it highlights how working within Zope is automatic training in good programming methodology: data management is delegated to ZSQL methods, PythonScripts act as controllers and Zope Page Templates provide the views. Together they encourage modularity and reusability. The sample application and database are available for download. Enjoy, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Jul 26 2007) Python/Zope Consulting and Support ...http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/ Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 ___ Zope-DB mailing list Zope-DB@zope.org http://mail.zope.org/mailman/listinfo/zope-db