incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [16/50] [abbrv] git commit: [#6056] Fixed _lookup error in ForgeBlog
Date Thu, 11 Jul 2013 21:58:36 GMT
[#6056] Fixed _lookup error in ForgeBlog

Signed-off-by: Cory Johns <cjohns@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/8e1581e5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/8e1581e5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/8e1581e5

Branch: refs/heads/db/6277
Commit: 8e1581e5ab3a696bb81560f8fb994891c0a3b36f
Parents: 4358701
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Mon Jul 1 21:41:13 2013 +0000
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Sun Jul 7 03:48:41 2013 +0000

----------------------------------------------------------------------
 ForgeBlog/forgeblog/main.py                       | 4 +++-
 ForgeBlog/forgeblog/tests/functional/test_root.py | 6 +++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8e1581e5/ForgeBlog/forgeblog/main.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/main.py b/ForgeBlog/forgeblog/main.py
index 24b0bf2..0b9ff70 100644
--- a/ForgeBlog/forgeblog/main.py
+++ b/ForgeBlog/forgeblog/main.py
@@ -261,7 +261,9 @@ class RootController(BaseController, FeedController):
         return dict()
 
     @expose()
-    def _lookup(self, year, month, name, *rest):
+    def _lookup(self, year=None, month=None, name=None, *rest):
+        if year is None or month is None or name is None:
+            raise exc.HTTPNotFound()
         slug = '/'.join((year, month, urllib2.unquote(name).decode('utf-8')))
         post = BM.BlogPost.query.get(slug=slug, app_config_id=c.app.config._id)
         if post is None:

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8e1581e5/ForgeBlog/forgeblog/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/tests/functional/test_root.py b/ForgeBlog/forgeblog/tests/functional/test_root.py
index 3c13a69..4409b33 100644
--- a/ForgeBlog/forgeblog/tests/functional/test_root.py
+++ b/ForgeBlog/forgeblog/tests/functional/test_root.py
@@ -17,6 +17,7 @@
 
 import datetime
 
+from nose.tools import assert_equal
 from ming.orm.ormsession import ThreadLocalORMSession
 from mock import patch
 
@@ -203,7 +204,6 @@ class TestRootController(TestController):
         response = self.app.get('/blog/feed')
         assert '&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;sometext&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;'
in response
 
-
     def test_related_artifacts(self):
         self._post(title='one')
         d = self._blog_date()
@@ -213,3 +213,7 @@ class TestRootController(TestController):
         r= self.app.get('/blog/%s/one/' % d)
         assert 'Related' in r
         assert 'Blog Post: %s/two' % d in r
+
+    def test_invalid_lookup(self):
+        r = self.app.get('/blog/favicon.ico', status=404)
+        assert_equal(r.status_int, 404)


Mime
View raw message