Пример #1
0
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)
Пример #2
0
 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
Пример #3
0
 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
Пример #4
0
 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'],
     )
Пример #5
0
 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'],
     )
Пример #6
0
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)
Пример #7
0
 def get_uploads(self):
     from lucy import Source
     return Source.get_uploads_for_user(self['_id'])
Пример #8
0
    def get_uploads(self):
        from lucy import Source

        return Source.get_uploads_for_user(self["_id"])