[Zope] Fix for garbled saves of UTF8 TTW PageTemplates and emacs over ftp

2011-02-25 Thread Andreas Elvers
Hi,

if you edit TTW PageTemplates through emacs over ftp, you may encouter 
your UTF8 String garbled after a save.

try adding:

meta tal:replace=nothing http-equiv=content-type 
content=text/html;charset=utf-8 /

at the top of the page. Helped me.

- Andreas

___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Iteration over columns in ZSQLMethod result not working in Zope 2.12.13

2010-12-08 Thread Andreas Elvers
Am 7.12.10 15:19 , schrieb Tres Seaver:


 result = context.someZSQLMethod()
 for row in result:
  for col in row: #this will fail
 pass

 Does the safe list builtin work for you in 2.12?

for row in result:
for col in list(row):
pass



Yes. This works in 2.12.

___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Iteration over columns in ZSQLMethod result not working in Zope 2.12.13

2010-12-07 Thread Andreas Elvers
To answer part of my own question:

ZSQLMethod  column iteration went away with 2.12. Up until Zope 2.11.7 
still had this feature available with no deprecation messages logged 
when using this feature.

Should I file a bug for missing deprecation messages in 2.11 or for 
missing functionality in 2.12 ?

- Andreas

___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Iteration over columns in ZSQLMethod result not working in Zope 2.12.13

2010-12-07 Thread Andreas Elvers
Hi Tres,

[...]
 Given some ZSQLMethod,  and either ZMySQLDA (3.1.1) or ZPsycopgDA
 (2.0.14 or 2.2.2)
 and the following python script:

 result = context.someZSQLMethod()
 for row in result:
  for col in row: #this will fail
 pass

 I get an AttributeError: __iter__

[...]

 I don't think the Record class fills the 'tp_iter' slot.  [...]

I don't know about this tp_iter slot, but adding the following
DocTest to the Record tests.py will pass:

def test_RecordIteration():
 

 Creating a record

  r = P(('zx', 81 , 1.23))

 We can iterate over a record:

  [i for i in r]
 ['zx', 81, 1.23]

 

- Andreas

___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Iteration over columns in ZSQLMethod result not working in Zope 2.12.13

2010-12-01 Thread Andreas Elvers
Hi,

I stumbled over the following error using Zope 2.12.13. Bug ?

Given some ZSQLMethod,  and either ZMySQLDA (3.1.1) or ZPsycopgDA 
(2.0.14 or 2.2.2)
and the following python script:

result = context.someZSQLMethod()
for row in result:
for col in row: #this will fail
   pass

I get an AttributeError: __iter__

Traceback (innermost last):
   Module ZPublisher.Publish, line 127, in publish
   Module ZPublisher.mapply, line 77, in mapply
   Module ZPublisher.Publish, line 47, in call_object
   Module Shared.DC.Scripts.Bindings, line 324, in __call__
   Module Shared.DC.Scripts.Bindings, line 361, in _bindAndExec
   Module Products.PythonScripts.PythonScript, line 344, in _exec
   Module script, line 3, in someZSQLMethod
- PythonScript at /testfolder/somePythonScript
- Line 3
   Module AccessControl.ZopeGuards, line 181, in next
   Module AccessControl.ZopeGuards, line 211, in guard
   Module AccessControl.SecurityManagement, line 21, in getSecurityManager
AttributeError: __iter__

- Andreas



___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Iteration over columns in ZSQLMethod result not working in Zope 2.12.13

2010-12-01 Thread Andreas Elvers
Am 1.12.10 14:52 , schrieb Tres Seaver:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 On 12/01/2010 08:27 AM, Andreas Elvers wrote:
 Hi,

 I stumbled over the following error using Zope 2.12.13. Bug ?

 Given some ZSQLMethod,  and either ZMySQLDA (3.1.1) or ZPsycopgDA
 (2.0.14 or 2.2.2)
 and the following python script:

 result = context.someZSQLMethod()
 for row in result:
  for col in row: #this will fail
 pass

 I get an AttributeError: __iter__

 Traceback (innermost last):
 Module ZPublisher.Publish, line 127, in publish
 Module ZPublisher.mapply, line 77, in mapply
 Module ZPublisher.Publish, line 47, in call_object
 Module Shared.DC.Scripts.Bindings, line 324, in __call__
 Module Shared.DC.Scripts.Bindings, line 361, in _bindAndExec
 Module Products.PythonScripts.PythonScript, line 344, in _exec
 Module script, line 3, in someZSQLMethod
  -PythonScript at /testfolder/somePythonScript
  - Line 3
 Module AccessControl.ZopeGuards, line 181, in next
 Module AccessControl.ZopeGuards, line 211, in guard
 Module AccessControl.SecurityManagement, line 21, in getSecurityManager
 AttributeError: __iter__

 I don't think the Record class fills the 'tp_iter' slot.  Does the
 following workaround help?

