Re: [Zope] idiotic dreamweaver question

2006-09-21 Thread Luiz Fernando Bernardes Ribeiro
2006/9/20, David Bear <[EMAIL PROTECTED]>:
Sorry to bug this list with a dw question. However, I was using DAVin dw and found that dw is unable to handle file extensions like .pt,.zpt, _html , etc.Does anyone else use dreamweaver to edit zope/plone files? If so, how
do you make dreamweaver edit this types of files? I know _html, .pt,.zpt etc are well formed xhtml -- but I don't know how to tell stupiddw to edit them since it uses the extension to recognize file type.
Edit the file "Extensions.txt" in Dreamweaver's Configuration folder (you have to edit the one inside your profile folder).The syntax is simple.-- Luiz Fernando B. Ribeiro

___
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] Change the encoding of a single ZPT page

2006-09-05 Thread Luiz Fernando Bernardes Ribeiro
2006/8/31, Andreas Jung <[EMAIL PROTECTED]>:
--On 31. August 2006 19:28:54 +0200 Dieter Maurer <[EMAIL PROTECTED]>wrote:> Luiz Fernando Bernardes Ribeiro wrote at 2006-8-30 14:08 -0300:>> 2006/8/29, Andreas Jung <
[EMAIL PROTECTED]>:>> ...>> After trying a lot of things, I found the problem is really in the>> zpublisher realm, no matter what kind of encoding trick I use, even with
>> a python script, the output is converted to the default encoding if I>> use any variable or dynamic value from the database.>> If you were right (which I still hope you won't) than someone
> severely misunderstood the meaning of "default".>I think he is not right.-ajZope did respect the default setting when I changed the charset header in the file. 


The lesson learned is: Working with
two encoding charsets is very trick, and even trickier if you use
the ZMI to edit files. I had to create a simple ZPT file with the initial XML block
and "inject" the rest of the xml data, including variables and database, using a tal:content pointing
to a python script encoding everything to utf-8. The ZPT file was
needed as simple way to change the charset header trough the ZMI.When you change the charset trough the ZMI Zope trows an exception if it find any non-conforming character, the problem is that since the default charset is set to iso Zope reencodes my file to iso when it generates the editing form field so when I submit it back Zope raises an exception.

Considering I can't change everything to utf-8 I
will have to live with it and maybe find a simpler pattern to change the charset without raising an exception (maybe the dummy tal:define?).I hope it help others.

Thanks for your help and time,
-- Luiz Fernando B. Ribeiro
___
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] Change the encoding of a single ZPT page

2006-08-30 Thread Luiz Fernando Bernardes Ribeiro
2006/8/30, Luiz Fernando Bernardes Ribeiro <[EMAIL PROTECTED]>:
2006/8/29, Andreas Jung <[EMAIL PROTECTED]>:


--On 29. August 2006 12:28:30 -0300 Luiz Fernando Bernardes Ribeiro<[EMAIL PROTECTED]
> wrote:> Hello all,>> Is it possible to change the encoding of a page without having to change
> the> default-zpublisher-encoding option in zope.conf?>> My default encoding is iso8859-1 but we have to generate some XML files> to a> flash app, but flash only accept utf-8.


If you edit your ZPTs through the ZMI you might set the manage_page_charsetto utf-8. If the content-type of your ZPT is set to text/xml then theZPublisher should auto-detect the encoding from the XML preamble. The
setting in zope.conf is just a fallback (at least in Zope 2.9+).-ajAfter trying a lot of things, I found the problem is really in the zpublisher realm, no matter what kind of encoding trick I use, even with a python script, the output is converted to the default encoding if I use any variable or dynamic value from the database. Changing the  'default-zpublisher-encoding' setting solved the problem but I would have to convert hundreds of iso8859-1 html pages...
I have already recoded the XML inside a Python script where I think it will be easier to use any magic zope trick... so I'm asking a way to avoid changing zope.conf to produce this simgle xml file...Python script 
test.xml:request = container.REQUESTxml = [ ]

xml.append('')

xml.append('http://xml.zope.org/namespaces/metal
" xmlns:tal="
http://xml.zope.org/namespaces/tal">')xml.append('' % (
container.sqlPalavras(ID=id)[0].Apelido, id))

xml.append('')

print unicode("\n".join(xml), 'iso8859-1')return printed

I'm using Zope 2.9.Thanks in advance for your help and time,-- Luiz Fernando B. Ribeiro


