Re: [Zope-CMF] Decode for Record objects

2008-01-10 Thread Charlie Clark


Am 10.01.2008 um 11:59 schrieb Andreas Jung:

Consider working with SQLAlchemy. SA works nicely with unicode e.g.  
when you're using a Postgres DB with Unicode as internal DB encoding.



Thanks for the tip but that's not really a solution to the problem. I  
normally use mxODBC and, although we can set all kinds of parameters  
on the client side, we're still dependent on the Zope results object  
which sometimes means manually coercing the conversion in an  
ExternalMethod.


Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] Decode for Record objects

2008-01-10 Thread Charlie Clark


Am 10.01.2008 um 11:54 schrieb Jens Vagelpohl:

It may be helpful if you describe what you were trying to do and  
what failure you're seeing so everyone has a little context for  
this request, which AFAIK has never come up anywhere.



:oops: Sorry, I thought this was a known issue.

If I have non-ASCII data in an RDBMS that I wish to use in a CMF site  
or even straight ZPT's you get a UnicodeError when accessing the non- 
ASCII Values which you get around using the decode utility.


ie.

 <- or from **options
   


This will raise
Error Type: UnicodeDecodeError
Error Value: 'ascii' codec can't decode byte 0xc3 in position 1:  
ordinal not in range(128)


For something coming from a UTF-8 database to a UTF-8 site with  
zpublisher-default-encoding set to UTF-8


NB. content="result/name" doesn't raise the error

Actually this might not be anything to do with the CMF but simply the  
ZPT bug
that I have discussed a bit with Andreas but lost the bug id. Which  
I've now found again: https://bugs.launchpad.net/zope2/+bug/143932


However, I think the error is raised because utils.decode simply  
returns any values untouched it doesn't know what to do with which is  
why I think it might be worth extending. OTOH it might something that  
is better fixed in the Shared.RDBMS.Results module


Clearer or muddier now?

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] Decode for Record objects

2008-01-10 Thread Andreas Jung



--On 10. Januar 2008 11:41:49 +0100 Charlie Clark <[EMAIL PROTECTED]> 
wrote:



A happy 2008 to everyone!

Currently it's not really possible to use ZSQL with CMF because
CMFDefault.utils.decode does not know how to handle
Shared.DC.ZRDB.Results.Results or Record.Record instances

I think that the decode could be extended to be able to work with Results
and Records returning lists of dictionaries and dictionaries
respectively. Alternatively it might be best to enforce unicode in
Shared.DC.ZRDC.Results



Consider working with SQLAlchemy. SA works nicely with unicode e.g. when 
you're using a Postgres DB with Unicode as internal DB encoding.


-aj

pgpmUe2OT89qO.pgp
Description: PGP signature
___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] Decode for Record objects

2008-01-10 Thread Jens Vagelpohl


On Jan 10, 2008, at 11:41 , Charlie Clark wrote:


A happy 2008 to everyone!

Currently it's not really possible to use ZSQL with CMF because  
CMFDefault.utils.decode does not know how to handle

Shared.DC.ZRDB.Results.Results or Record.Record instances

I think that the decode could be extended to be able to work with  
Results and Records returning lists of dictionaries and dictionaries  
respectively. Alternatively it might be best to enforce unicode in  
Shared.DC.ZRDC.Results


Any ideas?


It may be helpful if you describe what you were trying to do and what  
failure you're seeing so everyone has a little context for this  
request, which AFAIK has never come up anywhere.


jens



___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests