allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [11/50] git commit: [#6526] Handle c not having 'project' attr
Date Thu, 05 Sep 2013 18:20:36 GMT
[#6526] Handle c not having 'project' attr

Signed-off-by: Tim Van Steenburgh <tvansteenburgh@gmail.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/9704ca5c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/9704ca5c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/9704ca5c

Branch: refs/heads/cj/6596
Commit: 9704ca5cfc8e6e17622e60094bf48322effc55ea
Parents: 9065167
Author: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Authored: Wed Aug 28 15:48:14 2013 +0000
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Wed Aug 28 15:48:14 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/validators.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9704ca5c/Allura/allura/lib/validators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/validators.py b/Allura/allura/lib/validators.py
index 3295bb0..9d15429 100644
--- a/Allura/allura/lib/validators.py
+++ b/Allura/allura/lib/validators.py
@@ -90,7 +90,8 @@ class MountPointValidator(fev.UnicodeString):
         if mount_point in self.reserved_mount_points:
             raise fe.Invalid('Mount point "%s" is reserved' % mount_point,
                     value, state)
-        if c.project and c.project.app_instance(mount_point) is not None:
+        if (getattr(c, 'project', None) and
+                c.project.app_instance(mount_point) is not None):
             raise fe.Invalid('Mount point "%s" is already in use' % mount_point,
                     value, state)
         return mount_point
@@ -99,7 +100,8 @@ class MountPointValidator(fev.UnicodeString):
         base_mount_point = mount_point = self.app_class.default_mount_point
         i = 0
         while True:
-            if not c.project or c.project.app_instance(mount_point) is None:
+            if (not getattr(c, 'project', None) or
+                    c.project.app_instance(mount_point) is None):
                 return mount_point
             mount_point = base_mount_point + '-%d' % i
             i += 1


Mime
View raw message