You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/03/29 17:55:30 UTC

[01/14] git commit: format capabilities in the same format needed to input a new one

Updated Branches:
  refs/heads/cj/5978 c23c13895 -> 846658868 (forced update)


format capabilities in the same format needed to input a new one


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/6f44f8ac
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/6f44f8ac
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/6f44f8ac

Branch: refs/heads/cj/5978
Commit: 6f44f8ac15258194e9c6d03774d7bfa2682a2b38
Parents: aced859
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Mar 28 16:47:03 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Mar 28 16:47:03 2013 +0000

----------------------------------------------------------------------
 .../allura/templates/site_admin_api_tickets.html   |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6f44f8ac/Allura/allura/templates/site_admin_api_tickets.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/site_admin_api_tickets.html b/Allura/allura/templates/site_admin_api_tickets.html
index 3aaf37c..4f82fb2 100644
--- a/Allura/allura/templates/site_admin_api_tickets.html
+++ b/Allura/allura/templates/site_admin_api_tickets.html
@@ -33,7 +33,7 @@
 <tr>
 <td>{{token.user.username}}</td>
 <td>{{token.expires}}</td>
-<td>{{token.capabilities}}</td>
+<td>{{h.json.dumps(token.capabilities)}}</td>
 <td></td>
 </tr>
 <tr>


