[Zope] NuxDocument Nonfunctional
Damon Butler
damon@hddesign.com
28 Jan 2003 12:13:07 -0600
On Tue, 2003-01-28 at 07:58, Florent Guillaume wrote:
> Apparently Localizer (in fact, python gettext module) didn't correctly
> parse the charset of the .po files... Are they standard .po files? There
> should be a Content-Type: xxx; charset=foo header in them.
>
> If you could add debug statements to /local/lib/python2.1/gettext.py to
> track this down it would be helpful.
The method in question is barebones:
-----
def ugettext(self, message):
tmsg = self._catalog.get(message, message)
return unicode(tmsg, self._charset)
-----
The line raising the error I noted is the 'return' statement.
With only two variables in question, I inserted a 'raise Exception'
statement just prior to the problematic one containing the 'unicode'
function to smoke out what their values were:
-----
raise Exception, "tmsg: %s, self._charset: %s" % (tmsg, self._charset)
-----
Here's what I got:
-----
Error Value: tmsg: Add ZNuxDocument, self._charset: CHARSET
-----
The problem appears to be with 'CHARSET' as a value. Looks like it ought
to be the result of an environmental variable to me, but I don't see
where in the code it gets set, except via the '_parse' method of the
GNUTranslations class defined directly above this spot in the gettext.py
code. The relevant section of that method:
-----
[...]
# See if we're looking at GNU .mo conventions for metadata
if mlen == 0 and tmsg.lower().startswith('project-id-version:'):
# Catalog description
for item in tmsg.split('\n'):
item = item.strip()
if not item:
continue
k, v = item.split(':', 1)
k = k.strip().lower()
v = v.strip()
self._info[k] = v
if k == 'content-type':
self._charset = v.split('charset=')[1]
[...]
-----
Any idea what's going on? I don't really know where to look next.
--Damon
========================
> Florent
>
>
> In article <1043428979.268.35.camel@kermit> you write:
> > On FreeBSD 4.7 I'm running Zope 2.5.1 that I've patched with all the
> > Unicode diffs from http://www.zope.org/Members/efge/i18n/Unicode-2.5.1.
> > I've also installed Localizer 1.0.0. All in an attempt to get
> > NuxDocument 1.1alpha functional. (I've installed all the necessary
> > converter apps as well: wvWare, etc.) I *think* I've installed
> > NuxDocument correctly, but the very first instruction is confusing:
> >
> > "Install the product in Products (NOT lib/python/Products!). The
> > ZNuxDocument product should appear in the ZMI."
> >
> > Well, the *only* "Products" directory in existence on my system is
> > lib/python/Products. So that's where I stuck it. Now I see a
> > "NuxDocument" available as something I can Add in the ZMI (not
> > "ZNuxDocument").
> >
> > Problem is, whenever I try to Add a NuxDocument, I get the following
> > Traceback from Localizer:
> >
> > =-=-=-=-=-=-=-=-=-=
> >
> > Error Type: LookupError
> > Error Value: unknown encoding
> > Traceback (innermost last):
> > File /usr/local/www/Zope/lib/python/ZPublisher/Publish.py, line 150,
> > in publish_module
> > File /usr/local/www/Zope/lib/python/Products/Localizer/__init__.py,
> > line 58, in new_publish
> > File /usr/local/www/Zope/lib/python/ZPublisher/Publish.py, line 114,
> > in publish
> > File /usr/local/www/Zope/lib/python/Zope/__init__.py, line 159, in
> > zpublisher_exception_hook
> > File /usr/local/www/Zope/lib/python/ZPublisher/Publish.py, line 98, in
> > publish
> > File /usr/local/www/Zope/lib/python/ZPublisher/mapply.py, line 88, in
> > mapply
> > (Object: addForm)
> > File /usr/local/www/Zope/lib/python/ZPublisher/Publish.py, line 39, in
> > call_object
> > (Object: addForm)
> > File /usr/local/www/Zope/lib/python/Shared/DC/Scripts/Bindings.py,
> > line 252, in __call__
> > (Object: addForm)
> > File /usr/local/www/Zope/lib/python/Shared/DC/Scripts/Bindings.py,
> > line 283, in _bindAndExec
> > (Object: addForm)
> > File /usr/local/www/Zope/lib/python/Products/Localizer/LocalFiles.py,
> > line 100, in _exec
> > (Object: addForm)
> > File /usr/local/www/Zope/lib/python/App/special_dtml.py, line 172, in
> > _exec
> > (Object: addForm)
> > File /usr/local/www/Zope/lib/python/DocumentTemplate/DT_Util.py, line
> > 179, in eval
> > (Object: manage_form_title(this(), _,
> > form_title=gettext('Add ZNuxDocument')))
> > (Info: this)
> > File <string>, line 0, in ?
> > File /usr/local/www/Zope/lib/python/Products/Localizer/LocalFiles.py,
> > line 82, in gettext
> > (Object: addForm)
> > File /usr/local/lib/python2.1/gettext.py, line 195, in ugettext
> > LookupError: (see above)
>