launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #18163
[Merge] lp:~cjwatson/launchpad/git-repository-description into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/git-repository-description into lp:launchpad.
Commit message:
Model, export, and render GitRepository.description.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1032731 in Launchpad itself: "Support for Launchpad-hosted Git repositories"
https://bugs.launchpad.net/launchpad/+bug/1032731
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/git-repository-description/+merge/253238
Model, export, and render GitRepository.description.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/git-repository-description into lp:launchpad.
=== modified file 'lib/lp/code/interfaces/gitrepository.py'
--- lib/lp/code/interfaces/gitrepository.py 2015-03-17 10:42:24 +0000
+++ lib/lp/code/interfaces/gitrepository.py 2015-03-17 16:09:05 +0000
@@ -306,6 +306,10 @@
date_last_modified = exported(Datetime(
title=_("Date last modified"), required=True, readonly=True))
+ description = exported(Text(
+ title=_("Description"), required=False, readonly=False,
+ description=_("A short description of this repository.")))
+
class IGitRepositoryModerate(Interface):
"""IGitRepository methods that can be called by more than one community."""
=== modified file 'lib/lp/code/model/gitnamespace.py'
--- lib/lp/code/model/gitnamespace.py 2015-03-03 14:37:54 +0000
+++ lib/lp/code/model/gitnamespace.py 2015-03-17 16:09:05 +0000
@@ -60,7 +60,7 @@
"""Common code for Git repository namespaces."""
def createRepository(self, registrant, name, information_type=None,
- date_created=DEFAULT):
+ date_created=DEFAULT, description=None):
"""See `IGitNamespace`."""
self.validateRegistrant(registrant)
@@ -73,7 +73,7 @@
repository = GitRepository(
registrant, self.owner, self.target, name, information_type,
- date_created)
+ date_created, description=description)
repository._reconcileAccess()
notify(ObjectCreatedEvent(repository))
=== modified file 'lib/lp/code/model/gitrepository.py'
--- lib/lp/code/model/gitrepository.py 2015-03-17 10:42:24 +0000
+++ lib/lp/code/model/gitrepository.py 2015-03-17 16:09:05 +0000
@@ -161,18 +161,21 @@
name = Unicode(name='name', allow_none=False)
+ description = Unicode(name='description', allow_none=True)
+
information_type = EnumCol(enum=InformationType, notNull=True)
owner_default = Bool(name='owner_default', allow_none=False)
target_default = Bool(name='target_default', allow_none=False)
def __init__(self, registrant, owner, target, name, information_type,
- date_created):
+ date_created, description=None):
if not getFeatureFlag(GIT_FEATURE_FLAG):
raise GitFeatureDisabled
super(GitRepository, self).__init__()
self.registrant = registrant
self.owner = owner
self.name = name
+ self.description = description
self.information_type = information_type
self.date_created = date_created
self.date_last_modified = date_created
@@ -511,12 +514,12 @@
implements(IGitRepositorySet)
def new(self, registrant, owner, target, name, information_type=None,
- date_created=DEFAULT):
+ date_created=DEFAULT, description=None):
"""See `IGitRepositorySet`."""
namespace = get_git_namespace(target, owner)
return namespace.createRepository(
registrant, name, information_type=information_type,
- date_created=date_created)
+ date_created=date_created, description=description)
def getByPath(self, user, path):
"""See `IGitRepositorySet`."""
=== modified file 'lib/lp/code/model/tests/test_gitrepository.py'
--- lib/lp/code/model/tests/test_gitrepository.py 2015-03-17 10:47:59 +0000
+++ lib/lp/code/model/tests/test_gitrepository.py 2015-03-17 16:09:05 +0000
@@ -653,6 +653,14 @@
self.assertEqual(
InformationType.PRIVATESECURITY, repository.information_type)
+ def test_attribute_smoketest(self):
+ # Users with launchpad.Moderate can set attributes.
+ project = self.factory.makeProduct()
+ repository = self.factory.makeGitRepository(target=project)
+ with person_logged_in(project.owner):
+ repository.description = u"something"
+ self.assertEqual(u"something", repository.description)
+
class TestGitRepositorySetOwner(TestCaseWithFactory):
"""Test `IGitRepository.setOwner`."""
=== modified file 'lib/lp/code/templates/gitrepository-index.pt'
--- lib/lp/code/templates/gitrepository-index.pt 2015-03-04 16:49:42 +0000
+++ lib/lp/code/templates/gitrepository-index.pt 2015-03-17 16:09:05 +0000
@@ -32,6 +32,10 @@
<div metal:fill-slot="main">
+ <div id="repository-description" tal:condition="context/description"
+ class="summary"
+ tal:content="structure context/description/fmt:text-to-html" />
+
<div class="yui-g first">
<div id="repository-management" class="portlet">
<tal:repository-management
Follow ups