Esempio n. 1
0
    def update(self):
        super(UserTags, self).update()

        prefs = IPersonalTags(self.request.principal)
        self.oid = getUtility(IIntIds).queryId(removeAllProxies(self.context))
        if self.oid:
            self.tags = prefs.getTags(self.oid)
Esempio n. 2
0
    def handleSave(self, action):
        data, errors = self.extractData()

        tags = [t.strip() for t in data['tags'].split(',')]

        prefs = IPersonalTags(self.request.principal)
        prefs.setTags(
            getUtility(IIntIds).queryId(removeAllProxies(self.context)), tags)

        IStatusMessage(self.request).add(_(u'Tags have been changed.'))
        self.redirect('./')
Esempio n. 3
0
    def popularTags(self):
        engine = IPersonalTags(self.request.principal).engine

        idx = 1
        tags = []
        for weight, tag in engine.getTagCloud(True):
            tags.append(tag)
            if idx == 10:
                break
            idx += 1

        return tags
Esempio n. 4
0
 def getContent(self):
     prefs = IPersonalTags(self.request.principal)
     tags = prefs.getTags(
         getUtility(IIntIds).queryId(removeAllProxies(self.context)))
     return {'tags': ', '.join(tags)}