~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Curtis Hovey
  • Date: 2011-12-18 15:13:07 UTC
  • mto: This revision was merged to the branch mainline in revision 14547.
  • Revision ID: curtis.hovey@canonical.com-20111218151307-sdm2gzobt5tplbe0
Moved badges to lp.app.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2009 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
4
# pylint: disable-msg=E0611,W0212
23
23
from zope.component import getUtility
24
24
from zope.interface import implements
25
25
 
 
26
from canonical.config import config
 
27
from canonical.database.constants import UTC_NOW
 
28
from canonical.database.datetimecol import UtcDateTimeCol
 
29
from canonical.database.sqlbase import (
 
30
    flush_database_updates,
 
31
    quote,
 
32
    SQLBase,
 
33
    )
 
34
from canonical.launchpad.webapp import canonical_url
26
35
from lp.app.errors import NotFoundError
27
36
from lp.registry.interfaces.codeofconduct import (
28
37
    ICodeOfConduct,
32
41
    ISignedCodeOfConductSet,
33
42
    )
34
43
from lp.registry.interfaces.gpg import IGPGKeySet
35
 
from lp.services.config import config
36
 
from lp.services.database.constants import UTC_NOW
37
 
from lp.services.database.datetimecol import UtcDateTimeCol
38
 
from lp.services.database.sqlbase import (
39
 
    flush_database_updates,
40
 
    quote,
41
 
    SQLBase,
42
 
    )
43
44
from lp.services.gpg.interfaces import (
44
45
    GPGVerificationError,
45
46
    IGPGHandler,
48
49
    format_address,
49
50
    simple_sendmail,
50
51
    )
51
 
from lp.services.webapp import canonical_url
52
52
 
53
53
 
54
54
class CodeOfConductConf:
215
215
    def sendAdvertisementEmail(self, subject, content):
216
216
        """See ISignedCodeOfConduct."""
217
217
        assert self.owner.preferredemail
218
 
        template = open('lib/lp/registry/emailtemplates/'
 
218
        template = open('lib/canonical/launchpad/emailtemplates/'
219
219
                        'signedcoc-acknowledge.txt').read()
220
220
        fromaddress = format_address(
221
221
            "Launchpad Code Of Conduct System",
318
318
        content = ('Digitally Signed by %s\n' % sig.fingerprint)
319
319
        signed.sendAdvertisementEmail(subject, content)
320
320
 
 
321
 
321
322
    def searchByDisplayname(self, displayname, searchfor=None):
322
323
        """See ISignedCodeOfConductSet."""
323
324
        clauseTables = ['Person']
338
339
        # the name shoudl work like a filter, if you don't enter anything
339
340
        # you get everything.
340
341
        if displayname:
341
 
            query += ' AND Person.fti @@ ftq(%s)' % quote(displayname)
 
342
            query +=' AND Person.fti @@ ftq(%s)' % quote(displayname)
342
343
 
343
344
        # Attempt to search for directive
344
345
        if searchfor == 'activeonly':
389
390
    def getLastAcceptedDate(self):
390
391
        """See ISignedCodeOfConductSet."""
391
392
        return getUtility(ICodeOfConductConf).datereleased
 
393