Пример #1
0
    def conversation(self):
        site = getSite()
        pm = getToolByName(site, 'portal_membership')
        if pm.isAnonymousUser():
            # XXX: What do we do when anonymous has sharing rights?
            return _("Please log in to view this conversation")

        # self doesn't have a full acquisition chain, so we use the brain from the
        # catalog
        catalog = getToolByName(site, 'portal_catalog')
        ps = catalog(
                    portal_type=self.portal_type, 
                    id=self.id,
                    creation_date=self.creation_date,
                    modification_date=self.modification_date)
        if len(ps) != 1:
            return _("CatalogError: Could not retrieve the conversation. Please "
                     "contact your site administrator.")

        brain = ps[0]
        member = pm.getAuthenticatedMember()
        username = member.getId()
        password = _getChatPassword(member)
        if password is None:
            return _("Error fetching the conversation. You do not have chat "
                     "password. Please contact your site administrator.")

        s = get_connection(site)
        try:
            response = json.loads(s.getMessages(
                                    username, 
                                    password, 
                                    None, 
                                    [brain.getPath()],
                                    None,
                                    None ))
        except xmlrpclib.Fault, e:
            log.error('Error from babble.server: getMessages: %s' % e)
            return self.cached_conversation
Пример #2
0
 def __init__(self, header=_(u"Online contacts")):
     self.header = header
Пример #3
0
 def __init__(self, header=_(u"Chat rooms")):
     self.header = header