[Zope-dev] proxydict problems in 2.8b2 with Localizer

2005-05-23 Thread Lennart Regebro
I get TypeError: object does not support item assignment in  lin 46
och class_init.py.

The offending code is d['_implicit__name__'] = 1 and this is because
d is a proxydict. This in turn is caused by Localizer having a class
as a class attribute:
manage_attributesForm = LocalDTMLFile
Apparently, Zope thinks that this class attribute needs a name, but
there isn't one.

This:
manage_attributesForm._needs_name__ = 0
gets rid of the error, but I don't exactly like it.

Can anybody shed some light on this, so I can figure out what would be
The Right Thing to do?

-- 
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
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 )


[Zope-dev] Zope 2.8b2 problems part 2: WingDBG and subtransactions.

2005-05-23 Thread Lennart Regebro
WingDBG does this: tx = get_transaction().sub()
That fails because 'Transaction' object has not attribute 'sub'.
This is obviously an effect of the moving from subtransactions to checkpoints.

Question: Is it Zope2.8 taht is wrong or WingDBG?

-- 
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
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 )


[Zope-dev] Possible 2.8b2 bug part 3:

2005-05-23 Thread Lennart Regebro
DateTime.DateTime.strftime(fmt) used to use strftime, which accepts a
unicode string as fmt. In 2.8 it uses datetime.datetime.strftime which
does not accept unicode.

This both breaks backwards compatibility, and  prevents you from using
non-ascii characters in the format string.

Thoughts, opinions?
-- 
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
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] Possible 2.8b2 bug part 3:

2005-05-23 Thread Andreas Jung



--On Montag, 23. Mai 2005 19:22 Uhr +0200 Lennart Regebro 
[EMAIL PROTECTED] wrote:



DateTime.DateTime.strftime(fmt) used to use strftime, which accepts a
unicode string as fmt. In 2.8 it uses datetime.datetime.strftime which
does not accept unicode.

This both breaks backwards compatibility, and  prevents you from using
non-ascii characters in the format string


hm...I am not sure if the time.strftime() implementation had been 
implemented
with unicode format strings in mind. Accepting Unicode strings (maybe 
without
checking them) appears to me more like  an unintended accident than 
intentional
behavior. I am pretty sure you can build a workaround easily. In my point 
of view
the reason for the change (support for dates outside the usual 1970..2038 
scope)

is more important.


Andreas


pgpxlJdrO5Gcx.pgp
Description: PGP signature
___
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] Possible 2.8b2 bug part 3:

2005-05-23 Thread Lennart Regebro
On 5/23/05, Andreas Jung [EMAIL PROTECTED] wrote:
 I am pretty sure you can build a workaround easily. In my point of view
 the reason for the change (support for dates outside the usual 1970..2038
 scope) is more important.

Well, I don't think we personally use any non-ascii characters, so we
can work around it, but it does break backwards compatibility.

We get an error when we use localize time and date strings, something
I expect is pretty common, i.e., you translate a string
medium_date_format with whatever translation tool you have, and then
pass that as a date format.

The translation tools will typically return unicode, and bam! it stops
working. So, if we can't properly support unicode, I'd actually prefer
that we cast the format string to string, perhaps with a deprecated
warning if we pass unicode?

-- 
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
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] proxydict problems in 2.8b2 with Localizer

2005-05-23 Thread Dieter Maurer
Lennart Regebro wrote at 2005-5-23 13:29 +0200:
I get TypeError: object does not support item assignment in  lin 46
och class_init.py.

The offending code is d['_implicit__name__'] = 1 and this is because
d is a proxydict. This in turn is caused by Localizer having a class
as a class attribute:

At other places, a similar problem could be solved by
setattr(class, attr, value) instead of class.__dict__[attr] = value.

-- 
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-dev] Possible 2.8b2 bug part 3:

2005-05-23 Thread Andreas Jung



--On Montag, 23. Mai 2005 20:22 Uhr +0200 Lennart Regebro 
[EMAIL PROTECTED] wrote:


