This file contains 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
def get_cache_key(model, pk): | |
""" | |
Generates a cache key based on ``WRITE_CACHE_PREFIX``, the cache key prefix | |
defined in the settings file (if any), the Django app and model name, and | |
the primary key of the object. | |
""" | |
params = { | |
'prefix': getattr(settings, 'WRITE_CACHE_PREFIX', ''), | |
'app': model._meta.app_label, | |
'model': model._meta.object_name, |
This file contains 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 functools import wraps | |
from routers import ForceReadForModelsRouter | |
__all__ = ['uses_forced_read_router'] | |
def uses_forced_read_router(func): | |
@wraps(func) | |
def wrapper(req, *args, **kwargs): |
This file contains 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 django.core.management.base import BaseCommand, CommandError | |
from django.db.models import get_models, get_app, fields | |
from django.db.models.fields import related | |
class Command(BaseCommand): | |
help = """Generate factory-boy factories for the given app""" | |
def handle(self, *args, **options): | |
assert len(args) == 1, 'Must specify app name as first and only argument' |
This file contains 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 logging | |
class QuotelessStr(str): | |
""" | |
Return the repr() of this string *without* quotes. This is a | |
temporary fix until https://github.com/severb/graypy/pull/34 is resolved. | |
""" | |
def __repr__(self): | |
return self |
This file contains 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
# | |
# CONFIGURATION FOR USING SMS KANNEL WITH RAPIDSMS | |
# | |
# For any modifications to this file, see Kannel User Guide | |
# If that does not help, see Kannel web page (http://www.kannel.org) and | |
# various online help and mailing list archives | |
# | |
# Notes on those who base their configuration on this: | |
# 1) check security issues! (allowed IPs, passwords and ports) | |
# 2) groups cannot have empty rows inside them! |
This file contains 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
# ElasticSearch Service | |
description "ElasticSearch" | |
start on (net-device-up | |
and local-filesystems | |
and runlevel [2345]) | |
stop on runlevel [016] |
NewerOlder