Browse files

reviewed popcorn views and models

  • Loading branch information...
cmcavoy committed May 18, 2012
1 parent 4c0642d commit e9066907a0afc0aabe1985312f0de44feeba1d21
Showing with 14 additions and 0 deletions.
  1. +2 −0
  2. +8 −0 popcorn_gallery/popcorn/
  3. +4 −0 popcorn_gallery/popcorn/views/
@@ -66,6 +66,8 @@ Add a host alias
This is done so ou can access the application via:
+# @brianloveswords from openbadges has a clever hack for this which doesn't require a /etc/hosts addition. FYI.
Add to /etc/hosts in your local machine:
@@ -13,6 +13,10 @@
def get_templates(prefix='butter', extension=None):
"""List the files with the given extension"""
+ """Anything that walks the filesystem like this could end up being
+ a big bottleneck. if you anticipate this being something you call a lot,
+ I'd suggest indexing the files in a database table. at a minimum, you could dump
+ the results of this query in cache. the better option is to index in a db table"""
template_choices = []
if extension:
extension = '.%s' % extension
@@ -77,6 +81,10 @@ class Project(models.Model):
metadata = models.TextField()
html = models.TextField()
status = models.IntegerField(choices=STATUS_CHOICES, default=LIVE)
+ """you're doing some complicated stuff to determine if the project is
+ published, but then using basic booleans for features. Maybe foreign key to status
+ here and treat these as @property methods? I could go either way, just think the
+ variations in published / unpublished vs these other booleans is complicated"""
is_shared = models.BooleanField(default=True)
is_forkable = models.BooleanField(default=True)
is_removed = models.BooleanField(default=False)
@@ -15,6 +15,7 @@
def valid_user_project(func):
"""Decorator that makes sure the project is active and valid"""
+ """nice..."""
def wrapper(request, *args, **kwargs):
username = kwargs.pop('username')
@@ -145,6 +146,9 @@ def template_list(request, slug=None):
def template_detail(request, slug):
+ """this block, grabbing a template and raising 404 if it doesn't exist,
+ happens a bunch of times. You can DRY it out with class based views if you're
+ feeling brave."""
template =
except Template.DoesNotExist:

0 comments on commit e906690

Please sign in to comment.