result = context.someZSQLMethod()
for row in result:
for i in range(len(row)):
   col = row[i[



Yep. That one is working. Although that makes the planned upgrade from 
Zope 2.10 to 2.12 a real pain because I use a lot of the following :

result = context.someZSQLMethod()
names = result.names()
dataForTemplate = dict(zip(names,result[0]))
dataForTemplate['addingSomeMoreData'] = 'datadata'
return context.comeTemplate(data=dataForTemplate)

When did the iteration feature go away ? Must have missed the 
deprecation process.

- Andreas

___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Telling Psycopgda2 to return unicode strings

2007-07-26 Thread Andreas Elvers

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] tal:content=structure... and unicode... How to get it work in Zope 2.10.4 ?

2007-07-25 Thread Andreas Elvers

Hi,

I'm having a hard time with page templates using unicode.

Here is a simple example:

- create a page template called dejavu
Encoding is utf-8. Check also your browser character encoding to be set 
to unicode as well.


- put this into the page template.:
IMPORTANT: Since this discussion is in ASCII, I can't write the correct 
deja vu string here.
When testing please use the correct spelling. See 
http://en.wikipedia.org/wiki/Dejavu :-)


span tal:replace=structure python:u'deja vu'/span

When I test this template i will not get deja vu but instead garbled 
characters for e and a.


Why is this ?

Greetings,
- 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] Re: tal:content=structure... and unicode... How to get it work in Zope 2.10.4 ?

2007-07-25 Thread Andreas Elvers

Andreas Jung wrote:


span tal:replace=structure python:u'deja vu'/span







Likely because you're using the u'...' notation. However I have no clue why
do you want to work with unicode strings this way...this looks somewhat
artificial (independent of the behavior).



You are right. The u'...' notation does no good in a page template. It was
just a test to understand unicode strings in page templates.

Moving the string out into a python script and calling the template
gives me deja vu as expected.

example script:
mystring = u'déjà vu'
return context.template(mystring=mystring)

example template:
mystring: span tal:replace=structure options/mystring/span

Thanks,
- 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 )


Re: [Zope] How to present a download button...

2000-07-05 Thread Andreas Elvers


[...]

   I am having trouble with a non standard download method. I want to provide
   a download link to a file, but not the standard one, because I would get
   the id as the filename. The id is a random value and thus not suitable for
   the customer. The real filename is saved in the title property.
   
   So I created a dtml method "download" like this one:
   
   dtml-call "RESPONSE.setHeader('Content-Type', content_type)"
   dtml-call "RESPONSE.setHeader('Content-Disposition',  
  'inline;filename='+title)"
   dtml-var please_give_me_the_raw_data
 Use
 
dtml-var file  -- renders the file content --
 

Hmmm... This gives me a KeyError on file. Is this a new feature of 
Zope 2.2 ? I'm still with 2.1.6. 

Oh well... :-) Thanks anyway.

- Andreas


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] Oh no !! How to undo without manage interface ?

2000-06-12 Thread Andreas Elvers

Hi,

well... I did it. I was trying to install a second virtual host within
zope and after adding an access_rule I was locked out.

All access to zope via web interface gives me:

Error Type: AttributeError
Error Value: __call__

I tried to access zope via FTP. This kind of works but I can't see file
nor can I delete files.

Is there any solution to delete or undo information in the Zope database
from the outside ?

This is hopefully not critical, but annoying :-)

Thanks for any help !

- Andreas


-
Trouble Ticket #6
Problem Summary: Everything is bad
Problem Details: First of all I woke up, then other things happended!
 I want my money back !



___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] Oh no !! How to undo without manage interface ?

2000-06-12 Thread Andreas Elvers

Thanks !

Yes. This "kind" of worked. Although the access_rule for my first virtual
host was gone too, and after adding that one again, the whole thing
started over again. But I was prepared :-) 

Thanks for the quick help

- Andreas

  well... I did it. I was trying to install a second virtual host within
  zope and after adding an access_rule I was locked out.
 
 http://my.site.foo/__no_before_traverse__/manage
 
 lets you access the site without SiteAccess enabled.
 
 ~ethan
 

-
Trouble Ticket #6
Problem Summary: Everything is bad
Problem Details: First of all I woke up, then other things happended!
 I want my money back !


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )