Changeset 1039 in products


Ignore:
Timestamp:
Apr 16, 2009 12:28:45 PM (17 years ago)
Author:
koval
Message:

fixed bug with non-ascii characters in tags

Location:
quintagroup.portlet.cumulus/trunk/quintagroup/portlet/cumulus
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.portlet.cumulus/trunk/quintagroup/portlet/cumulus/blog.py

    r1036 r1039  
    1010    implements(ITagsRetriever) 
    1111 
    12     def __init__(self, context): 
    13         self.context = context 
    14  
    1512    def getTags(self, number=None): 
    1613        """ Get Quills blog's tags. 
     
    2320        tags = [] 
    2421        for topic in topics: 
    25             tags.append((topic.getTitle(), len(topic), topic.absolute_url())) 
     22            tags.append((topic.getTitle().decode(self.default_charset), len(topic), topic.absolute_url())) 
    2623 
    2724        return tags 
  • quintagroup.portlet.cumulus/trunk/quintagroup/portlet/cumulus/catalog.py

    r1036 r1039  
    99    def __init__(self, context): 
    1010        self.context = context 
     11        portal_properties = getToolByName(self.context, 'portal_properties') 
     12        self.default_charset = portal_properties.site_properties.getProperty('default_charset', 'utf-8') 
    1113 
    1214    def getTags(self, number=None): 
     
    2123            except TypeError: 
    2224                number_of_entries = 1 
    23             tags.append((name, number_of_entries, '#')) 
     25            tags.append((name.decode(self.default_charset), number_of_entries, '#')) 
    2426 
    2527        return tags 
  • quintagroup.portlet.cumulus/trunk/quintagroup/portlet/cumulus/cumulusportlet.py

    r1038 r1039  
    145145        portal_state = getMultiAdapter((context, request), name=u'plone_portal_state') 
    146146        self.portal_url = portal_state.portal_url() 
     147        portal_properties = getMultiAdapter((context, request), name=u'plone_tools').properties() 
     148        self.default_charset = portal_properties.site_properties.getProperty('default_charset', 'utf-8') 
    147149 
    148150    @property 
     
    171173 
    172174    def getParams(self): 
     175        tagcloud = '<tags>%s</tags>' % self.getTagAnchors() 
     176        tagcloud = tagcloud.encode(self.default_charset) 
     177        tagcloud = urllib.quote(tagcloud) 
    173178        params = { 
    174179            'url': self.portal_url + '/++resource++tagcloud.swf', 
     
    183188            'distr': self.data.distr and 'true' or 'false', 
    184189            'mode': 'tags', 
    185             'tagcloud': urllib.quote('<tags>%s</tags>' % self.getTagAnchors()), 
     190            'tagcloud': tagcloud, 
    186191        } 
    187192        flashvars = [] 
Note: See TracChangeset for help on using the changeset viewer.