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
#-*- coding: utf-8 -*- | |
import contextlib | |
from django.db import connection | |
@contextlib.contextmanager | |
def acquire_table_lock(read, write): | |
'''Acquire read & write locks on tables. |
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
from fabric.api import local | |
def current_revision(): | |
revision = local("git log -1 | grep commit | awk '{ print $2 }'", capture=True) | |
print 'current revision: %s' % revision | |
return revision |
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
""" | |
filename: angularjs.py | |
Usage: | |
{% ng Some.angular.scope.content %} | |
e.g. | |
{% load angularjs %} | |
<div ng-init="yourName = 'foobar'"> | |
<p>{% ng yourName %}</p> |
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 bz2 | |
import StringIO | |
from django.db import models | |
from django.utils.six import with_metaclass | |
class CompressedBinaryField(with_metaclass(models.SubfieldBase, models.BinaryField)): | |
description = "A binary field with bzip2 compression" |