Skip to content

Instantly share code, notes, and snippets.

@jgmize
jgmize / gist:6529655
Created September 11, 2013 20:54
Proposal of how to deal with legacy PHP lang param usage conflict with funfactory.middleware.LocaleURLMiddleware
from funfactory.middleware import LocaleURLMiddleware
from django.conf import settings
class ExceptionalLocaleURLMiddleware(LocalURLMiddleware):
"""
Replacement for funfactory.middleware.LocaleURLMiddleware that supports excluding
specific paths from getting redirected if a lang param is present in the request.
"""
def process_request(self, request):
if 'lang' in request.GET and request.path in getattr(
@jgmize
jgmize / contentlengths.py
Created February 26, 2013 21:35
get URL content lengths using requests, a gevent process pool, and redis
#!/usr/bin/env python
import logging
import re
from gevent import monkey, spawn
from gevent.pool import Pool
monkey.patch_all()
from redis import Redis
import requests