#70 — AttributeError: default_charset
| State | Unconfirmed |
|---|---|
| Version: | 0.9.0 |
| Area | Functionality |
| Issue type | Bug |
| Severity | Medium |
| Submitted by | (anonymous) |
| Submitted on | Apr 09, 2008 |
| Responsible |
—
|
| Target release: |
—
|
Last modified on
Jan 08, 2009
by
Matthew Wilkes
Hi,
I happened to install r62252 with Plone 3.0.6 on a OS X Mac Intel and ran into the problem described in the title - I hope I fixed the issue by changing the code as seen in the diff below.
Index: tool/bibliography.py
===================================================================
--- tool/bibliography.py (revision 62252)
+++ tool/bibliography.py (working copy)
@@ -630,7 +630,7 @@
keys = [k.strip() for k in hit.group(1).split(',')]
results = []
catalog = getToolByName(self, 'portal_catalog')
- encoding = self.getProperty('default_charset') or 'utf-8'
+ encoding = self.getProperty('default_charset', 'utf-8')
for key in keys:
brains = catalog(getId = key,
portal_type = self.getReferenceTypes()
@@ -653,7 +653,7 @@
)
if brains:
brain = brains[0]
- encoding = self.getProperty('default_charset') or 'utf-8'
+ encoding = self.getProperty('default_charset', 'utf-8')
authors = _encode(brain.Authors, encoding)
year = _encode(brain.publication_year, encoding)
Index: tool/renderers/base.py
===================================================================
--- tool/renderers/base.py (revision 62252)
+++ tool/renderers/base.py (working copy)
@@ -148,7 +148,11 @@
""" convert the renderer's result to the output encoding
"""
u_tool = getToolByName(self, 'portal_url')
- portal_encoding = u_tool.getPortalObject().default_charset or None
+ try:
+ portal_encoding = u_tool.getPortalObject().default_charset
+ except AttributeError:
+ portal_encoding = None
+
if output_encoding is not None:
if portal_encoding is not None:
return _encode(_decode(export_text, portal_encoding), output_encoding)
I happened to install r62252 with Plone 3.0.6 on a OS X Mac Intel and ran into the problem described in the title - I hope I fixed the issue by changing the code as seen in the diff below.
Index: tool/bibliography.py
===================================================================
--- tool/bibliography.py (revision 62252)
+++ tool/bibliography.py (working copy)
@@ -630,7 +630,7 @@
keys = [k.strip() for k in hit.group(1).split(',')]
results = []
catalog = getToolByName(self, 'portal_catalog')
- encoding = self.getProperty('default_charset') or 'utf-8'
+ encoding = self.getProperty('default_charset', 'utf-8')
for key in keys:
brains = catalog(getId = key,
portal_type = self.getReferenceTypes()
@@ -653,7 +653,7 @@
)
if brains:
brain = brains[0]
- encoding = self.getProperty('default_charset') or 'utf-8'
+ encoding = self.getProperty('default_charset', 'utf-8')
authors = _encode(brain.Authors, encoding)
year = _encode(brain.publication_year, encoding)
Index: tool/renderers/base.py
===================================================================
--- tool/renderers/base.py (revision 62252)
+++ tool/renderers/base.py (working copy)
@@ -148,7 +148,11 @@
""" convert the renderer's result to the output encoding
"""
u_tool = getToolByName(self, 'portal_url')
- portal_encoding = u_tool.getPortalObject().default_charset or None
+ try:
+ portal_encoding = u_tool.getPortalObject().default_charset
+ except AttributeError:
+ portal_encoding = None
+
if output_encoding is not None:
if portal_encoding is not None:
return _encode(_decode(export_text, portal_encoding), output_encoding)
No responses can be added.