← Back to team overview

launchpad-dev team mailing list archive

Re: Binary upload processing

 

On Mon, 2010-08-16 at 15:24 -0300, Guilherme Salgado wrote:
> Hi Julian,
> 
> This was a discussion we had off-list but since I'm going to start
> working on it, I thought it'd be a good idea to see if you're happy with
> the proposed solution.
> 
> On Fri, 2010-07-30 at 16:48 -0300, Guilherme Salgado wrote:
> > Hi James,
> > 
> > On Fri, 2010-07-30 at 13:56 -0400, James Westby wrote:
> > > Hi,
> > > 
> > > I dug in to how upload policies work and it looks to be fairly
> > > straightforward for our needs.
> > > 
> > > Firstly we would define our policy in
> > > lib/lp/archiveuploader/uploadpolicy.py, setting some options for
> > > standard processing, and with a method that we can use to reject on any
> > > condition we like.
> > > 
> > 
> > > We register this policy with a specific name, e.g. 'vostok', and this is
> > > how the policy is selected. We would set the configs/cronscripts for
> > > vostok instances to run the upload processor with -C vostok, and that
> > > would mean the policy would be used.
> > > 
> > 
> > Ideally we'd use zope named utilities instead of the policy registry
> > implemented by AbstractUploadPolicy.  That'd allow us to define our
> > custom policy under lp/vostok instead of lp/archiveuploader, but that's
> > not required, of course.
> 
> This is not as straight-forward as I expected because zope utilities are
> implemented as singletons but the main callsite of AbstractUploadPolicy
> changes the policy instances based on the arguments given in the command
> line.  I'll check with Gary if there's any other way we could achieve
> the same thing that utilities would buy us.

It turns out we can easily do that by specifying the classes as the
'component' argument of the <utility> directive.  That way the classes
themselves (instead of instances of them) are registered as the
utilities with the site manager.

-- 
Guilherme Salgado <https://launchpad.net/~salgado>

Attachment: signature.asc
Description: This is a digitally signed message part


References