The translation tools will typically return unicode, and bam! it stops
working. So, if we can't properly support unicode, I'd actually prefer
that we cast the format string to string, perhaps with a deprecated
warning if we pass unicode?



A deprecation warning could do the job. To be honest I would have never 
thought about
such a usecase :-) However we could convert unicode to utf8 and use this as 
argument

for strftime() and converting the result back to unicode.

Andreas



pgpX7OG2BmiST.pgp
Description: PGP signature
___
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] Possible 2.8b2 bug part 3:

2005-05-23 Thread Lennart Regebro
On 5/23/05, Andreas Jung [EMAIL PROTECTED] wrote:
 A deprecation warning could do the job. To be honest I would have never
 thought about
 such a usecase :-) However we could convert unicode to utf8 and use this as
 argument
 for strftime() and converting the result back to unicode.

Yeah, that works. Is there cases when this would not work?

-- 
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
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] proxydict problems in 2.8b2 with Localizer

2005-05-23 Thread Lennart Regebro
On 5/23/05, Dieter Maurer [EMAIL PROTECTED] wrote:
 Lennart Regebro wrote at 2005-5-23 13:29 +0200:
 I get TypeError: object does not support item assignment in  lin 46
 och class_init.py.
 
 The offending code is d['_implicit__name__'] = 1 and this is because
 d is a proxydict. This in turn is caused by Localizer having a class
 as a class attribute:
 
 At other places, a similar problem could be solved by
 setattr(class, attr, value) instead of class.__dict__[attr] = value.

I also succeeded in working around the problem by setting
__name__ and _needs_name__ on the attribute in question, which feels
better than my previous workaround.

-- 
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
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] Possible 2.8b2 bug part 3:

2005-05-23 Thread Andreas Jung



--On Montag, 23. Mai 2005 20:40 Uhr +0200 Lennart Regebro 
[EMAIL PROTECTED] wrote:



On 5/23/05, Andreas Jung [EMAIL PROTECTED] wrote:

A deprecation warning could do the job. To be honest I would have never
thought about
such a usecase :-) However we could convert unicode to utf8 and use this
as argument
for strftime() and converting the result back to unicode.


Yeah, that works. Is there cases when this would not work?


utf8 should cover the whole unicode database, shouldn't it?!

-aj


pgph8RhC8lzC7.pgp
Description: PGP signature
___
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] Still. Zope date datatype and TimeZone formatting problems.

2005-05-23 Thread Tino Wildenhain
Am Sonntag, den 22.05.2005, 13:01 -0500 schrieb Felipe Barousse Boue:
 Zopistas:
 
 I am experiencing the same problem you described by Mr. Hong Yuan in his
 post a few from last March.  I have Zope 2.7.4, python 2.3.4 and
 PostgreSQL 8.0 and psycopg as DB adapter.
 
 All my dates stores in postgresql are WITHOUT timezone and my linux is
 set for the America/Mexico City time zone. All works fine at the OS
 and python level but not within Zope, it behaves as Mr. Hong Yuan
 describes in the post.
 
 I have noticed that Zope, when getting the data coming from postgresql
 (the date) always takes it to be at midnight in GMT time zone. 
 
 While formatting the date for presentation, it doesn't take into account
 the OS TZ settings, it just assumes data (from postgresql) is at
 midnight in GMT and mangles it.

Of course. I wonder why it should? Otoh, did you try to give the
timezone you want when you select the data? 

 If the TZ variable is set on the zope.conf file, it actually adds hours
 to the date (as like moving east), having first during the day having
 the date ok but a wrong time and, later on the day, the date goes
 wrong because of that timezone difference.

I assume this setting is mainly for zope generated datetime objects,
not something you read from a DB.

 If the TZ is not set in the zope.conf file it substracts hours from the
 date data from postgresql, effectively moving the date on day before,
 because it assumed midnight GMT.
 
 Doing further experiments I have noticed that when the data type passed 
 to Zope is date (not datetime or timespamp, only date) then Zope 
 misbehaves with the TZ, assuming it is on GMT and not taking into
 account the overall system (Operating system) time zone settings.