Solved!! Using curl I found the problem was really the HTTP headers and the solution was always there in my face, in ZMI change the Content-type property to 'text/xml; charset=utf-8'. Simple and easy...
Thanks all,-- Luiz Fernando B. Ribeiro
___
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] Change the encoding of a single ZPT page

2006-08-30 Thread Luiz Fernando Bernardes Ribeiro
2006/8/29, Andreas Jung <[EMAIL PROTECTED]>:

--On 29. August 2006 12:28:30 -0300 Luiz Fernando Bernardes Ribeiro<[EMAIL PROTECTED]
> wrote:> Hello all,>> Is it possible to change the encoding of a page without having to change
> the> default-zpublisher-encoding option in zope.conf?>> My default encoding is iso8859-1 but we have to generate some XML files> to a> flash app, but flash only accept utf-8.

If you edit your ZPTs through the ZMI you might set the manage_page_charsetto utf-8. If the content-type of your ZPT is set to text/xml then theZPublisher should auto-detect the encoding from the XML preamble. The
setting in zope.conf is just a fallback (at least in Zope 2.9+).-ajAfter trying a lot of things, I found the problem is really in the zpublisher realm, no matter what kind of encoding trick I use, even with a python script, the output is converted to the default encoding if I use any variable or dynamic value from the database. Changing the  'default-zpublisher-encoding' setting solved the problem but I would have to convert hundreds of iso8859-1 html pages...
I have already recoded the XML inside a Python script where I think it will be easier to use any magic zope trick... so I'm asking a way to avoid changing zope.conf to produce this simgle xml file...Python script 
test.xml:request = container.REQUESTxml = [ ]
xml.append('')
xml.append('http://xml.zope.org/namespaces/metal" xmlns:tal="
http://xml.zope.org/namespaces/tal">')xml.append('' % (
container.sqlPalavras(ID=id)[0].Apelido, id))
xml.append('')
print unicode("\n".join(xml), 'iso8859-1')return printed
I'm using Zope 2.9.Thanks in advance for your help and time,-- Luiz Fernando B. Ribeiro

___
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] Change the encoding of a single ZPT page

2006-08-29 Thread Luiz Fernando Bernardes Ribeiro
Hello all,Is it possible to change the encoding of a page without having to change the default-zpublisher-encoding option in zope.conf?My default encoding is iso8859-1 but we have to generate some XML files to a flash app, but flash only accept utf-8.
I tried to encode the individual dynamic strings (obtained from database) in the XML with no success, since zpublisher is configured to iso8859-1 I think the xml is reencoded before it is sent. The XML file is declared with utf-8 encoding.
All strings containing international characters are encoded to utf with python:reg.Field.decode('iso8859-1') in the xml file.Flash loads the xml but all international characters disappears.I'm using Zope 
2.9, MySQL 4.0 with ISO8859-1 encoding.Thanks in advance,-- Luiz Fernando B. Ribeiro
___
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

2006-08-14 Thread Luiz Fernando Bernardes Ribeiro
Hi all,Due to project demands I had to convert the html entities in all TEXT fields in my database to the real international characters like "á", "ç" and so on. The problem is that all my dynamic generated XML started to fail with UnicodeDecodeError. The XML encoding is set to utf-8 and the file itself is correctly encoded.
If I inject the international characters using a Python Script with something like u'çáé' it works, but passing the TEXT field from the database generates the error.I'm using Zope 2.9.2 and MySQL. The XML is generated using ZPT.
The XML, invokes a script to filter and add links to the text retrieved from the database, ex:... xml stuff ...        
... xml stuff ...obra is the database row and Conteudo is the TEXT field.montarCDATA is as simple as (I removed the code to build the links):return '' % textoif instead of the TEXT field I put something like:
return '' % u'çáéà'it works, which leads me to believe the problem is with the database field and XML. The strange thing is that with common html everything works as expected.Traceback (innermost last):
   Module ZPublisher.Publish, line 115, in publish   Module ZPublisher.mapply, line 88, in mapply   Module ZPublisher.Publish, line 41, in call_object  Module Shared.DC.Scripts.Bindings
, line 311, in __call__  Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec  Module Products.PageTemplates.ZopePageTemplate, line 256, in _exec  Module Products.PageTemplates.PageTemplate
, line 105, in pt_render
   Module StringIO, line 271, in getvalueUnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 50: ordinal not in range(128)
Thanks in advance,-- Luiz Fernando B. Ribeiro
___
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 )