This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import importlib, os | |
APP_DIRS = (os.path.abspath(os.path.join(PROJECT_ROOT, 'test')),) | |
sys.path.extend(APP_DIRS) | |
BASE_URL_CONFS = [] | |
for app_dir in APP_DIRS: | |
for app in os.listdir(app_dir): | |
if not app.startswith('.') and app not in INSTALLED_APPS: | |
try: | |
app_settings = importlib.import_module('%s.settings' % app) | |
if getattr(app_settings, 'APP_NAME', '') != '': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends 'base.html' %} | |
{% block extrahead %} | |
{% block blog_extrahead %}{% endblock %} | |
{% endblock %} | |
{% block content %} | |
{% block blog_content %}{% endblock %} | |
{% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
designed as a functional replacement to james benne | |
eliminates need for app.templatetags | |
all arguments/kwargs are resolved by default | |
comparisons | |
if some comparison, do somethin, otherwise do s | |
add negate at the end of the tag to do the oppo | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import yapgvb | |
graph = yapgvb.Digraph('OriginalZombie') | |
rows = list(csv.DictReader(open('players.csv'))) | |
def get_victims(id): | |
for row in rows: | |
if id == row['killed_by']: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INT1675:project jquick$ ./manage.py snag "http://news.google.com/news?ned=us&topic=w&output=rss" | |
Aggregating: http://news.google.com/news?ned=us&topic=w&output=rss | |
Traceback (most recent call last): | |
File "./manage.py", line 11, in <module> | |
execute_manager(settings) | |
File "/Users/jquick/Downloads/django/django/core/management/__init__.py", line 438, in execute_manager | |
utility.execute() | |
File "/Users/jquick/Downloads/django/django/core/management/__init__.py", line 379, in execute | |
self.fetch_command(subcommand).run_from_argv(self.argv) | |
File "/Users/jquick/Downloads/django/django/core/management/base.py", line 195, in run_from_argv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fri Mar 19 12:40:28 2010 mongol/profiles/top.map.prof | |
1431399 function calls in 9.726 CPU seconds | |
Ordered by: internal time | |
List reduced from 127 to 20 due to restriction <20> | |
ncalls tottime percall cumtime percall filename:lineno(function) | |
75273 3.709 0.000 3.709 0.000 {zlib.compress} | |
75273 2.108 0.000 2.108 0.000 {cPickle.dumps} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def latest_objects_by_category(category, app_label, model_name, set_name, date_field='pub_date'): | |
from django.db.models import get_model | |
from categories import registry | |
from categories.models import Category | |
if isinstance(category, basestring): | |
category = Category.objects.get(slug=category) | |
m = get_model(app_label, model_name) | |
fk = hasattr(category, 'primary_%s_set'%set_name) and getattr(category, 'primary_%s_set'%set_name).all() or set() | |
m2m = hasattr(category, '%s_set'%set_name) and getattr(category, '%s_set'%set_name).all() or set() | |
results = fk | m2m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: from ellington.categories.models import Category | |
In [2]: Category | |
Out[2]: <class 'ellington.categories.models.Category'> | |
In [3]: dir(Category) | |
Out[3]: | |
['DoesNotExist', | |
'MultipleObjectsReturned', | |
'__class__', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "setup.py", line 37, in <module> | |
'Topic :: Software Development :: Libraries :: Python Modules', | |
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/core.py", line 152, in setup | |
dist.run_commands() | |
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py", line 975, in run_commands | |
self.run_command(cmd) | |
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py", line 995, in run_command | |
cmd_obj.run() | |
File "build/bdist.linux-i686/egg/setuptools/command/install.py", line 76, in run |
OlderNewer