~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/model/archive.py

  • Committer: Curtis Hovey
  • Date: 2011-12-24 17:49:30 UTC
  • mto: This revision was merged to the branch mainline in revision 14602.
  • Revision ID: curtis.hovey@canonical.com-20111224174930-xk1d5cvhyxq46ctf
Moved webapp to lp.services.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
    implements,
44
44
    )
45
45
 
 
46
from canonical.config import config
 
47
from canonical.database.constants import UTC_NOW
 
48
from canonical.database.datetimecol import UtcDateTimeCol
 
49
from canonical.database.enumcol import EnumCol
 
50
from canonical.database.sqlbase import (
 
51
    cursor,
 
52
    quote,
 
53
    quote_like,
 
54
    SQLBase,
 
55
    sqlvalues,
 
56
    )
 
57
from lp.services.webapp.authorization import check_permission
 
58
from lp.services.webapp.interfaces import (
 
59
    DEFAULT_FLAVOR,
 
60
    IStoreSelector,
 
61
    MAIN_STORE,
 
62
    )
 
63
from lp.services.webapp.url import urlappend
46
64
from lp.app.errors import NotFoundError
47
65
from lp.app.interfaces.launchpad import ILaunchpadCelebrities
48
66
from lp.app.validators.name import valid_name
69
87
from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
70
88
from lp.registry.model.sourcepackagename import SourcePackageName
71
89
from lp.registry.model.teammembership import TeamParticipation
72
 
from lp.services.config import config
73
90
from lp.services.database.bulk import load_related
74
 
from lp.services.database.constants import UTC_NOW
75
 
from lp.services.database.datetimecol import UtcDateTimeCol
76
91
from lp.services.database.decoratedresultset import DecoratedResultSet
77
 
from lp.services.database.enumcol import EnumCol
78
92
from lp.services.database.lpstorm import (
79
93
    ISlaveStore,
80
94
    IStore,
81
95
    )
82
 
from lp.services.database.sqlbase import (
83
 
    cursor,
84
 
    quote,
85
 
    quote_like,
86
 
    SQLBase,
87
 
    sqlvalues,
88
 
    )
89
96
from lp.services.features import getFeatureFlag
90
97
from lp.services.job.interfaces.job import JobStatus
91
98
from lp.services.librarian.model import (
100
107
    create_token,
101
108
    create_unique_token_for_table,
102
109
    )
103
 
from lp.services.webapp.authorization import check_permission
104
 
from lp.services.webapp.interfaces import (
105
 
    DEFAULT_FLAVOR,
106
 
    IStoreSelector,
107
 
    MAIN_STORE,
108
 
    )
109
 
from lp.services.webapp.url import urlappend
110
110
from lp.soyuz.adapters.archivedependencies import expand_dependencies
111
111
from lp.soyuz.adapters.packagelocation import PackageLocation
112
112
from lp.soyuz.enums import (
1288
1288
            #   - the given source package directly
1289
1289
            #   - a package set in the correct distro series that includes the
1290
1290
            #     given source package
1291
 
            source_allowed = self.checkArchivePermission(
1292
 
                person, sourcepackagename)
 
1291
            source_allowed = self.checkArchivePermission(person,
 
1292
                                                         sourcepackagename)
1293
1293
            set_allowed = self.isSourceUploadAllowed(
1294
1294
                sourcepackagename, person, distroseries)
1295
1295
            if source_allowed or set_allowed:
1296
1296
                return None
1297
1297
 
1298
1298
        if not self.getComponentsForUploader(person):
 
1299
            # XXX: JamesWestby 2010-08-01 bug=612351: We have to use
 
1300
            # is_empty() as we don't get an SQLObjectResultSet back, and
 
1301
            # so __nonzero__ isn't defined on it, and a straight bool
 
1302
            # check wouldn't do the right thing.
1299
1303
            if self.getPackagesetsForUploader(person).is_empty():
1300
1304
                return NoRightsForArchive()
1301
1305
            else: