And this comes from included.rst.
It even includes
- markup
- and all that hazz
class User(models.Model): | |
def __getattr__(self, attr): | |
for profile in self.profiles: | |
try: | |
return getattr(profile, attr) | |
except AttributeError: | |
continue | |
raise AttributeError |
""" | |
Teeny-tiny GitHub API wrapper (just for the bits this app needs). | |
All that this does is expose a `requests.session` that makes it easy to | |
access GitHub, like so:: | |
>>> with github.session() as gh: | |
... resp = gh.get('repos/django/django') | |
.. print resp.keys() |
#!/usr/bin/env python | |
""" | |
Install a package from your local pip download cache without having to touch | |
the 'net at all. | |
You'll need to be using a pip download cache; that is, you'll need the | |
following in your ~/.pip/pip.cfg: | |
[install] |
import glob | |
import gzip | |
def top_paths(filename): | |
# Count the top paths in a single gziped file | |
counts = {} | |
with gzip.open(filename) as f: | |
for line in f: | |
path = line.split()[6] | |
counts[path] = counts.get(path, 0) + 1 |
@transaction.commit_manually | |
def foo(): | |
db.execute("SELECT ...") | |
bar() | |
db.execute("SELECT ...") | |
transaction.commit() | |
def bar(): | |
db.execute("INSERT ...") |
web: gunicorn -w4 -b0.0.0.0:$PORT app:app |
And this comes from included.rst.
It even includes
- markup
- and all that hazz
digraph CreateView { | |
// Basic graph, node, and edge styling. | |
splines="true"; | |
ranksep=0.5; | |
node [shape="box", style="rounded" fontsize="11", height="0.4", fontname="MetaPro"]; | |
edge [headport="n"]; | |
// Graph title - \G means "title of the graph"; the \ns are the only way | |
// I can find to visuall separate the title from the rest of the graph. |
PyCon 2013, occurring once again in sunny Santa Clara, California, will now be accepting all types of proposals through MONTH DAY, 2012. As with years past, we're looking forward to receiving your best proposals for tutorials, talks, and posters.
The 2013 conference will run from XXXXXX to YYYYY at the Santa Clara Convention Center, just 15 minutes from San Jose, and one hour from San Francisco. On the schedule we have the main conference running Friday XXX through Sunday XXXXX, which is preceded by two days of tutorials and followed up by four days of sprints.
Continuing a trend started years ago, attendance records were once again broken last year, and the schedule was the best we've assembled. Can you help us top 2012?
import os | |
import barrel | |
REALM = "PRIVATE" | |
USERS = [('jacob', 'hunter2')] | |
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings") | |
from django.core.wsgi import get_wsgi_application | |
application = barrel.cooper.basicauth(users=USERS, realm=REALM)(get_wsgi_application()) |