Well, databases are often on a seperate host. How should zope guess in
this case? If it would, I guess someone else would complaint ;)

 I have seen posts discussing this issue as far back as 2001. Has it been
 solved already ?   Is it worth getting into the Zope code and trying to 
 fix it and submit a patch ? Or its already deprecated ? or...?
 
 I believe it is still a huge bug the the Zope/Python date time handling
 routines, I am correct with this appreciation?

Well, zopes DateTime implemenataion has some (serious) limits. But I 
dont think it should really be blamed for the above problems.
Maybe some workarounds can be made in the psycopg driver.

What btw. happens if you use mxdatetime instead of the zope builtin?
Psycopg has this as configuration option.

Regards
Tino


___
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] How can I get context property in DTML ? (example)

2005-05-23 Thread Hugo Ramos
Yellow,

Just place an index_html object inside dir1 with this code:

dtml-var bar

Then call the following URL's:
http://yourserver/dir1/
http://yourserver/dir2/
http://yourserver/dir3/


Regards
hr


On 5/23/05, KLEIN Stphane [EMAIL PROTECTED] wrote:
 Hello,
 
 In DTML I would like to do that :
 
 I've this directory :
 
 dir1
   | dir2
   | dir3
 
 dir1 has property bar=1
 dir2 has property bar=2
 dir3 has property bar=3
 
 I would like a foo_html DTML Document file which display the property
 bar. This file is place in dir1.
 
 Exemple :
 
 When I go to dir1/foo_html = I show 1
 When I go to dir1/dir2/foo_html = I show 2
 When I go to dir1/dir3/foo_html = I show 3
 
 How can I do it ?
 
 Thanks for your help.
 -- Sthane
 
 ___
 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 )
 


-- 
Hugo Ramos - [EMAIL PROTECTED]
___
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] UnicodeDecodeError

2005-05-23 Thread Joern Wallstabe

Hello,

i would like to feed a zpt form with data from a python dictionary via a 
python script


zpt snippet:

textarea name=title:record:ulines rows=3  cols=65
tal:span content=python:context.printDict(here.dict)/
/textarea

python script prinDict:

keys_ = dict.keys()
keys_.sort()
lines=[]

for key in keys_:
   lines.append(u%s:%s\n %(key ,dict[key]))

uni_str = u.join(lines)
return uni_str.encode('utf-8')

I'm always getting a  UnicodeDecodeError.

I' using Zope 2.7.5, CMF 1.5.1, Python 2.3.5
HTML meta tag is set to
meta http-equiv=Content-Type content=text/html; charset=utf-8
CMF default_charset = utf-8


Regards Joern




smime.p7s
Description: S/MIME Cryptographic 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] How can I get context property in DTML ? (example)

2005-05-23 Thread Tino Wildenhain
Am Montag, den 23.05.2005, 10:37 +0200 schrieb KLEIN Stéphane:
 Hello,
 
 In DTML I would like to do that :
 
 I've this directory :
 
 dir1
   | dir2
   | dir3
 
 dir1 has property bar=1
 dir2 has property bar=2
 dir3 has property bar=3
 
 I would like a foo_html DTML Document file which display the property 
 bar. This file is place in dir1.
 
 Exemple :
 
 When I go to dir1/foo_html = I show 1
 When I go to dir1/dir2/foo_html = I show 2
 When I go to dir1/dir3/foo_html = I show 3
 
 How can I do it ?

If foo_html is a DTML Method (Method, not Document!)
its just: dtml-var bar

(And god knows where the bar come from ;)
dtml-var expr=getProperty('bar')
could work too and would be more explicit.

-- 
Tino Wildenhain [EMAIL PROTECTED]

___
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 )


Fwd: [Zope] How can I get context property in DTML ? (example)

2005-05-23 Thread Hugo Ramos
Sorry... Forgot to say that the index_html obect should be a DTML Method!!!

Regards
hr


