예제 #1
0
파일: web.py 프로젝트: carriercomm/pyssf
    def post(self, key):
        if len(self.get_arguments('action')) > 0:
            # action
            try:
                entity = self.registry.get_resource(key)
                action = self.parse_action()

                workflow.action_entity(entity, action, self.registry)

                self.render_entity(entity)
            except AttributeError as attr:
                raise HTTPError(400, str(attr))
            except KeyError as key:
                raise HTTPError(404, str(key))
        else:
            # update
            try:
                old = self.registry.get_resource(key)
                new = self.parse_entity(def_kind=old.kind)

                workflow.update_entity(old, new, self.registry)

                self.render_entity(old)
            except AttributeError as attr:
                raise HTTPError(400, str(attr))
            except KeyError as key:
                raise HTTPError(404, str(key))
예제 #2
0
 def test_update_entity_for_success(self):
     '''
     Test replace...
     '''
     # not much to verify here - just calls backends...
     workflow.update_entity(self.src_entity, self.trg_entity, self.registry)
예제 #3
0
 def test_update_entity_for_success(self):
     '''
     Test replace...
     '''
     # not much to verify here - just calls backends...
     workflow.update_entity(self.src_entity, self.trg_entity, self.registry)