def process(sid, params): #删除pod pod = DBSession.query(model.podModel).filter_by(pid=params['pid']).first() if not pod: return dict(errors={'pod': 'pod not found'}) DBSession.delete(pod) #podspecs = DBSession.query(model.podspec).filter_by(pid=55).all() return ({}, 'success.')
def process(sid, params): podModels = DBSession.query(model.podModel).all() for podInfo in podModels: #创建对应tag的二进制库 pod = DBSession.query( model.podModel).filter_by(pid=podInfo.pid).first() try: cloneMirror.podCloneAndMirror(copy.deepcopy(pod)) except Exception, e: status, message = e.args if status == 4: raise APIError(4, message) else: raise APIError(1, traceback.format_exc())
def process(sid, params): print params['pid'] pod = DBSession.query(model.podModel).get(params['pid']) if not pod: raise APIError(1,'pod is not existed') if params.has_key('podName'): pod.podName = params['podName'] if params.has_key('sourceHttpUrl'): pod.sourceHttpUrl = params['sourceHttpUrl'] if params.has_key('specSourceHttpUrl'): pod.specSourceHttpUrl = params['specSourceHttpUrl'] if params.has_key('mirrorSSHUrl'): pod.mirrorSSHUrl = params['mirrorSSHUrl'] if params.has_key('mirrorHttpUrl'): pod.mirrorHttpUrl = params['mirrorHttpUrl'] if params.has_key('noReplaceSource'): pod.noReplaceSource = params['noReplaceSource'] print "######" + params['noReplaceSource'] #podspecs = DBSession.query(model.podspec).filter_by(pid=55).all() return (pod, 'success.')
def process(sid, params): podone = DBSession.query( model.podModel).filter_by(podName=params['podName']).first() if podone: raise APIError(1, 'podName: ' + params['podName'] + '已存在') newPod = model.podModel(podName=params['podName'], sourceHttpUrl=params['sourceHttpUrl'], specSourceHttpUrl=params['specSourceHttpUrl'], mirrorSSHUrl=params['mirrorSSHUrl'], mirrorHttpUrl=params['mirrorHttpUrl'], noReplaceSource=params['noReplaceSource']) DBSession.add(newPod) DBSession.flush() #podspecs = DBSession.query(model.podspec).filter_by(pid=55).all() return (newPod, 'success.')
def setUp(self): """Setup test fixture for each model test method.""" try: new_attrs = {} new_attrs.update(self.attrs) new_attrs.update(self.do_get_dependencies()) self.obj = self.klass(**new_attrs) DBSession.add(self.obj) DBSession.flush() return self.obj except: DBSession.rollback() raise
def process(sid, params): podModels = DBSession.query(model.podModel).all() #podspecs = DBSession.query(model.podspec).filter_by(pid=55).all() return (podModels, 'success.')
def by_user_name(cls, username): """Return the user object whose user name is ``username``.""" return DBSession.query(cls).filter_by(user_name=username).first()
def by_email_address(cls, email): """Return the user object whose email address is ``email``.""" return DBSession.query(cls).filter_by(email_address=email).first()
def test_query_obj(self): """Model objects can be queried""" obj = DBSession.query(self.klass).one() for key, value in self.attrs.items(): eq_(getattr(obj, key), value)
def tearDown(self): """Tear down test fixture for each model test method.""" DBSession.rollback()