-- Forwarded message --
From: Hugo Ramos [EMAIL PROTECTED]
Date: May 23, 2005 9:44 AM
Subject: Re: [Zope] How can I get context property in DTML ? (example)
To: zope@zope.org


Yellow,

Just place an index_html object inside dir1 with this code:

dtml-var bar

Then call the following URL's:
http://yourserver/dir1/
http://yourserver/dir2/
http://yourserver/dir3/


Regards
hr


On 5/23/05, KLEIN Stphane [EMAIL PROTECTED] wrote:
 Hello,

 In DTML I would like to do that :

 I've this directory :

 dir1
   | dir2
   | dir3

 dir1 has property bar=1
 dir2 has property bar=2
 dir3 has property bar=3

 I would like a foo_html DTML Document file which display the property
 bar. This file is place in dir1.

 Exemple :

 When I go to dir1/foo_html = I show 1
 When I go to dir1/dir2/foo_html = I show 2
 When I go to dir1/dir3/foo_html = I show 3

 How can I do it ?

 Thanks for your help.
 -- Sthane

 ___
 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 )



--
Hugo Ramos - [EMAIL PROTECTED]


-- 
Hugo Ramos - [EMAIL PROTECTED]
___
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] UnicodeDecodeError

2005-05-23 Thread Andreas Jung



--On Montag, 23. Mai 2005 10:35 Uhr +0200 Joern Wallstabe 
[EMAIL PROTECTED] wrote:



I'm always getting a  UnicodeDecodeError.


To every error message belongs a traceback where you can see
*where* the error occurs...another try?

-aj


pgpo0qQ4ukTs7.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] UnicodeDecodeError

2005-05-23 Thread Joern Wallstabe

Andreas Jung wrote:



--On Montag, 23. Mai 2005 10:35 Uhr +0200 Joern Wallstabe 
[EMAIL PROTECTED] wrote:



I'm always getting a  UnicodeDecodeError.



To every error message belongs a traceback where you can see
*where* the error occurs...another try?

-aj



the script decodes unicode 'Spécification' - utf8 'Sp\xc3\xa9cification'

the error is raised during zpt processing.
by the way python default default encoding is set to ascii.


Traceback (innermost last):
Module ZPublisher.Publish, line 101, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 39, in call_object
Module Products.CMFFormController.FSControllerPageTemplate, line 98, in 
__call__
Module Products.CMFFormController.BaseControllerPageTemplate, line 42, 
in _call

Module Shared.DC.Scripts.Bindings, line 306, in __call__
Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
Module Products.CMFCore.FSPageTemplate, line 188, in _exec
Module Products.CMFCore.FSPageTemplate, line 127, in pt_render
Module Products.PageTemplates.PageTemplate, line 97, in pt_render

FSControllerPageTemplate at /cmf/edit_form used for /cmf/Members/wal/myid
Module StringIO, line 203, in getvalue
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 95: 
ordinal not in range(128)



regards joern


smime.p7s
Description: S/MIME Cryptographic 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] UnicodeDecodeError

2005-05-23 Thread Andreas Jung



--On Montag, 23. Mai 2005 11:18 Uhr +0200 Joern Wallstabe 
[EMAIL PROTECTED] wrote:





the script decodes unicode 'Spécification' - utf8 'Sp\xc3\xa9cification'

the error is raised during zpt processing.
by the way python default default encoding is set to ascii.



hm...I can't reproduce this behaviour :-/

ANdreas


pgpNQ9wMM1V1g.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 )


[Zope] Re: How can I get context property in DTML ? (example)

2005-05-23 Thread KLEIN Stéphane

Tino Wildenhain a écrit :

Am Montag, den 23.05.2005, 10:37 +0200 schrieb KLEIN Stéphane:


Hello,

In DTML I would like to do that :

I've this directory :

dir1
 | dir2
 | dir3

dir1 has property bar=1
dir2 has property bar=2
dir3 has property bar=3

I would like a foo_html DTML Document file which display the property 
bar. This file is place in dir1.


Exemple :

