I hereby claim:
- I am philipn on github.
- I am philipn (https://keybase.io/philipn) on keybase.
- I have a public key whose fingerprint is 996B 2D31 DBDC 8734 9019 3199 1319 9280 9EB7 3975
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
""" | |
A replacement for the django-compressor `compress` management command that renders all | |
templates with each `LANGUAGE_CODE` available in your `settings.LANGUAGES`. | |
Useful for making static-i18n work with django-compressor, among other things. | |
""" | |
import os | |
from os.path import join | |
import json |
# This is a basic VCL configuration file for varnish. See the vcl(7) | |
# man page for details on VCL syntax and semantics. | |
# | |
# Default backend definition. Set this to point to your content | |
# server. | |
# | |
backend cloudmade { | |
# cloudmade tiles | |
#.host = "c.tile.cloudmade.com"; | |
.host = "54.230.151.226"; |
import slumber | |
import requests | |
import os | |
import lxml.html | |
import urllib | |
from urlparse import urljoin | |
from utils import all, quote_fs | |
SITE = 'https://trianglewiki.org' |
class AllowFieldLimitingMixin(object): | |
""" | |
A mixin for a generic APIView that will allow the serialized fields to be | |
limited to a set of comma-separated values, specified via the `fields` | |
query parameter. This will only apply to GET requests. | |
""" | |
_serializer_class_for_fields = {} | |
def get_serializer_class_for_fields(self, serializer_class, fields): | |
fields = fields.strip().split(',') |
You don't have to be a slave to OS X! Here's a guide to a sane dual-booting setup with Ubuntu 12.10 on your shiny MacBook Air. This is written and tested for a MacBook Air 5,2 (Mid 2012), but likely works the same with any modern Macbook.
Install according to instructions at this URL:
If you've customized your CSS or otherwise altered your site/base.html
template you'll want to do the following:
Back up your old base.html template:
sudo cp /usr/share/localwiki/templates/site/base.html ~/base.html.bak
Now just remove the base.html template:
sudo rm /usr/share/localwiki/templates/site/base.html
# This is an example .wsgi file for serving up localwiki inside of a | |
# custom virtualenv. | |
# | |
############################################################# | |
# CHANGE THIS LINE to the absolute path of the virtualenv: | |
############################################################# | |
VIRTUAL_ENV_PATH = '/home/philip/projects/py_envs/localwiki' | |
import os | |
import sys |
the distance method takes a geom argument: | |
Map.objects.distance(geom).order_by('distance') --> | |
/api/map/?objects.distance=<geom>&order_by=distance | |
the area method takes no arguments: | |
Map.objects.area().order_by('area') --> |
def filter_value_to_python(self, value, field_name, filters=None, | |
filter_expr=None, filter_type=None): | |
""" | |
Turn the string ``value`` into a python object. | |
""" | |
# Simple values | |
if value in ['true', 'True', True]: | |
return True | |
elif value in ['false', 'False', False]: |