Skip to content
Browse files

various updates

  • Loading branch information...
1 parent 7e6077b commit 24a4b950634b6192a10ab595ce57f82f8454c6cf @nikcub committed Sep 13, 2011
Showing with 69 additions and 19 deletions.
  1. +1 −0 README.md
  2. +0 −1 buckley/controller.py
  3. +5 −5 buckley/controllers/__init__.py
  4. +24 −0 buckley/models/group.py
  5. +1 −0 buckley/models/post.py
  6. +18 −0 buckley/models/test.py
  7. +7 −0 buckley/models/user.py
  8. +13 −13 main.py
View
1 README.md
@@ -41,3 +41,4 @@ Easy!
@TODO comments / users / moderation
@TODO multi templates
@TODO support multiple URLs (ie. stub changed) with list of 'old' to match and redirect
+@TODO timezone support with pytz (import pytz)
View
1 buckley/controller.py
@@ -91,7 +91,6 @@ def get_response_type(self):
if not self.request.headers.has_key('accept'):
return 'html'
-
accept = self.request.headers['accept'].split(',')
if accept[0] == 'application/json' or self.request.get('json'):
return 'json'
View
10 buckley/controllers/__init__.py
@@ -1,7 +1,7 @@
from posts import *
-# from archive import *
-# from feed import *
-# from pages import *
-# from projects import *
-# from admin import *
+from archive import *
+from feed import *
+from pages import *
+from projects import *
+from admin import *
View
24 buckley/models/group.py
@@ -0,0 +1,24 @@
+
+class Group(db.Model):
+ name = db.StringProperty()
+
+
+class Membership(db.Model):
+ user = db.ReferenceProperty(User)
+ group = db.ReferenceProperty(Group)
+ group_name = db.StringProperty()
+
+ def put(self):
+ self.group_name = self.group.name
+ super(Membership, self).put()
+
+ def get_group(self, name):
+ return [n.group for n in user.membership_set.order('group_name')]
+
+ @classmethod
+ def create(username, groupname):
+ Super(Membership, user = username, group = groupname).put()
+ # Membership.get_or_insert(key_name = "%s-%s" % (user.key(), group.key()), user = user, group = group).put()
+
+
+
View
1 buckley/models/post.py
@@ -92,6 +92,7 @@ def get_month(month, year):
if not month:
month = datetime.datetime.now().month
if not year:
+
year = datetime.datetime.now().year
@classmethod
View
18 buckley/models/test.py
@@ -0,0 +1,18 @@
+
+class Comment(db.Model):
+ name = db.StringProperty()
+ email = db.StringProperty()
+ content = db.TextProperty()
+ pubdate = db.DateTimeProperty(auto_now_add=True)
+ views = db.IntegerProperty(default=0)
+
+ def get_views(self):
+ viewcount = self.views
+ viewcount_cache = memcache.get('test-views-' + self.key().name(), self.key().kind())
+ if viewcount_cache:
+ viewcount += viewcount_cache
+ return viewcount
+
+ @classmethod
+ def flush_views(cls, name):
+ te
View
7 buckley/models/user.py
@@ -0,0 +1,7 @@
+
+# todo inherit from built in user property support twitter et al
+
+class User(db.Model):
+ name = db.StringProperty()
+ email = db.StringProperty()
+ author = db.UserProperty()
View
26 main.py
@@ -8,19 +8,19 @@
routes = [
- # ('/admin/posts/(.*)/(.*)', controllers.admin.Posts),
- # ('/admin/posts/(.*)', controllers.admin.Posts),
- # ('/admin/posts', controllers.admin.Posts),
- # ('/admin/pages/(.*)/(.*)', controllers.admin.Pages),
- # ('/admin/pages/(.*)', controllers.admin.Pages),
- # ('/admin/pages', controllers.admin.Pages),
- # ('/admin/settings', controllers.admin.Settings),
- # ('/admin(.*)', controllers.admin.Settings),
- #
- # ('/feed(.*)', controllers.Feeds),
- # ('/archive(.*)', controllers.Archives),
- # ('/projects(.*)', controllers.Projects),
- # ('/posts(.*)', controllers.posts.Index),
+ ('/admin/posts/(.*)/(.*)', controllers.admin.Posts),
+ ('/admin/posts/(.*)', controllers.admin.Posts),
+ ('/admin/posts', controllers.admin.Posts),
+ ('/admin/pages/(.*)/(.*)', controllers.admin.Pages),
+ ('/admin/pages/(.*)', controllers.admin.Pages),
+ ('/admin/pages', controllers.admin.Pages),
+ ('/admin/settings', controllers.admin.Settings),
+ ('/admin(.*)', controllers.admin.Settings),
+
+ ('/feed(.*)', controllers.Feeds),
+ ('/archive(.*)', controllers.Archives),
+ ('/projects(.*)', controllers.Projects),
+ ('/posts(.*)', controllers.posts.Index),
('/(.*)', controllers.posts.Index)
]

0 comments on commit 24a4b95

Please sign in to comment.
Something went wrong with that request. Please try again.