Skip to content

Instantly share code, notes, and snippets.

@jacobian
jacobian / rst.py
Created January 15, 2010 21:41
My custom reStructuredText rendering tag for my blog
from django import template
from django.utils.encoding import smart_str, force_unicode
from django.utils.safestring import mark_safe
import docutils.nodes
from docutils.core import publish_parts
from docutils.writers import html4css1
register = template.Library()
def restructuredtext(value):
def print_name(for_user):
print "name is %s" % for_user
print_name(for_user="Travis Swicegood")

Lightning Talks - Friday PM

  1. Jacob Kaplan-Moss - How to give a lightning talk
  2. Van Lindberg - What Open Source lawyers do
  3. Greg Wilson - The Next Great Programing Book
  4. Moshe Zadke - Don't write big applications
  5. Ned Batchelder - What's new in coverage.py
  6. Mike MacCana - Docx - 100% native MSWord
  7. Trent Mick - Python Cookbook online

Lightning talks - Sunday AM

  1. Tim Cooper - Postgres-Python
  2. Gregg Lind - Print spring clean
  3. Natalia Bidart - Python Argentina
  4. David Huggins-Daines - You got Cython in my NumPy
  5. Ken Elkabany - Cloud Computing with Python

Overflow:

Lightning talks - Sunday PM

  1. Michael Foord - A little bit of Python
  2. Harald A. Massu - The real harm of functional programming modules
  3. Carl Trachte - BSD certification / Python BSD OS modules
  4. Pete Fein - Please pirate: intellectual unproperty
  5. Katie Cunningham - Something awesome
  6. Chris McDonough - Self-publishing a book
  7. Chris Petrilli - Celery: be lazy
  8. Godfroid Chapelle - VinPDB
#### settings.py
TEMPLATE_DIRS = [
"/Users/jacob/Revsys/Training/yabl/templates",
]
#### yabl/urls.py
from django.conf.urls.defaults import *
#### yabl/authors/views.py --- create view
def create(request):
if request.method == 'POST':
form = AuthorForm(request.POST)
if form.is_valid():
author = form.save()
return redirect("author_detail", author.id)
else:
form = AuthorForm()
{% extends "base.html" %}
{% block content %}
<h1>Log in:</h1>
<form action="" method="post">
{{ form.as_p }}
<input type="hidden" name="next" value="/authors/">
<input type="submit">
</form>
{% endblock content %}
def build_dsn(dbtype, params):
"""
Build a DSN-style connection string, a la:
postgres://dbname=jacob,dbpass=sekreit
Returns a string.
"""
args = ",".join(["%s=%s" % (k,v) for (k,v) in params.items()])
return "%s://%s" % (dbtype, args)
##### yabl/settings.py
ROOT_URLCONF = 'yabl.urls'
TEMPLATE_DIRS = (
"/Users/jacob/training/yabl/templates",
)
##### yabl/urls.py