When I go to dir1/foo_html = I show 1
When I go to dir1/dir2/foo_html = I show 2
When I go to dir1/dir3/foo_html = I show 3

How can I do it ?



If foo_html is a DTML Method (Method, not Document!)
its just: dtml-var bar

(And god knows where the bar come from ;)
dtml-var expr=getProperty('bar')
could work too and would be more explicit.



Thanks you.

The tips was DTML Method.

-- Stéphane

___
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] UnicodeDecodeError

2005-05-23 Thread Tino Wildenhain
Am Montag, den 23.05.2005, 10:35 +0200 schrieb Joern Wallstabe:
 Hello,
 
 i would like to feed a zpt form with data from a python dictionary via a 
 python script
 
 zpt snippet:
 
 textarea name=title:record:ulines rows=3  cols=65
 tal:span content=python:context.printDict(here.dict)/

This is wrong anyway. Use tal:content in the textarea instead.

 /textarea
 
 python script prinDict:
 
 keys_ = dict.keys()
 keys_.sort()
 lines=[]
 
 for key in keys_:
 lines.append(u%s:%s\n %(key ,dict[key]))
 
 uni_str = u.join(lines)
 return uni_str.encode('utf-8')
 
 I'm always getting a  UnicodeDecodeError.
 
 I' using Zope 2.7.5, CMF 1.5.1, Python 2.3.5
 HTML meta tag is set to
   meta http-equiv=Content-Type content=text/html; charset=utf-8
 CMF default_charset = utf-8
 

meta charset does not count btw. CMF default should, but it really 
depends on the real content-type header you send. Make sure its
the encoding you want there (setHeader() )

And its important to watch the encoding of the strings you work
with. Where does the dictionary come from?



___
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] UnicodeDecodeError

2005-05-23 Thread Joern Wallstabe

Thank you all for replying - now it works I got utf-8 string in my form.

Seem Zopes ZPT system is trying to do the encoding, depending on on 
setHeader() method.

So if this header is set you can simply return unicode strings.


Strange setting cmf default charset to utf-8 doesn't work :-(


Am Montag, den 23.05.2005, 10:35 +0200 schrieb Joern Wallstabe:


Hello,

i would like to feed a zpt form with data from a python dictionary via a 
python script


zpt snippet:

textarea name=title:record:ulines rows=3  cols=65
tal:span content=python:context.printDict(here.dict)/




This is wrong anyway. Use tal:content in the textarea instead.


o.k. replace that with
tal:content content=python:context.printDict(here.dict)/




/textarea

python script prinDict:

keys_ = dict.keys()
keys_.sort()
lines=[]

for key in keys_:
   lines.append(u%s:%s\n %(key ,dict[key]))

uni_str = u.join(lines)
return uni_str.encode('utf-8')


function now returns unicode string without utf-8 encoding


I'm always getting a  UnicodeDecodeError.

I' using Zope 2.7.5, CMF 1.5.1, Python 2.3.5
HTML meta tag is set to
meta http-equiv=Content-Type content=text/html; charset=utf-8
CMF default_charset = utf-8




meta charset does not count btw. CMF default should, but it really 
depends on the real content-type header you send. Make sure its

the encoding you want there (setHeader() )


That was the important hint: added to cmf main_header_template:

tal:define 
dummy python: request.RESPONSE.setHeader('content-type', 'text/html;; 
charset=utf-8');




And its important to watch the encoding of the strings you work
with. Where does the dictionary come from?


python dictionary was result form parsing xml data into that dictionary 
(all unicode)


Thanx again :-)



smime.p7s
Description: S/MIME Cryptographic 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: Keyword index search

2005-05-23 Thread Garito

Tres Seaver escribió:


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Garito wrote:
 


Dieter Maurer escribió:

   


Garito wrote at 2005-5-20 12:41 +0200:


 


...
I have a ZCatalog object with a keywordindex called keywords

I would like to search some objects with keywords ['k1', 'k2', k3',
'k4'] for that I use:

return context.catalog({'keywords': {'query': ['k1', 'k2', k3',
'k4'], 'operator': 'and'}})

