예제 #1
0
 def test_replace_entity_for_success(self):
     '''
     Test replace...
     '''
     # not much to verify here - just calls backends...
     workflow.replace_entity(self.src_entity, self.trg_entity,
                             self.registry)
예제 #2
0
 def test_replace_entity_for_success(self):
     '''
     Test replace...
     '''
     # not much to verify here - just calls backends...
     workflow.replace_entity(self.src_entity,
                             self.trg_entity,
                             self.registry)
예제 #3
0
파일: web.py 프로젝트: carriercomm/pyssf
    def put(self, key):
        if key in self.registry.get_resource_keys():
            # replace...
            try:
                old = self.registry.get_resource(key)
                new = self.parse_entity()

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

                self.render_entity(old)
            except AttributeError as attr:
                raise HTTPError(400, str(attr))
        else:
            # create...
            try:
                entity = self.parse_entity()

                workflow.create_entity(key, entity, self.registry)

                self.response(201, self.registry.get_default_type(),
                              {'Location': self.request.protocol
                                           + '://' + self.request.host + key})
            except AttributeError as attr:
                raise HTTPError(400, str(attr))