[Zope-Checkins] SVN: Zope/branches/ajung-zpt-encoding-fixes/ removed, no longer needed
Log message for revision 71736: removed, no longer needed Changed: D Zope/branches/ajung-zpt-encoding-fixes/ -=- ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/Expressions.py some lame solution but that actually works pretty well
Log message for revision 71744: some lame solution but that actually works pretty well Changed: U Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/Expressions.py -=- Modified: Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/Expressions.py === --- Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/Expressions.py 2007-01-06 16:39:19 UTC (rev 71743) +++ Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/Expressions.py 2007-01-06 16:49:20 UTC (rev 71744) @@ -17,6 +17,9 @@ $Id$ + +import sys + from zope.interface import implements from zope.tales.tales import Context, Iterator from zope.tales.expressions import PathExpr, StringExpr, NotExpr @@ -173,6 +176,50 @@ domain, msgid, mapping=mapping, context=context, default=default) + +def evaluateText(self, expr): + customized version in order to get rid of unicode +errors for all and ever + + +text = self.evaluate(expr) +#print expr, repr(text), text.__class__ + +if text is self.getDefault() or text is None: +return text + +if isinstance(text, unicode): +# we love unicode, nothing to do +return text + +elif isinstance(text, str): +# waahhh...a standard string +# trying to be somewhat smart...this must be +# replaced with some kind of configurable +# UnicodeEncodingConflictResolver (what a name) + +try: +return unicode(text) + +except UnicodeDecodeError: +# check for management_page_charset property, default to Python's +# default encoding + +encoding = getattr(self.contexts['context'], 'management_page_charset', sys.getdefaultencoding()) + +try: +return unicode(text, encoding) +except UnicodeDecodeError: +# errors='replace' sucks...it's fine for now +return unicode(text, encoding, 'replace') + +else: + +# This is a weird culprit ...calling unicode() on non-string +# objects +return unicode(text) + + class ZopeEngine(zope.app.pagetemplate.engine.ZopeEngine): _create_context = ZopeContext ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/interfaces.py added
Log message for revision 71748: added Changed: A Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/interfaces.py -=- Added: Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/interfaces.py === --- Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/interfaces.py 2007-01-06 17:54:20 UTC (rev 71747) +++ Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/interfaces.py 2007-01-06 18:22:34 UTC (rev 71748) @@ -0,0 +1,12 @@ + + +from zope.interface import Interface + +class IUnicodeEncodingConflictResolver(Interface): + +class resolve(context, text): + Returns 'text' as unicode string. +'context' is the current context object + + + ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/ added
Log message for revision 71749: added Changed: A Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/configure.zcml U Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/interfaces.py A Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/unicodeconflictresolver.py -=- Added: Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/configure.zcml === --- Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/configure.zcml 2007-01-06 18:22:34 UTC (rev 71748) +++ Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/configure.zcml 2007-01-06 18:57:30 UTC (rev 71749) @@ -0,0 +1,11 @@ +configure xmlns=http://namespaces.zope.org/zope; + xmlns:browser=http://namespaces.zope.org/browser; + xmlns:five=http://namespaces.zope.org/five; + + + utility + provides=zope.component.interfaces.IFactory + component=Products.PageTemplates.unicodeconflictresolver.UnicodeEncodingResolverFactory + / + +/configure Modified: Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/interfaces.py === --- Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/interfaces.py 2007-01-06 18:22:34 UTC (rev 71748) +++ Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/interfaces.py 2007-01-06 18:57:30 UTC (rev 71749) @@ -4,7 +4,7 @@ class IUnicodeEncodingConflictResolver(Interface): -class resolve(context, text): +def resolve(context, text): Returns 'text' as unicode string. 'context' is the current context object Added: Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/unicodeconflictresolver.py === --- Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/unicodeconflictresolver.py 2007-01-06 18:22:34 UTC (rev 71748) +++ Zope/branches/ajung-death-to-unicode-errors/lib/python/Products/PageTemplates/unicodeconflictresolver.py 2007-01-06 18:57:30 UTC (rev 71749) @@ -0,0 +1,37 @@ +### +# TextIndexNG V 3 +# The next generation TextIndex for Zope +# +# This software is governed by a license. See +# LICENSE.txt for the terms of this license. +### + + + +from zope.component.interfaces import IFactory +from zope.interface import implements, implementedBy + +from Products.PageTemplates.interfaces import IUnicodeEncodingConflictResolver + +class UnicodeEncodingResolver: + +implements(IUnicodeEncodingConflictResolver) + +def __init__(self, context, text): +self.context = context +self.text = text + +def resolve(self, context, text): +return unicode(self.text, errors='replace') + +class UnicodeEncodingResolverFactory: + +implements(IFactory) + +def __call__(self, context, text): +return UnicodeEncodingResolver(context, text) + +def getInterfaces(self): +return implementedBy(UnicodeEncodingResolverFactory) + +UnicodeEncodingResolverFactory = UnicodeEncodingResolverFactory() ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-dev] Zope Tests: 7 OK
Summary of messages to the zope-tests list. Period Fri Jan 5 12:00:00 2007 UTC to Sat Jan 6 12:00:00 2007 UTC. There were 7 messages: 7 from Zope Unit Tests. Tests passed OK --- Subject: OK : Zope-2.6 Python-2.1.3 : Linux From: Zope Unit Tests Date: Fri Jan 5 21:09:27 EST 2007 URL: http://mail.zope.org/pipermail/zope-tests/2007-January/006978.html Subject: OK : Zope-2.6 Python-2.3.6 : Linux From: Zope Unit Tests Date: Fri Jan 5 21:11:00 EST 2007 URL: http://mail.zope.org/pipermail/zope-tests/2007-January/006979.html Subject: OK : Zope-2.7 Python-2.3.6 : Linux From: Zope Unit Tests Date: Fri Jan 5 21:12:30 EST 2007 URL: http://mail.zope.org/pipermail/zope-tests/2007-January/006980.html Subject: OK : Zope-2.8 Python-2.3.6 : Linux From: Zope Unit Tests Date: Fri Jan 5 21:14:01 EST 2007 URL: http://mail.zope.org/pipermail/zope-tests/2007-January/006981.html Subject: OK : Zope-2.9 Python-2.4.4 : Linux From: Zope Unit Tests Date: Fri Jan 5 21:15:32 EST 2007 URL: http://mail.zope.org/pipermail/zope-tests/2007-January/006982.html Subject: OK : Zope-2.10 Python-2.4.4 : Linux From: Zope Unit Tests Date: Fri Jan 5 21:17:02 EST 2007 URL: http://mail.zope.org/pipermail/zope-tests/2007-January/006983.html Subject: OK : Zope-trunk Python-2.4.4 : Linux From: Zope Unit Tests Date: Fri Jan 5 21:18:32 EST 2007 URL: http://mail.zope.org/pipermail/zope-tests/2007-January/006984.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: [Zope] all_meta_types confusion
For the same type of object, and when logged in as an Editor, the call to user.has_permission() (around line 254) in filtered_meta_types() in ObjectManager.py, returns false when all_meta_types is defined, and returns true when it isn't. I don't know why the user would not have permission to add this type of object when all_meta_types is defined versus when it isn't. This is why I'm confused. I don't know the answer but you might want to use pdb to see what happens in the code that confuses you. If you don't know how to use pdb see: http://plone.org/documentation/how-to/using-pdb HTH -- 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] problem with createing a product object using dtml
I created a product using python scripting and worked fine when I create it from the pulldown add menu. But when I try to use dtml-let number=sequence-index dtml-with manage_addProduct['ShpType'] dtml-call REQUEST.set('id',readShpPoint(shpPath,number)[0]) dtml-call REQUEST.set('x',readShpPoint(shpPath,number)[1]) dtml-call REQUEST.set('y',readShpPoint(shpPath,number)[2]) dtml-call manage_addShpTypePoint /dtml-with /dtml-let it didn't create an product object. what am I missing here?? ShpType - the product name readShpPoint - external method manage_adShpTypePoint - constructor method in the product. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.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] problem with createing a product object using dtml
--On 6. Januar 2007 05:50:10 -0800 Allen Huang [EMAIL PROTECTED] wrote: I created a product using python scripting and worked fine when I create it from the pulldown add menu. But when I try to use dtml-let number=sequence-index dtml-with manage_addProduct['ShpType'] dtml-call REQUEST.set('id',readShpPoint(shpPath,number)[0]) dtml-call REQUEST.set('x',readShpPoint(shpPath,number)[1]) dtml-call REQUEST.set('y',readShpPoint(shpPath,number)[2]) dtml-call manage_addShpTypePoint /dtml-with /dtml-let it didn't create an product object. Sorry but your code is nonsense. Use a PythonScript instead. There is no need to use DTML at this point. -aj pgp0Mq7I5XQcC.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] problem with createing a product object using dtml
Thanks for Replying Andreas.. but I found the problem... it was at the dtml-call manage_addShpTypePoint I forget that I was calling a python method that required 4 argument in the parenthesis. If I were to do it using python scripting (do you mean internal or external methods or python scripting) what would it look like? - Original Message From: Andreas Jung [EMAIL PROTECTED] To: Allen Huang [EMAIL PROTECTED]; Zope zope@zope.org Sent: Saturday, January 6, 2007 9:52:36 PM Subject: Re: [Zope] problem with createing a product object using dtml --On 6. Januar 2007 05:50:10 -0800 Allen Huang [EMAIL PROTECTED] wrote: I created a product using python scripting and worked fine when I create it from the pulldown add menu. But when I try to use dtml-let number=sequence-index dtml-with manage_addProduct['ShpType'] dtml-call REQUEST.set('id',readShpPoint(shpPath,number)[0]) dtml-call REQUEST.set('x',readShpPoint(shpPath,number)[1]) dtml-call REQUEST.set('y',readShpPoint(shpPath,number)[2]) dtml-call manage_addShpTypePoint /dtml-with /dtml-let it didn't create an product object. Sorry but your code is nonsense. Use a PythonScript instead. There is no need to use DTML at this point. -aj __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.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] saving/creating an object to an exsisting folderish object
This is a problem a got a lot and I never able to seem to solve it. I want save or create a object to a specific folder or other folderish object, I ask the user for the id of that folder or folderish object I store the id name in a variable 'name' the problem is I know the type of the folder or folderish object but 'name' is a str object and I can't use command like name.manage_addFile(). The server just tells me that name is a str which contains no function manage_addFile(). I always end up doing a dtml-in objectValues(['Folder']) dtml-if getId() == name do something /dtml-if /dtml-in this is very ineffecient when you have a lot of data. Is there a ways I could do something like getFolder( name ).doSomething(). Is there anything like that in dtml? __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.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] saving/creating an object to an exsisting folderish object
dear Andreas make my question short. I have a string object 'name' and it is a name of an exsiting folder is there a method that uses 'name'(a str object) as an argument to call upon this folder? - Original Message From: Andreas Jung [EMAIL PROTECTED] To: Allen Huang [EMAIL PROTECTED]; Zope zope@zope.org Sent: Saturday, January 6, 2007 10:20:16 PM Subject: Re: [Zope] saving/creating an object to an exsisting folderish object --On 6. Januar 2007 06:17:40 -0800 Allen Huang [EMAIL PROTECTED] wrote: This is a problem a got a lot and I never able to seem to solve it. I want save or create a object to a specific folder or other folderish object, I ask the user for the id of that folder or folderish object I store the id name in a variable 'name' the problem is I know the type of the folder or folderish object but 'name' is a str object and I can't use command like name.manage_addFile(). The server just tells me that name is a str which contains no function manage_addFile(). I always end up doing a dtml-in objectValues(['Folder']) dtml-if getId() == name do something /dtml-if /dtml-in Please take the advice and learn Python. Such logic should be implemented in Python and *not* in DTML. DTML/ZPT are for presentation *only*, not for implementing business logic. -aj __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.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] saving/creating an object to an exsisting folderish object
--On 6. Januar 2007 21:28:06 -0800 Allen Huang [EMAIL PROTECTED] wrote: is there a method that uses 'name'(a str object) as an argument to call upon this folder? to call upon this folder? No idea what you mean. -aj pgpJwNBgoYMPw.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 )