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)
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('./')
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
def getContent(self): prefs = IPersonalTags(self.request.principal) tags = prefs.getTags( getUtility(IIntIds).queryId(removeAllProxies(self.context))) return {'tags': ', '.join(tags)}