but these query returns objects with keyword = ['k2', 'k3'] (for me
incorrect, I would like to find objects with *all* keywords

How can I make these kind of querys?
 
   


A long standing bug in KeywordIndex...


Maybe, you give my Managable KeywordIndex a try
(part of ManagableIndex).

I cannot promiss you that
ManagableIndex is free of bugs but I definitely can
promiss you that a bug resulting in wrong search results
is fixed much much more quickly than in the Zope core :-)


http://www.dieter.handshake.de/pyprojects/zope




 


Hi Dieter!
I can't understand the lack of concern you talk about unresolved bugs in
Zope
It seems Zope is not a serious tool. Imagine you want to buy a car but
the seller says: in these model there are a bug on the brake system but
I you put these extra no problem

How can I convince my customers to use Zope with these kind of
searchable information?
   



The bug you encountered is sufficiently an edge case that it has not
gotten any attention from the people who could fix it.  Agitating for it
on the list is likely to be less productive than contributing:

 - Write one or more unit tests which demonstrates the failure (e.g.,
   they fail  with the current implementation).

 - Implement the fix, such that the new tests pass without causing any
   others to fail.

 - Submit the patch, including both the test and the patched
   implementation, as an attachment to the collector issue Andreas
   pointed to:  http://www.zope.org/Collectors/Zope/889

Such bug reports get quicker attention, because:

 - they demand less effort from the person with commit access to
   understand the problem (even without the fix, writing the test case
   would be valuable here).

 - they show that the bug matters enough to somebody to have invested
   the effort.

I have checked in a number of patches from Dieter in this way, which
means that Dieter is contributing to the core Zope code, even without
checkin access (which Dieter doesn't want to obtain).

Tres.
- --
===
Tres Seaver   [EMAIL PROTECTED]
Palladion Software   Excellence by Designhttp://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCkMrZ+gerLs4ltQ4RAl14AJ4xmHMk6PKCJrTv3hJQ/xeCOqNYsgCglSiP
KSHy7IctCFqHBoOmxwSTMws=
=HCJO
-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 )
 

All you say (Andreas, Dieter, Tres and Lennart) is very reasonable, in 
my opinion with all your choices, I prefer try to solve the bug


I don't know if my python/zope skill is enought but if I don't try it I 
never know my real skill


Thanks!

--
Mis Cosas
http://blogs.sistes.net/Garito/


___
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] Help support the open-source day

2005-05-23 Thread chalu

Help support a day for the open-source movement.

http://opensourceday.contagiousmedia.org/

This is a part of Contagious Media showdown project. There is an 
open-source day entry
where you can vote one of days for the open-source. The Contagious Media 
showdown is mentioned in the New York Times.


thanks in advance
Help support a day for the open-source movement.

http://opensourceday.contagiousmedia.org/

This is a part of Contagious Media showdown project. There is an 
open-source day entry
where you can vote one of days for the open-source. The Contagious Media 
showdown is mentioned in the New York Times.

thanks in advance
___
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] UnicodeDecodeError

2005-05-23 Thread Dieter Maurer
Joern Wallstabe wrote at 2005-5-23 11:18 +0200:
 ...
the error is raised during zpt processing.
by the way python default default encoding is set to ascii.
 
FSControllerPageTemplate at /cmf/edit_form used for /cmf/Members/wal/myid
Module StringIO, line 203, in getvalue
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 95: 
ordinal not in range(128)

Your page template mixes unicode and non-unicode (which cannot be
decoded with the default encoding).

-- 
Dieter
___
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] Equivalent of context ZPT variable in DTML ?

2005-05-23 Thread J Cameron Cooper

KLEIN Stéphane wrote:


What is the equivalent in DTML of ZPT context variable ?


There is no precise equivalent. The current context in DTML is folded 
into the DTML namespace, along with the request and call parameters and 
anything else that might be put in the namespace.


--jcc

--
Building Websites with Plone
http://plonebook.packtpub.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] Re: HTML post processing in Zope

2005-05-23 Thread Chris Withers