[12/14] git commit: [#5971] don't show or create user-projects for disabled users

Posted by jo...@apache.org.
[#5971] don't show or create user-projects for disabled users


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/d7846b25
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/d7846b25
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/d7846b25

Branch: refs/heads/cj/5978
Commit: d7846b25df18c085792f64a42fbfb7ffab7366a5
Parents: 34729f5
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Mar 28 19:08:45 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 29 15:23:59 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/project.py               |    7 ++++++-
 Allura/allura/model/auth.py                        |    3 +++
 .../allura/tests/functional/test_neighborhood.py   |    7 +++++++
 Allura/allura/tests/model/test_auth.py             |    7 +++++++
 4 files changed, 23 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d7846b25/Allura/allura/controllers/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index ebeba77..7a1551f 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -67,7 +67,7 @@ class NeighborhoodController(object):
         project = M.Project.query.get(shortname=self.prefix + pname, neighborhood_id=self.neighborhood._id)
         if project is None and self.prefix == 'u/':
             # create user-project if it is missing
-            user = M.User.query.get(username=pname)
+            user = M.User.query.get(username=pname, disabled=False)
             if user:
                 project = self.neighborhood.register_project(
                     plugin.AuthenticationProvider.get(request).user_project_shortname(user),
@@ -77,6 +77,11 @@ class NeighborhoodController(object):
             project = self.neighborhood.neighborhood_project
             c.project = project
             return ProjectController()._lookup(pname, *remainder)
+        if project and self.prefix == 'u/':
+            # make sure user-projects are associated with an enabled user
+            user = project.user_project_of
+            if not user or user.disabled:
+                raise exc.HTTPNotFound
         if project.database_configured == False:
             if remainder == ('user_icon',):
                 redirect(g.forge_static('images/user.png'))

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d7846b25/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index 8df4a58..ee9abec 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -587,6 +587,9 @@ class User(MappedClass, ActivityNode, ActivityObject):
         '''
         Returns the personal user-project for the user
         '''
+        if self.disabled:
+            return None
+
         from allura import model as M
         n = M.Neighborhood.query.get(name='Users')
         auth_provider = plugin.AuthenticationProvider.get(request)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d7846b25/Allura/allura/tests/functional/test_neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_neighborhood.py b/Allura/allura/tests/functional/test_neighborhood.py
index 9c86a67..815f557 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -813,6 +813,13 @@ class TestNeighborhood(TestController):
         ThreadLocalORMSession.flush_all()
         self.app.get('/u/donald-duck/')
 
+    def test_disabled_user_has_no_user_project(self):
+        user = M.User.register(dict(username='donald-duck'))
+        self.app.get('/u/donald-duck/')  # assert it's there
+        M.User.query.update(dict(username='donald-duck'), {'$set': {'disabled': True}})
+        self.app.get('/u/donald-duck/', status=404)
+
+
     def test_more_projects_link(self):
         r = self.app.get('/adobe/adobe-1/admin/')
         link = r.html.find('div', {'class':'neighborhood_title_link'}).find('a')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d7846b25/Allura/allura/tests/model/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_auth.py b/Allura/allura/tests/model/test_auth.py
index 8fd0b65..9e0ff48 100644
--- a/Allura/allura/tests/model/test_auth.py
+++ b/Allura/allura/tests/model/test_auth.py
@@ -104,6 +104,13 @@ def test_user_project_already_deleted_creates_on_demand():
     assert M.Project.query.get(shortname='u/foobar123', deleted=False)
 
 @with_setup(setUp)
+def test_user_project_does_not_create_on_demand_for_disabled_user():
+    u = M.User.register(dict(username='foobar123', disabled=True), make_project=False)
+    ThreadLocalORMSession.flush_all()
+    assert not u.private_project()
+    assert not M.Project.query.get(shortname='u/foobar123')
+
+@with_setup(setUp)
 def test_project_role():
     role = M.ProjectRole(project_id=c.project._id, name='test_role')
     c.user.project_role().roles.append(role._id)


[13/14] git commit: [#5971] don't re-query the Users nbhd every time we look up a user-project

Posted by jo...@apache.org.
[#5971] don't re-query the Users nbhd every time we look up a user-project


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/53635e77
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/53635e77
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/53635e77

Branch: refs/heads/cj/5978
Commit: 53635e778f61d8a8a20f0205caa45eabdbe0d143
Parents: d7846b2
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Mar 28 19:12:50 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri Mar 29 15:23:59 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/auth.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/53635e77/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index ee9abec..5ccfd60 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -23,6 +23,7 @@ from ming.orm import session, state
 from ming.orm import FieldProperty, RelationProperty, ForeignIdProperty
 from ming.orm.declarative import MappedClass
 from ming.orm.ormsession import ThreadLocalORMSession
+from ming.utils import LazyProperty
 
 import allura.tasks.mail_tasks
 from allura.lib import helpers as h
@@ -583,6 +584,11 @@ class User(MappedClass, ActivityNode, ActivityObject):
                                user=user, user_project=True)
         return user
 
+    @LazyProperty
+    def neighborhood(self):
+        from allura import model as M
+        return M.Neighborhood.query.get(name='Users')
+
     def private_project(self):
         '''
         Returns the personal user-project for the user
@@ -591,7 +597,7 @@ class User(MappedClass, ActivityNode, ActivityObject):
             return None
 
         from allura import model as M
-        n = M.Neighborhood.query.get(name='Users')
+        n = self.neighborhood
         auth_provider = plugin.AuthenticationProvider.get(request)
         project_shortname = auth_provider.user_project_shortname(self)
         p = M.Project.query.get(shortname=project_shortname, neighborhood_id=n._id)


[05/14] git commit: [#5932] Fixed Invalid field error for removed _milestone_counts fields

Posted by jo...@apache.org.
[#5932] Fixed Invalid field error for removed _milestone_counts fields

Signed-off-by: Cory Johns <cj...@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/cbbd95ee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/cbbd95ee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/cbbd95ee

Branch: refs/heads/cj/5978
Commit: cbbd95eea81483cfd72a36072a56d38ea5f3b280
Parents: b5bc185
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Mar 27 20:11:49 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Mar 28 20:06:33 2013 +0000

----------------------------------------------------------------------
 ForgeTracker/forgetracker/model/ticket.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cbbd95ee/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index 1abeaac..686fd7d 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -53,6 +53,8 @@ class Globals(MappedClass):
     _bin_counts_data = FieldProperty([dict(summary=str, hits=int)])
     _bin_counts_expire = FieldProperty(datetime)
     _bin_counts_invalidated = FieldProperty(datetime)
+    _milestone_counts = FieldProperty(schema.Deprecated) #[dict(name=str,hits=int,closed=int)])
+    _milestone_counts_expire = FieldProperty(schema.Deprecated) #datetime)
     show_in_search = FieldProperty({str: bool}, if_missing={'ticket_num': True,
                                                             'summary': True,
                                                             '_milestone': True,


[06/14] git commit: Create a new JSON object for the ticket to import

Posted by jo...@apache.org.
Create a new JSON object for the ticket to import

If the imported JSON object doesn't have the correct structure we need
to create it.


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/e8161e69
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/e8161e69
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/e8161e69

Branch: refs/heads/cj/5978
Commit: e8161e69c103daed29313d626cb358c3423e46ed
Parents: 5a3ff20
Author: Jon Schewe <jp...@mtu.net>
Authored: Tue Mar 26 18:32:18 2013 -0500
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Mar 28 20:42:12 2013 +0000

----------------------------------------------------------------------
 scripts/allura_import.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e8161e69/scripts/allura_import.py
----------------------------------------------------------------------
diff --git a/scripts/allura_import.py b/scripts/allura_import.py
index e6982b2..60858ea 100644
--- a/scripts/allura_import.py
+++ b/scripts/allura_import.py
@@ -81,8 +81,11 @@ def import_tracker(cli, project, tool, import_options, options, doc_txt, validat
                 if options.verbose:
                     print 'Ticket id %d already exists, skipping' % ticket_in['id']
                 continue
-            doc['trackers']['default']['artifacts'] = [ticket_in]
-            res = cli.call(url, doc=json.dumps(doc), options=json.dumps(import_options))
+            doc_import={}
+            doc_import['trackers'] = {}
+            doc_import['trackers']['default'] = {}
+            doc_import['trackers']['default']['artifacts'] = [ticket_in]
+            res = cli.call(url, doc=json.dumps(doc_import), options=json.dumps(import_options))
             assert res['status'] and not res['errors']
             if options.validate:
                 if res['warnings']:


[10/14] git commit: [#5978] Fixed guess_repo being called for rendering SCM trees

Posted by jo...@apache.org.
[#5978] Fixed guess_repo being called for rendering SCM trees

Signed-off-by: Cory Johns <jo...@geek.net>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/789d7b84
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/789d7b84
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/789d7b84

Branch: refs/heads/cj/5978
Commit: 789d7b84c8ab02cc8616141d3fb2cc0e35520907
Parents: 699e9b8
Author: Cory Johns <jo...@geek.net>
Authored: Tue Mar 26 22:38:56 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Fri Mar 29 14:30:14 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/repo.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/789d7b84/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index 3df5f59..40f4567 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -532,6 +532,8 @@ class Tree(RepoObject):
             return []
         commit_ids = [e.commit_id for e in lcd.entries]
         commits = Commit.query.find(dict(_id={'$in': commit_ids}))
+        for commit in commits:
+            commit.set_context(self.repo)
         commit_infos = {c._id: c.info for c in commits}
         by_name = lambda n: n.name
         tree_names = sorted([n.name for n in self.tree_ids])


[14/14] git commit: [#5978] Fixed empty LCD info from double iteration of result set

Posted by jo...@apache.org.
[#5978] Fixed empty LCD info from double iteration of result set

Signed-off-by: Cory Johns <cj...@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/84665886
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/84665886
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/84665886

Branch: refs/heads/cj/5978
Commit: 84665886877d6f47e54ec0f0753d48619acf581a
Parents: 53635e7
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Fri Mar 29 16:54:53 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri Mar 29 16:55:18 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/repo.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/84665886/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index 85fa875..4d396b8 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -533,7 +533,7 @@ class Tree(RepoObject):
         if lcd is None:
             return []
         commit_ids = [e.commit_id for e in lcd.entries]
-        commits = Commit.query.find(dict(_id={'$in': commit_ids}))
+        commits = list(Commit.query.find(dict(_id={'$in': commit_ids})))
         for commit in commits:
             commit.set_context(self.repo)
         commit_infos = {c._id: c.info for c in commits}


[04/14] git commit: [#5951] Fixed AttributeError when _milestone field not of type milestone, and made behavior of all milestone-type field consistent

Posted by jo...@apache.org.
[#5951] Fixed AttributeError when _milestone field not of type milestone, and made behavior of all milestone-type field consistent

Signed-off-by: Cory Johns <cj...@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/5acf2ebe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/5acf2ebe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/5acf2ebe

Branch: refs/heads/cj/5978
Commit: 5acf2ebefaee838aadd465d7c76ddbeb3cb72b4a
Parents: ac4d60c
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Mar 27 18:41:35 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Mar 28 19:45:46 2013 +0000

----------------------------------------------------------------------
 .../forgetracker/templates/tracker/ticket.html     |    2 +
 ForgeTracker/forgetracker/widgets/ticket_form.py   |   18 ++++++++------
 2 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5acf2ebe/ForgeTracker/forgetracker/templates/tracker/ticket.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker/ticket.html b/ForgeTracker/forgetracker/templates/tracker/ticket.html
index 1d229fe..333b371 100644
--- a/ForgeTracker/forgetracker/templates/tracker/ticket.html
+++ b/ForgeTracker/forgetracker/templates/tracker/ticket.html
@@ -88,6 +88,8 @@
                 {% else %}
                   nobody
                 {% endif %}
+              {% elif field.type == 'milestone' %}
+                <a href="{{c.app.url}}{{field.name[1:]}}/{{ticket.custom_fields[field.name]}}">{{ticket.custom_fields[field.name]}}</a>
               {% else %}
                 {{ticket.custom_fields[field.name]}}
               {% endif %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5acf2ebe/ForgeTracker/forgetracker/widgets/ticket_form.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/widgets/ticket_form.py b/ForgeTracker/forgetracker/widgets/ticket_form.py
index 465dce5..aaba037 100644
--- a/ForgeTracker/forgetracker/widgets/ticket_form.py
+++ b/ForgeTracker/forgetracker/widgets/ticket_form.py
@@ -37,13 +37,7 @@ class GenericTicketForm(ew.SimpleForm):
     def display_field_by_name(self, idx, ignore_errors=False):
         field = self.fields[idx]
         ctx = self.context_for(field)
-        if idx == '_milestone':
-            milestone_value = ctx.value
-            for milestone in reversed(field.options):  # reverse so del hits the correct indexes
-                if milestone.complete and (milestone.py_value != milestone_value):
-                    del field.options[field.options.index(milestone)]
-            ctx = self.context_for(field)
-        elif idx == 'assigned_to':
+        if idx == 'assigned_to':
             self._add_current_value_to_user_field(field, ctx.get('value'))
         elif idx == 'custom_fields':
             for cf in c.app.globals.custom_fields:
@@ -154,7 +148,7 @@ class TicketCustomField(object):
                 py_value=m.name,
                 complete=bool(m.complete)))
 
-        ssf = ew.SingleSelectField(
+        ssf = MilestoneField(
             label=field.label, name=str(field.name),
             options=options)
         return ssf
@@ -183,3 +177,11 @@ class TicketCustomField(object):
     def make(cls, field):
         factory = cls.SELECTOR.get(field.get('type'), cls._default)
         return factory(field)
+
+class MilestoneField(ew.SingleSelectField):
+    def display(self, *args, **kwargs):
+        milestone_value = kwargs['value']
+        for milestone in reversed(self.options):  # reverse so del hits the correct indexes
+            if milestone.complete and (milestone.py_value != milestone_value):
+                del self.options[self.options.index(milestone)]
+        return super(MilestoneField, self).display(*args, **kwargs)


[07/14] git commit: Check if the document to import has trackers or is just a list of tickets

Posted by jo...@apache.org.
Check if the document to import has trackers or is just a list of
tickets

When exporting with trac_export.py the tickets are the top level list of
objects in the JSON dump.


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/5a3ff203
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/5a3ff203
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/5a3ff203

Branch: refs/heads/cj/5978
Commit: 5a3ff203beeab56516d812886a74a3a8a61893d4
Parents: 5c07930
Author: Jon Schewe <jp...@mtu.net>
Authored: Tue Mar 26 18:30:15 2013 -0500
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Mar 28 20:42:12 2013 +0000

----------------------------------------------------------------------
 scripts/allura_import.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5a3ff203/scripts/allura_import.py
----------------------------------------------------------------------
diff --git a/scripts/allura_import.py b/scripts/allura_import.py
index 1dd151c..e6982b2 100644
--- a/scripts/allura_import.py
+++ b/scripts/allura_import.py
@@ -66,8 +66,13 @@ def import_tracker(cli, project, tool, import_options, options, doc_txt, validat
             existing_map[t['ticket_num']] = t['summary']
 
     doc = json.loads(doc_txt)
-    tickets_in = doc['trackers']['default']['artifacts']
-    doc['trackers']['default']['artifacts'] = []
+
+    if 'trackers' in doc and 'default' in doc['trackers'] and 'artifacts' in doc['trackers']['default']:
+        tickets_in = doc['trackers']['default']['artifacts']
+        doc['trackers']['default']['artifacts'] = []
+    else:
+        tickets_in = doc
+        
     if options.verbose:
         print "Processing %d tickets" % len(tickets_in)
 


[11/14] git commit: [#5978] Fixed call to guess_repo in History view and log any other calls as errors

Posted by jo...@apache.org.
[#5978] Fixed call to guess_repo in History view and log any other calls as errors

Signed-off-by: Cory Johns <cj...@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/34729f5c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/34729f5c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/34729f5c

Branch: refs/heads/cj/5978
Commit: 34729f5cc504c027115f251f91f5ad67b8a286f2
Parents: 789d7b8
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu Mar 28 22:09:19 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Fri Mar 29 14:30:15 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py |    6 +++++-
 Allura/allura/model/repo.py             |    2 ++
 2 files changed, 7 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/34729f5c/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index e110e10..bbfb307 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -470,7 +470,11 @@ class CommitBrowser(BaseController):
         next_commit = None
         if len(commits) > limit:
             next_commit = M.repo.Commit.query.get(_id=commits.pop())
-        revisions = sorted(M.repo.Commit.query.find({'_id': {'$in': commits}}), key=lambda c:commits.index(c._id))
+            next_commit.set_context(c.app.repo)
+        revisions = list(M.repo.Commit.query.find({'_id': {'$in': commits}}))
+        for commit in revisions:
+            commit.set_context(c.app.repo)
+        revisions = sorted(revisions, key=lambda c:commits.index(c._id))
         c.log_widget = self.log_widget
         return dict(
             username=c.user._id and c.user.username,

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/34729f5c/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index 40f4567..85fa875 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -231,6 +231,8 @@ class Commit(RepoObject):
         return self.repo.url_for_commit(self)
 
     def guess_repo(self):
+        import traceback
+        log.error('guess_repo: should not be called: %s' % ''.join(traceback.format_stack()))
         for ac in c.project.app_configs:
             try:
                 app = c.project.app_instance(ac)


[03/14] git commit: [#5951] Display closed milestones in an optgroup

Posted by jo...@apache.org.
[#5951] Display closed milestones in an optgroup

Signed-off-by: Cory Johns <cj...@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/b5bc1858
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/b5bc1858
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/b5bc1858

Branch: refs/heads/cj/5978
Commit: b5bc1858daa093d1ce7b2b6c6026039af6fdcf09
Parents: 5acf2eb
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Mar 27 19:56:22 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Mar 28 19:45:46 2013 +0000

----------------------------------------------------------------------
 .../forgetracker/tests/functional/test_root.py     |   19 ++++++--
 ForgeTracker/forgetracker/widgets/ticket_form.py   |   36 ++++++++++++---
 2 files changed, 44 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b5bc1858/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index b7f4ae2..d638cf8 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -116,16 +116,25 @@ class TestMilestones(TrackerTestController):
         }
         self.app.post('/bugs/update_milestones', d)
         r = self.app.get('/bugs/1/')
+        closed = r.html.find('optgroup', label='Closed')
+        assert closed
+        closed = str(closed)
         assert '<option selected value="1.0">1.0</option>' in r
+        assert '<option selected value="1.0">1.0</option>' not in closed
         assert '<option value="2.0">2.0</option>' in r
-        assert '<option value="3.0">3.0</option>' not in r
-        assert '<option value="4.0">4.0</option>' not in r
+        assert '<option value="2.0">2.0</option>' not in closed
+        assert '<option value="3.0">3.0</option>' in closed
+        assert '<option value="4.0">4.0</option>' in closed
         r = self.app.get('/bugs/new/')
+        closed = r.html.find('optgroup', label='Closed')
+        assert closed
+        closed = str(closed)
         assert '<option selected value="1.0">1.0</option>' not in r
-        assert '<option value="1.0">1.0</option>' not in r
+        assert '<option value="1.0">1.0</option>' in closed
         assert '<option value="2.0">2.0</option>' in r
-        assert '<option value="3.0">3.0</option>' not in r
-        assert '<option value="4.0">4.0</option>' not in r
+        assert '<option value="2.0">2.0</option>' not in closed
+        assert '<option value="3.0">3.0</option>' in closed
+        assert '<option value="4.0">4.0</option>' in closed
 
 
 def post_install_create_ticket_permission(app):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b5bc1858/ForgeTracker/forgetracker/widgets/ticket_form.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/widgets/ticket_form.py b/ForgeTracker/forgetracker/widgets/ticket_form.py
index aaba037..4394fbb 100644
--- a/ForgeTracker/forgetracker/widgets/ticket_form.py
+++ b/ForgeTracker/forgetracker/widgets/ticket_form.py
@@ -179,9 +179,33 @@ class TicketCustomField(object):
         return factory(field)
 
 class MilestoneField(ew.SingleSelectField):
-    def display(self, *args, **kwargs):
-        milestone_value = kwargs['value']
-        for milestone in reversed(self.options):  # reverse so del hits the correct indexes
-            if milestone.complete and (milestone.py_value != milestone_value):
-                del self.options[self.options.index(milestone)]
-        return super(MilestoneField, self).display(*args, **kwargs)
+    template=ew.Snippet('''<select {{widget.j2_attrs({
+               'id':id,
+               'name':rendered_name,
+               'multiple':multiple,
+               'class':css_class},
+               attrs)}}>
+            {% for o in open_milestones %}
+            <option{% if o.selected%} selected{% endif %} value="{{o.html_value}}">{{o.label|e}}</option>
+            {% endfor %}
+            {% if closed_milestones %}
+            <optgroup label="Closed">
+                {% for o in closed_milestones %}
+                <option{% if o.selected%} selected{% endif %} value="{{o.html_value}}">{{o.label|e}}</option>
+                {% endfor %}
+            </optgroup>
+            {% endif %}
+        </select>''', 'jinja2')
+
+    def prepare_context(self, context):
+        context = super(MilestoneField, self).prepare_context(context)
+
+        # group open / closed milestones
+        context['open_milestones'] = [opt for opt in self.options if not opt.complete]
+        context['closed_milestones'] = [opt for opt in self.options if opt.complete]
+
+        # filter closed milestones entirely
+        #value = context['value']
+        #context['options'] = [opt for opt in self.options if not opt.complete or value == opt.py_value]
+
+        return context


[08/14] git commit: Output the URL being used to import tickets when verbose is turned on

Posted by jo...@apache.org.
Output the URL being used to import tickets when verbose is turned on


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/5c079303
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/5c079303
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/5c079303

Branch: refs/heads/cj/5978
Commit: 5c079303c38f33edb1f603ea6f4f02ccc2f01506
Parents: cbbd95e
Author: Jon Schewe <jp...@mtu.net>
Authored: Tue Mar 26 18:26:43 2013 -0500
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Thu Mar 28 20:42:12 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/import_api.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5c079303/Allura/allura/lib/import_api.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/import_api.py b/Allura/allura/lib/import_api.py
index 365532d..ea07756 100644
--- a/Allura/allura/lib/import_api.py
+++ b/Allura/allura/lib/import_api.py
@@ -30,6 +30,9 @@ class AlluraImportApiClient(object):
 
     def call(self, url, **params):
         url = urlparse.urljoin(self.base_url, url)
+        if self.verbose:
+            print "Using URL '%s'" % (url)
+        
         params = self.sign(urlparse.urlparse(url).path, params.items())
 
         while True:


[09/14] git commit: [#6020] ok to have a print in import_api.py

Posted by jo...@apache.org.
[#6020] ok to have a print in import_api.py


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/699e9b88
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/699e9b88
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/699e9b88

Branch: refs/heads/cj/5978
Commit: 699e9b88093a24ea0d683c80a2a09f6bc2a8c329
Parents: e8161e6
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Mar 28 21:25:00 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Mar 28 21:25:00 2013 +0000

----------------------------------------------------------------------
 AlluraTesting/alluratest/test_syntax.py |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/699e9b88/AlluraTesting/alluratest/test_syntax.py
----------------------------------------------------------------------
diff --git a/AlluraTesting/alluratest/test_syntax.py b/AlluraTesting/alluratest/test_syntax.py
index a3f7a4a..902574d 100644
--- a/AlluraTesting/alluratest/test_syntax.py
+++ b/AlluraTesting/alluratest/test_syntax.py
@@ -65,10 +65,9 @@ def test_no_prints():
         'Allura/ldap-setup.py',
         'Allura/ldap-userconfig.py',
         'Allura/ez_setup/',
-        'Allura/push_re.py',
         'Allura/allura/lib/AsciiDammit.py',
         '/scripts/',
-        'ForgeMail/forgemail/sstress.py',
+        'Allura/allura/lib/import_api.py',
     ]
     if run(find_py + " | grep -v '" + "' | grep -v '".join(skips) + "' | xargs grep -v '^ *#' | grep 'print ' | grep -E -v '(pprint|#pragma: ?printok)' ") != 1:
         raise Exception("These should use logging instead of print")


[02/14] git commit: [#5951] Fixed javascript error when adding milestones on field management page

Posted by jo...@apache.org.
[#5951] Fixed javascript error when adding milestones on field management page

Signed-off-by: Cory Johns <cj...@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/ac4d60c3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ac4d60c3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ac4d60c3

Branch: refs/heads/cj/5978
Commit: ac4d60c3cd4d7b9bbb648a742d87f8f8b20c6764
Parents: 6f44f8a
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Mar 27 17:24:16 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Thu Mar 28 19:45:45 2013 +0000

----------------------------------------------------------------------
 .../resources/js/sortable_repeated_field.js        |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ac4d60c3/Allura/allura/lib/widgets/resources/js/sortable_repeated_field.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/sortable_repeated_field.js b/Allura/allura/lib/widgets/resources/js/sortable_repeated_field.js
index 251274c..7b46bef 100644
--- a/Allura/allura/lib/widgets/resources/js/sortable_repeated_field.js
+++ b/Allura/allura/lib/widgets/resources/js/sortable_repeated_field.js
@@ -79,7 +79,7 @@
                 .removeClass(self.opts.stub_cls)
                 .addClass(self.opts.field_cls)
                 .show()
-                .find(':input[name^='+tpl_name+']').each(function() {
+                .find(':input[name^="'+tpl_name+'"]').each(function() {
                     var $this = $(this);
                     var name = $this.attr('name');
                     if(name){
@@ -120,7 +120,7 @@
             var prefix = self.fld_name() + '-';
             var regex = new RegExp(prefix + /\d+/.source)
             self.data.$flist.children().each(function(index) {
-                $(this).find(':input[name^='+prefix+']').each(function() {
+                $(this).find(':input[name^="'+prefix+'"]').each(function() {
                     var $this=$(this);
                     var name=$this.attr('name');
                     var newname = name.replace(regex, prefix + index);