コード例 #1
0
ファイル: api.py プロジェクト: Stackato-Apps/bloodhound
    def delete(self, relation_id, when=None):
        if when is None:
            when = datetime.now(utc)
        relation = Relation.load_by_relation_id(self.env, relation_id)
        source = relation.source
        destination = relation.destination
        relation_type = relation.type
        with self.env.db_transaction:
            cloned_relation = relation.clone()
            relation.delete()
            other_end = self.link_ends_map[relation_type]
            if other_end:
                reverted_relation = Relation(self.env,
                                             keys=dict(
                                                 source=destination,
                                                 destination=source,
                                                 type=other_end,
                                             ))
                reverted_relation.delete()

            for listener in self.changing_listeners:
                listener.deleting_relation(cloned_relation, when)

            from bhrelations.notification import RelationNotifyEmail
            RelationNotifyEmail(self.env).notify(cloned_relation, deleted=when)
コード例 #2
0
ファイル: web_ui.py プロジェクト: thimalk/bloodhound-789
 def remove_relations(self, req, rellist):
     relsys = RelationsSystem(self.env)
     for relid in rellist:
         relation = Relation.load_by_relation_id(self.env, relid)
         resource = ResourceIdSerializer.get_resource_by_id(
             relation.destination)
         if 'TICKET_MODIFY' in req.perm(resource):
             relsys.delete(relid)
         else:
             add_warning(req,
                 _('Not enough permissions to remove relation "%s"' % relid))
コード例 #3
0
ファイル: web_ui.py プロジェクト: mohsadki/dargest
 def remove_relations(self, req, rellist):
     relsys = RelationsSystem(self.env)
     for relid in rellist:
         relation = Relation.load_by_relation_id(self.env, relid)
         resource = \
             ResourceIdSerializer.get_resource_by_id(relation.destination)
         if 'TICKET_MODIFY' in req.perm(resource):
             relsys.delete(relid)
         else:
             add_warning(req, _('Insufficient permissions to remove '
                                'relation "%(relation)s"', relation=relid))
コード例 #4
0
ファイル: api.py プロジェクト: thimalk/bloodhound-789
    def delete(self, relation_id, when=None):
        if when is None:
            when = datetime.now(utc)
        relation = Relation.load_by_relation_id(self.env, relation_id)
        source = relation.source
        destination = relation.destination
        relation_type = relation.type
        with self.env.db_transaction:
            cloned_relation = relation.clone()
            relation.delete()
            other_end = self.link_ends_map[relation_type]
            if other_end:
                reverted_relation = Relation(self.env, keys=dict(
                    source=destination,
                    destination=source,
                    type=other_end,
                ))
                reverted_relation.delete()

            for listener in self.changing_listeners:
                listener.deleting_relation(cloned_relation, when)

            from bhrelations.notification import RelationNotifyEmail
            RelationNotifyEmail(self.env).notify(cloned_relation, deleted=when)