Cyrille Bonnet wrote:

Hi all,

I got the filter to work. I just added 3 lines of code in 
ZPublisher.HTTPResponse.HTTPResponse (thanks for your suggestion, 
Dieter):


doctype_str_search = re.compile(r'!DOCTYPE.*')
body = doctype_str_search.sub('!DOCTYPE HTML PUBLIC 
-//W3C//DTD HTML 4.01 Transitional//EN 
http://www.w3.org/TR/html4/loose.dtd;', body)


body = body.replace('/', '')


You can't be serious, right?

The above do NOT suddenly make it HTML 4.01, I'm 90% sure ;-)

Really, you should be customising the templates to serve HTML in the 
format you need rather than persuing this insanity...


Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk

___
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: HTML post processing in Zope

2005-05-23 Thread Cyrille Bonnet

Hi Chris,

Well, you'd better believe it :-)

It works for me so far. But if you have specific examples that I can use 
to improve the filter, they would be very welcome.


Two additional things that I had to do to be HTML 4.01 compliant:

* replace html ... with html (remove the namespace information)
* remove the login portlet: Plone uses form parameters __ac_name and 
__ac_password, which the W3C validator rejects as invalid.


I have been customising the templates in the past and it takes a lot of 
work, on many templates, all over the place. In addition, I'd like to 
keep the content stored in the ZODB as XHTML. And, last but not least, I 
 can upgrade Plone without having to rework all my templates now.


But if you have a better idea, your suggestions are most weclome.

Back to the insanity ;-)

Cheers.

Cyrille

Chris Withers wrote:

Cyrille Bonnet wrote:


Hi all,

I got the filter to work. I just added 3 lines of code in 
ZPublisher.HTTPResponse.HTTPResponse (thanks for your suggestion, 
Dieter):


doctype_str_search = re.compile(r'!DOCTYPE.*')
body = doctype_str_search.sub('!DOCTYPE HTML PUBLIC 
-//W3C//DTD HTML 4.01 Transitional//EN 
http://www.w3.org/TR/html4/loose.dtd;', body)


body = body.replace('/', '')



You can't be serious, right?

The above do NOT suddenly make it HTML 4.01, I'm 90% sure ;-)

Really, you should be customising the templates to serve HTML in the 
format you need rather than persuing this insanity...


Chris



___
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] Hiding HTML URL

2005-05-23 Thread David H

Chris,
I didn't address any of the points you made, but I've decided to address 
two:
(1) When I asked what was inherently defective about a stable URL you 
answered:


a) It's grim to debug
Chris, do you really depend on their users to report URLS to support 
when things go wrong?  I use exceptions, logs and auto-emailing of 
exceptions as a work around - what was I thinking! :-)  


Then you added
b) (stable url will ...) confuse your users even more when it goes 
wrong. but the thingy in the box is still the same, why is it not working
Chris, this may come as a shock to you, but my users say something 
incomprehensible like Purchase Order Edit  is not working or COA 
Maintenance needs A, B and C.
Somehow I  know what they are talking about - and so do they. 

(2) Then, I said If there are superior patterns (for Business Apps) Im 
the first that wants to see them and this is  a welcome discussion


And you asserted ... there are *many* but that are beyond the scope of 
this list


Simple disagreement! I feel its a neglected subject and should be on 
this list.  OK maybe on Sundays?


All best,
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 )


Re: [Zope] Can ZPT form call a url?

2005-05-23 Thread Andreas Jung



--On Montag, 23. Mai 2005 22:36 Uhr -0400 James O'Keefe 
[EMAIL PROTECTED] wrote:



On our website we have a form where by a person can subscribe to our
announcements list.  It is the standard mailman form.

We would like to expand on that form such that a user can enter their
email address and zip code which we would log to our database and then
call the url to subscribe the person in the mailman list.



You definitely want to do this on the server side when submitting the form.
Since you can call scripts a from action you can call any known method
in Python to trigger an HTTP request (- Python's urllib module).

-aj


pgpdjWTbS4ZVV.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 )