Example #1
0
    def processMessage(self, message, info, text, attachments):
        community = find_communities(self.root)[info["community"]]
        target = tool = community[info["tool"]]

        # XXX this should be more like:
        if info["in_reply_to"] is not None:
            docid = int(hex_to_docid(info["in_reply_to"]))
            catalog = find_catalog(target)
            path = catalog.document_map.address_for_docid(docid)
            item = find_model(self.root, path)
            target = item

        IMailinHandler(target).handle(message, info, text, attachments)
Example #2
0
    def process_message(self, message, info, target, text, attachments):
        report_name = target.get('report')
        if report_name is not None:
            pd = find_peopledirectory(self.root)
            context = find_model(pd, report_name.split('+'))
        else:
            community = find_communities(self.root)[target['community']]
            context = tool = community[target['tool']]

            if target['in_reply_to'] is not None:
                docid = int(hex_to_docid(target['in_reply_to']))
                catalog = find_catalog(context)
                path = catalog.document_map.address_for_docid(docid)
                item = find_model(self.root, path)
                context = item

        IMailinHandler(context).handle(message, info, text, attachments)
Example #3
0
    def processMessage(self, message, info, text, attachments):
        report_name = info.get('report')
        if report_name is not None:
            pd = find_peopledirectory(self.root)
            target = find_model(pd, report_name.split('+'))
        else:
            community = find_communities(self.root)[info['community']]
            target = tool = community[info['tool']]

            # XXX this should be more like:
            if info['in_reply_to'] is not None:
                docid = int(hex_to_docid(info['in_reply_to']))
                catalog = find_catalog(target)
                path = catalog.document_map.address_for_docid(docid)
                item = find_model(self.root, path)
                target = item

        IMailinHandler(target).handle(message, info, text, attachments)
Example #4
0
File: mailin.py Project: zagy/karl
    def process_message(self, message, info, target, text, attachments):
        report_name = target.get('report')
        if report_name is not None:
            pd = find_peopledirectory(self.root)
            context = find_resource(pd, report_name.split('+'))
        else:
            community = find_communities(self.root)[target['community']]
            context = community[target['tool']]

            if target['in_reply_to'] is not None:
                docid = int(hex_to_docid(target['in_reply_to']))
                catalog = find_catalog(context)
                path = catalog.document_map.address_for_docid(docid)
                if path is None:
                    # replied-to content doesn't exist anymore.
                    # Do not process.
                    return 'Content no longer exists.'
                item = find_resource(self.root, path)
                context = item

        IMailinHandler(context).handle(message, info, text, attachments)
Example #5
0
    def process_message(self, message, info, target, text, attachments):
        report_name = target.get('report')
        if report_name is not None:
            pd = find_peopledirectory(self.root)
            context = find_resource(pd, report_name.split('+'))
        else:
            community = find_communities(self.root)[target['community']]
            context = community[target['tool']]

            if target['in_reply_to'] is not None:
                docid = int(hex_to_docid(target['in_reply_to']))
                catalog = find_catalog(context)
                path = catalog.document_map.address_for_docid(docid)
                if path is None:
                    # replied-to content doesn't exist anymore.
                    # Do not process.
                    return 'Content no longer exists.'
                item = find_resource(self.root, path)
                context = item

        IMailinHandler(context).handle(message, info, text, attachments)
Example #6
0
 def test_hex_to_docid(self):
     from karl.utils import hex_to_docid
     from karl.utils import _MAX_32BIT_INT
     self.assertEqual(hex_to_docid('7FFFFFFF'), 0)
     self.assertEqual(hex_to_docid('FFFFFFFE'), _MAX_32BIT_INT)
     self.assertEqual(hex_to_docid('00000000'), -_MAX_32BIT_INT)
Example #7
0
 def test_hex_to_docid(self):
     from karl.utils import hex_to_docid
     from karl.utils import _MAX_32BIT_INT
     self.assertEqual(hex_to_docid('7FFFFFFF'), 0)
     self.assertEqual(hex_to_docid('FFFFFFFE'), _MAX_32BIT_INT)
     self.assertEqual(hex_to_docid('00000000'), -_MAX_32BIT_INT)