~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/model/distributionsourcepackage.py

Merge bzr-code-imports.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
    And,
21
21
    Count,
22
22
    Desc,
23
 
    Join,
24
23
    Max,
25
24
    Sum,
26
25
    )
32
31
    Storm,
33
32
    Unicode,
34
33
    )
35
 
from storm.store import EmptyResultSet
36
34
from zope.interface import implements
37
35
 
38
36
from canonical.database.sqlbase import sqlvalues
39
 
from canonical.launchpad.database.emailaddress import EmailAddress
40
37
from canonical.launchpad.interfaces.lpstorm import IStore
41
38
from canonical.lazr.utils import smartquote
42
39
from lp.bugs.interfaces.bugsummary import IBugSummaryDimension
65
62
from lp.registry.model.distroseries import DistroSeries
66
63
from lp.registry.model.karma import KarmaTotalCache
67
64
from lp.registry.model.packaging import Packaging
68
 
from lp.registry.model.person import Person
69
65
from lp.registry.model.sourcepackage import (
70
66
    SourcePackage,
71
67
    SourcePackageQuestionTargetMixin,
262
258
                     "-pocket"])
263
259
        return spph
264
260
 
265
 
    @property
266
 
    def latest_overall_component(self):
267
 
        """See `IDistributionSourcePackage`."""
268
 
        spph = self.latest_overall_publication
269
 
        if spph:
270
 
            return spph.component
271
 
        return None
272
 
 
273
261
    def getVersion(self, version):
274
262
        """See `IDistributionSourcePackage`."""
275
263
        spph = SourcePackagePublishingHistory.select("""
518
506
            sourcepackagename=self.sourcepackagename,
519
507
            language_code=language_code, language=language)
520
508
 
521
 
    @staticmethod
522
 
    def getPersonsByEmail(email_addresses):
523
 
        """[(EmailAddress,Person), ..] iterable for given email addresses."""
524
 
        if email_addresses is None or len(email_addresses) < 1:
525
 
            return EmptyResultSet()
526
 
        # Perform basic sanitization of email addresses.
527
 
        email_addresses = [
528
 
            address.lower().strip() for address in email_addresses]
529
 
        store = IStore(Person)
530
 
        origin = [
531
 
            Person, Join(EmailAddress, EmailAddress.personID == Person.id)]
532
 
        # Get all persons whose email addresses are in the list.
533
 
        result_set = store.using(*origin).find(
534
 
            (EmailAddress, Person),
535
 
            EmailAddress.email.lower().is_in(email_addresses))
536
 
        return result_set
537
 
 
538
509
    @classmethod
539
510
    def _get(cls, distribution, sourcepackagename):
540
511
        return Store.of(distribution).find(