def accept_source(config, changes): key = changes.validate_signature() try: who = User.get_by_key(key) except KeyError: return reject(changes, config, 'bad-user-account') dsc = os.path.basename(changes.get_dsc()) group = None if 'X-Lucy-Group' in changes: group = changes['X-Lucy-Group'] obj = Source(source=changes['source'], version=changes['version'], owner=who['_id'], group=group, dsc=dsc) obj.save() path = move_to_pool(config, obj['_id'], changes) os.unlink(changes.get_filename()) obj['path'] = path obj.save() print("ACCEPT: {source}/{version} for {owner} as {_id}".format(**obj)) #send_mail("ACCEPTED: {source}/{version} for {owner} as {_id}".format( # **obj), who['email'], "ACCEPTED!") add_jobs(obj, 'source', config, 'source', changes)
def get_source_package(self, package): """ Get the DB entry for the source package. Return None if it doesn't exist. """ try: return dict(Source.load(package)) except KeyError: return None
def get_dsc(self, package): """ Get the .dsc path if the package is a valid source package. Otherwise return None. """ public = config['public'] package = Source.load(package) return "{public}/{pool}/{dsc}".format( public=public, pool=package['path'], dsc=package['dsc'], )
def get_uploads(self): from lucy import Source return Source.get_uploads_for_user(self['_id'])
def get_uploads(self): from lucy import Source return Source.get_uploads_for_user(self["_id"])