[Zope-Checkins] SVN: Zope/branches/2.9/ - Collector #2116: sequence.sort() did not work properly
Log message for revision 68491: - Collector #2116: sequence.sort() did not work properly locale related comparison methods Changed: U Zope/branches/2.9/doc/CHANGES.txt U Zope/branches/2.9/lib/python/DocumentTemplate/sequence/SortEx.py -=- Modified: Zope/branches/2.9/doc/CHANGES.txt === --- Zope/branches/2.9/doc/CHANGES.txt 2006-06-05 09:46:04 UTC (rev 68490) +++ Zope/branches/2.9/doc/CHANGES.txt 2006-06-05 09:55:51 UTC (rev 68491) @@ -20,6 +20,9 @@ - Updated Five to bugfix release 1.3.6. + - Collector #2116: sequence.sort() did not work properly +locale related comparison methods + Zope 2.9.3 (2006/05/13) Bugs fixed Modified: Zope/branches/2.9/lib/python/DocumentTemplate/sequence/SortEx.py === --- Zope/branches/2.9/lib/python/DocumentTemplate/sequence/SortEx.py 2006-06-05 09:46:04 UTC (rev 68490) +++ Zope/branches/2.9/lib/python/DocumentTemplate/sequence/SortEx.py 2006-06-05 09:55:51 UTC (rev 68491) @@ -17,8 +17,9 @@ $Id$ -from types import TupleType +from App.config import getConfiguration + def sort(sequence, sort=(), _=None, mapping=0): - sequence is a sequence of objects to be sorted @@ -82,7 +83,7 @@ s=[] for client in sequence: k = None -if type(client)==TupleType and len(client)==2: +if isinstance(client, tuple) and len(client)==2: if isort: k=client[0] v=client[1] else: @@ -133,14 +134,27 @@ def nocase(str1, str2): return cmp(str1.lower(), str2.lower()) -import sys -if sys.modules.has_key(locale): # only if locale is already imported -from locale import strcoll +def getStrcoll(): -def strcoll_nocase(str1, str2): -return strcoll(str1.lower(), str2.lower()) +if getConfiguration().locale: +from locale import strcoll +return strcoll +else: +raise RuntimeError(strcoll() is only available for a proper 'locale' configuration in zope.conf) +def getStrcoll_nocase(): +if getConfiguration().locale: +from locale import strcoll +return strcoll +def strcoll_nocase(str1, str2): +return strcoll(str1.lower(), str2.lower()) +return strcoll_nocase + +else: +raise RuntimeError(strcoll() is only available for a proper 'locale' configuration in zope.conf) + + def make_sortfunctions(sortfields, _): Accepts a list of sort fields; splits every field, finds comparison function. Returns a list of 3-tuples (field, cmp_function, asc_multplier) @@ -168,9 +182,9 @@ elif f_name == nocase: func = nocase elif f_name in (locale, strcoll): -func = strcoll +func = getStrcoll() elif f_name in (locale_nocase, strcoll_nocase): -func = strcoll_nocase +func = getStrcoll_nocase() else: # no - look it up in the namespace func = _.getitem(f_name, 0) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/2.10/ - Collector #2116: sequence.sort() did not work properly
Log message for revision 68493: - Collector #2116: sequence.sort() did not work properly locale related comparison methods Changed: U Zope/branches/2.10/doc/CHANGES.txt U Zope/branches/2.10/lib/python/DocumentTemplate/sequence/SortEx.py -=- Modified: Zope/branches/2.10/doc/CHANGES.txt === --- Zope/branches/2.10/doc/CHANGES.txt 2006-06-05 09:56:48 UTC (rev 68492) +++ Zope/branches/2.10/doc/CHANGES.txt 2006-06-05 09:57:28 UTC (rev 68493) @@ -23,6 +23,10 @@ - Acquisition wrappers now correctly proxy __contains__. + - Collector #2116: sequence.sort() did not work properly +locale related comparison methods + + Zope 2.10.0 beta 1 (2006/05/30) Restructuring Modified: Zope/branches/2.10/lib/python/DocumentTemplate/sequence/SortEx.py === --- Zope/branches/2.10/lib/python/DocumentTemplate/sequence/SortEx.py 2006-06-05 09:56:48 UTC (rev 68492) +++ Zope/branches/2.10/lib/python/DocumentTemplate/sequence/SortEx.py 2006-06-05 09:57:28 UTC (rev 68493) @@ -17,8 +17,9 @@ $Id$ -from types import TupleType +from App.config import getConfiguration + def sort(sequence, sort=(), _=None, mapping=0): - sequence is a sequence of objects to be sorted @@ -82,7 +83,7 @@ s=[] for client in sequence: k = None -if type(client)==TupleType and len(client)==2: +if isinstance(client, tuple) and len(client)==2: if isort: k=client[0] v=client[1] else: @@ -133,14 +134,27 @@ def nocase(str1, str2): return cmp(str1.lower(), str2.lower()) -import sys -if sys.modules.has_key(locale): # only if locale is already imported -from locale import strcoll +def getStrcoll(): -def strcoll_nocase(str1, str2): -return strcoll(str1.lower(), str2.lower()) +if getConfiguration().locale: +from locale import strcoll +return strcoll +else: +raise RuntimeError(strcoll() is only available for a proper 'locale' configuration in zope.conf) +def getStrcoll_nocase(): +if getConfiguration().locale: +from locale import strcoll +return strcoll +def strcoll_nocase(str1, str2): +return strcoll(str1.lower(), str2.lower()) +return strcoll_nocase + +else: +raise RuntimeError(strcoll() is only available for a proper 'locale' configuration in zope.conf) + + def make_sortfunctions(sortfields, _): Accepts a list of sort fields; splits every field, finds comparison function. Returns a list of 3-tuples (field, cmp_function, asc_multplier) @@ -168,9 +182,9 @@ elif f_name == nocase: func = nocase elif f_name in (locale, strcoll): -func = strcoll +func = getStrcoll() elif f_name in (locale_nocase, strcoll_nocase): -func = strcoll_nocase +func = getStrcoll_nocase() else: # no - look it up in the namespace func = _.getitem(f_name, 0) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-dev] Re: [Zope-Checkins] SVN: Zope/trunk/lib/python/Products/PageTemplates/ Merged r68461 from 2.10 branch:
Have you read the discussion on the list about this? Backward compatibility? Third-party apps? Duh. On 5 Jun 2006, at 14:18, Chris Withers wrote: Out of interst, why not just make this change wherever empty tales expreessions have been used in the past? It'd be clearer as to what the intention was and remove the necessity for hacky code like this... cheers, Chris Florent Guillaume wrote: Log message for revision 68462: Merged r68461 from 2.10 branch: Empty TALES path expressions are allowed in Zope 2. http://www.zope.org/Collectors/Zope/2118 Changed: U Zope/trunk/lib/python/Products/PageTemplates/Expressions.py U Zope/trunk/lib/python/Products/PageTemplates/tests/ testExpressions.py -=- Modified: Zope/trunk/lib/python/Products/PageTemplates/Expressions.py === --- Zope/trunk/lib/python/Products/PageTemplates/Expressions.py 2006-06-02 15:02:15 UTC (rev 68461) +++ Zope/trunk/lib/python/Products/PageTemplates/Expressions.py 2006-06-02 15:04:12 UTC (rev 68462) @@ -99,6 +99,8 @@ class ZopePathExpr(PathExpr): def __init__(self, name, expr, engine): +if not expr.strip(): +expr = 'nothing' super(ZopePathExpr, self).__init__(name, expr, engine, boboAwareZopeTraverse) Modified: Zope/trunk/lib/python/Products/PageTemplates/tests/ testExpressions.py === --- Zope/trunk/lib/python/Products/PageTemplates/tests/ testExpressions.py 2006-06-02 15:02:15 UTC (rev 68461) +++ Zope/trunk/lib/python/Products/PageTemplates/tests/ testExpressions.py 2006-06-02 15:04:12 UTC (rev 68462) @@ -86,6 +86,15 @@ self.failUnless(isinstance(defer, DeferWrapper)) self.failUnless(isinstance(lazy, LazyWrapper)) +def test_empty_ZopePathExpr(self): +Test empty path expressions. + +ec = self.ec +self.assertEquals(ec.evaluate('path:'), None) +self.assertEquals(ec.evaluate('path: '), None) +self.assertEquals(ec.evaluate(''), None) +self.assertEquals(ec.evaluate(' \n'), None) + def test_suite(): return unittest.makeSuite(ExpressionTests) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk -- Florent Guillaume, Nuxeo (Paris, France) Director of RD +33 1 40 33 71 59 http://nuxeo.com [EMAIL PROTECTED] ___ 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: [Zope-dev] zeo server conflict resolving
Dieter Maurer wrote: M. Krainer wrote at 2006-6-2 12:27 +0200: Forgot to mention that this was actually the first thing I tried. But it doesen't work, as the INSTANCE_HOME dir does also not show up in sys.path (in find_globals). A ZEO weakness, I fixed in our local copy this way: runzeo.py: # DM: 2004-06-03 # activate Zope's INSTANCE_HOME magic. Have you signed your new contributor agreement yet? ;-) Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ 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: [Zope-dev] zeo server conflict resolving
Chris Withers wrote at 2006-6-5 14:54 +0100: ... Have you signed your new contributor agreement yet? ;-) I did not yet get an invitation... -- Dieter ___ 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: [Zope] How to set selected items in multi-select list from lines property
--On 4. Juni 2006 12:42:38 -1000 John Schinnerer [EMAIL PROTECTED] wrote: So far I am only coming up with what seem to be cumbersome solutions that have unecessary overhead (comparing a list option with every element in lines property via python script to see if it should be set selected, and repeating for every list option)...is there a better way? Since you have to compare each item of the option list against a given list of items you *must* do this comparison...how else would you be able which items should be selected. The only optimization I can imagine is to convert the the list of given items into a dict to perform a lookup in constant time instead of O(length_of_given_list). -aj -- ZOPYX Ltd. Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany Web: www.zopyx.com - Email: [EMAIL PROTECTED] - Phone +49 - 7071 - 793376 E-Publishing, Python, Zope Plone development, Consulting pgp7S8cQbzFm1.pgp Description: 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 )
Re: [Zope] Re: Any known leaks in ExtFile and OpenFlow?
I am not aware of leaks in ExtFile but am certainly interested should you be able to point out some. ;-) Stefan On 4. Jun 2006, at 11:59, Michael Vartanyan wrote: Hi all, One of my Zope (2.8.4 on Python 2.4.2, SLES9) sites constantly hits the memory limit. It makes heavy use of two products - ExtFile (1.5.0) and OpenFlow (1.1.0). ExtFile class (of ExtFile) and workitem class (of OpenFlow) are leading the refcount list with a not-constant but overall increasing numbers of references. Refcounts for both reach numbers that are incomparably higher than the numbers of their instances in ZoDB. I wanted to ask if there are known leaks in these products before going into (painful) hunting and debugging leaks in my own code. Thanks! -- Anything that happens, happens. --Douglas Adams ___ 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] Missing Temporary Folder
I have been running zope 2.9.2 (python 2.4.2, linux - CentOS 4.3) for a month or so and have just noticed that the 'Temporary Folder' option in the ZMI 'Add' list is missing. The Temporary Folder product is installed and seems ok (icon not broken) and I have another temp_folder instance which seems to be working ok (this temp_folder instances was part of an export from an old version of zope - 2.6.1 - and which was then then imported into my current zope installation). I copied/pasted the existing temp_folder to create a new instance and that seemed to work ok as well. Does anyone have any ideas as to why 'Temporary Folder' would not appear in the 'Add' list? Thanks, Jonathan ___ 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] Missing Temporary Folder
--On 5. Juni 2006 14:10:25 -0400 Jonathan [EMAIL PROTECTED] wrote: Does anyone have any ideas as to why 'Temporary Folder' would not appear in the 'Add' list? Temporary folders must be configured as storage in etc/zope.conf and added through the ZMI through Add ZODB Mountpoint. The zope.conf file contains an example configuration. -aj -- ZOPYX Ltd. Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany Web: www.zopyx.com - Email: [EMAIL PROTECTED] - Phone +49 - 7071 - 793376 E-Publishing, Python, Zope Plone development, Consulting pgpmpDM2aArR9.pgp Description: 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 )
Re: [Zope] Missing Temporary Folder
That did the trick! Thanks! - Original Message - From: Andreas Jung [EMAIL PROTECTED] To: Jonathan [EMAIL PROTECTED]; zope@zope.org Sent: Monday, June 05, 2006 2:26 PM Subject: Re: [Zope] Missing Temporary Folder ___ 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] Templates vs DTML
We've been using DTML but we are at a point where we could move to page templates. We are starting a major restruture and rewrite of much of the system and are debating moving to ZPT. Performance is potentially a major issue. We are using Zope 2.9.X, will eventually move to Zope 2.10.X and Five. Python 2.4.X. Has anyone done any benchmark comparison of the two design choices? For the same functionality, which performs better. No flame wars about which is better, just information about performance. ___ 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] Templates vs DTML
Dennis Allison wrote: We've been using DTML but we are at a point where we could move to page templates. We are starting a major restruture and rewrite of much of the system and are debating moving to ZPT. Performance is potentially a major issue. We are using Zope 2.9.X, will eventually move to Zope 2.10.X and Five. Python 2.4.X. Has anyone done any benchmark comparison of the two design choices? For the same functionality, which performs better. No flame wars about which is better, just information about performance. Dennis, Interesting question. Because to reasonably performance test ZPT vs DTML one would have a scenario where DTML script does both logic and presentation (its weakness) and ZPT does presentation and off-loads its logic to Python Scripts (presumably its strength). Note: I say this assuming the DTML typically has lots of embedded logic whereas ZPT does not. Chris M wrote an very interesting blog (see plope.com) that (among other things) compares Meld to ZPT in terms of performance. I recall that he was impressed with ZPT's rendering speed. At any rate, you could always invest the time to convert one of your DTML workhorses into ZPT and do your own compare. That might be best because the style your DTML was written in may make a big difference in your performance results. David ___ 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 )