Merged in the port from Django 1.2 to Django 1.6 from olau@iola.dk: branch/iola/djangoport@7121, and fixed some merge issues.

- Legacy-Id: 7152
This commit is contained in:
Henrik Levkowetz 2014-01-18 21:02:40 +00:00
commit 6e97c2c8da
4464 changed files with 369128 additions and 364344 deletions

View file

@ -1,3 +1,14 @@
ietfdb (4.95) ietf; urgency=medium
This release upgrades Django from version 1.2 to version 1.6, including a
large number of refactorings and adjustments (about 140 individual changes)
to adapt to changes in both interfaces and the style of how things are done
between Django 1.2 and 1.6. The full list of changes is available here:
http://tools.ietf.org/tools/ietfdb/log/branch/iola/djangoport
-- Henrik Levkowetz <henrik@levkowetz.com> 13 Jan 2014 19:14:05 +0100
ietfdb (4.90) ietf; urgency=medium ietfdb (4.90) ietf; urgency=medium
This release removes almost all parts of the shim-layer code which was This release removes almost all parts of the shim-layer code which was

View file

@ -1 +1 @@
VERSION = (0, 2, 0, 0, 'beta') __version__ = (0, 5, 5, 'beta')

View file

@ -1,156 +1,107 @@
#import logging import logging
from django.conf import settings from django.utils.importlib import import_module
# Python 2.7 has an importlib with import_module. log = logging.getLogger('dajaxice')
# For older Pythons, Django's bundled copy provides it.
# For older Django's dajaxice reduced_import_module.
try:
from importlib import import_module
except:
try:
from django.utils.importlib import import_module
except:
from dajaxice.utils import simple_import_module as import_module
#log = logging.getLogger('dajaxice.DajaxiceRequest')
import syslog
def warning(msg):
syslog.syslog(syslog.LOG_WANRNING, msg)
log = syslog
log.warning = warning
class DajaxiceFunction(object): class DajaxiceFunction(object):
""" Basic representation of a dajaxice ajax function."""
def __init__(self, name, path, doc=None): def __init__(self, function, name, method):
self.function = function
self.name = name self.name = name
self.path = path self.method = method
self.doc = doc
def get_callable_path(self): def call(self, *args, **kwargs):
return '%s.%s' % (self.path.replace('.ajax', ''), self.name) """ Call the function. """
return self.function(*args, **kwargs)
def __cmp__(self, other):
return (self.name == other.name and self.path == other.path)
class DajaxiceModule(object): class DajaxiceModule(object):
def __init__(self, module): """ Basic representation of a dajaxice module. """
self.functions = []
self.sub_modules = []
self.name = module[0]
sub_module = module[1:] def __init__(self, name=None):
if len(sub_module) != 0: self.name = name
self.add_submodule(sub_module) self.functions = {}
self.submodules = {}
def get_module(self, module): def add(self, name, function):
""" """ Add this function at the ``name`` deep. If the submodule already
Recursively get_module util we found it. exists, recusively call the add method into the submodule. If not,
""" create the module and call the add method."""
if len(module) == 0:
return self
for dajaxice_module in self.sub_modules: # If this is not the final function name (there are more modules)
if dajaxice_module.name == module[0]: # split the name again an register a new submodule.
return dajaxice_module.get_module(module[1:]) if '.' in name:
return None module, extra = name.split('.', 1)
if module not in self.submodules:
def add_function(self, function): self.submodules[module] = DajaxiceModule(module)
self.functions.append(function) self.submodules[module].add(extra, function)
def has_sub_modules(self):
return len(self.sub_modules) > 0
def add_submodule(self, module):
"""
Recursively add_submodule, if it's not registered, create it.
"""
if len(module) == 0:
return
else: else:
sub_module = self.exist_submodule(module[0]) self.functions[name] = function
if type(sub_module) == int:
self.sub_modules[sub_module].add_submodule(module[1:])
else:
self.sub_modules.append(DajaxiceModule(module))
def exist_submodule(self, name):
"""
Check if submodule name was already registered.
"""
for module in self.sub_modules:
if module.name == name:
return self.sub_modules.index(module)
return False
class Dajaxice(object): class Dajaxice(object):
def __init__(self): def __init__(self):
self._registry = [] self._registry = {}
self._callable = [] self._modules = None
for function in getattr(settings, 'DAJAXICE_FUNCTIONS', ()): def register(self, function, name=None, method='POST'):
function = function.rsplit('.', 1)
self.register_function(function[0], function[1])
def register(self, function):
self.register_function(function.__module__, function.__name__, function.__doc__)
def register_function(self, module, name, doc=None):
""" """
Register function at 'module' depth Register this function as a dajaxice function.
"""
#Create the dajaxice function.
function = DajaxiceFunction(name=name, path=module, doc=doc)
#Check for already registered functions. If no name is provided, the module and the function name will be used.
full_path = '%s.%s' % (module, name) The final (customized or not) must be unique. """
if full_path in self._callable:
log.warning('%s already registered as dajaxice function.' % full_path) method = self.clean_method(method)
# Generate a default name
if not name:
module = ''.join(str(function.__module__).rsplit('.ajax', 1))
name = '.'.join((module, function.__name__))
if ':' in name:
log.error('Ivalid function name %s.' % name)
return return
self._callable.append(full_path) # Check for already registered functions
if name in self._registry:
log.error('%s was already registered.' % name)
return
#Dajaxice path without ajax. # Create the dajaxice function.
module_without_ajax = module.replace('.ajax', '').split('.') function = DajaxiceFunction(function=function,
name=name,
method=method)
#Register module if necessary. # Register this new ajax function
exist_module = self._exist_module(module_without_ajax[0]) self._registry[name] = function
if type(exist_module) == int: def is_callable(self, name, method):
self._registry[exist_module].add_submodule(module_without_ajax[1:]) """ Return if the function callable or not. """
else: return name in self._registry and self._registry[name].method == method
self._registry.append(DajaxiceModule(module_without_ajax))
#Register Function def clean_method(self, method):
module = self.get_module(module_without_ajax) """ Clean the http method. """
if module: method = method.upper()
module.add_function(function) if method not in ['GET', 'POST']:
method = 'POST'
return method
def get_module(self, module): def get(self, name):
""" """ Return the dajaxice function."""
Recursively get module from registry return self._registry[name]
"""
for dajaxice_module in self._registry:
if dajaxice_module.name == module[0]:
return dajaxice_module.get_module(module[1:])
return None
def is_callable(self, name):
return name in self._callable
def _exist_module(self, module_name):
for module in self._registry:
if module.name == module_name:
return self._registry.index(module)
return False
def get_functions(self):
return self._registry
@property
def modules(self):
""" Return an easy to loop module hierarchy with all the functions."""
if not self._modules:
self._modules = DajaxiceModule()
for name, function in self._registry.items():
self._modules.add(name, function)
return self._modules
LOADING_DAJAXICE = False LOADING_DAJAXICE = False
@ -158,8 +109,8 @@ LOADING_DAJAXICE = False
def dajaxice_autodiscover(): def dajaxice_autodiscover():
""" """
Auto-discover INSTALLED_APPS ajax.py modules and fail silently when Auto-discover INSTALLED_APPS ajax.py modules and fail silently when
not present. not present. NOTE: dajaxice_autodiscover was inspired/copied from
NOTE: dajaxice_autodiscover was inspired/copied from django.contrib.admin autodiscover django.contrib.admin autodiscover
""" """
global LOADING_DAJAXICE global LOADING_DAJAXICE
if LOADING_DAJAXICE: if LOADING_DAJAXICE:

View file

@ -1,228 +0,0 @@
#----------------------------------------------------------------------
# Copyright (c) 2009-2011 Benito Jorge Bastida
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# o Redistributions of source code must retain the above copyright
# notice, this list of conditions, and the disclaimer that follows.
#
# o Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# o Neither the name of Digital Creations nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS
# IS* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL
# CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
#----------------------------------------------------------------------
import os
import sys
#import logging
import traceback
from django.conf import settings
from django.utils import simplejson
from django.http import HttpResponse
from dajaxice.core import dajaxice_functions
from dajaxice.exceptions import FunctionNotCallableError, DajaxiceImportError
#log = logging.getLogger('dajaxice.DajaxiceRequest')
import syslog
def debug(msg):
syslog.syslog(syslog.LOG_DEBUG, msg)
def info(msg):
syslog.syslog(syslog.LOG_INFO, msg)
def warning(msg):
syslog.syslog(syslog.LOG_WANRNING, msg)
def error(msg):
syslog.syslog(syslog.LOG_ERR, msg)
log = syslog
log.debug = debug
log.info = info
log.warning = warning
log.error = error
# Python 2.7 has an importlib with import_module.
# For older Pythons, Django's bundled copy provides it.
# For older Django's dajaxice reduced_import_module.
try:
from importlib import import_module
except:
try:
from django.utils.importlib import import_module
except:
from dajaxice.utils import simple_import_module as import_module
def safe_dict(d):
"""
Recursively clone json structure with UTF-8 dictionary keys
http://www.gossamer-threads.com/lists/python/bugs/684379
"""
if isinstance(d, dict):
return dict([(k.encode('utf-8'), safe_dict(v)) for k, v in d.iteritems()])
elif isinstance(d, list):
return [safe_dict(x) for x in d]
else:
return d
class DajaxiceRequest(object):
def __init__(self, request, call):
call = call.rsplit('.', 1)
self.app_name = call[0]
self.method = call[1]
self.request = request
self.project_name = os.environ['DJANGO_SETTINGS_MODULE'].split('.')[0]
self.module = "%s.ajax" % self.app_name
self.full_name = "%s.%s" % (self.module, self.method)
@staticmethod
def get_js_functions():
return dajaxice_functions.get_functions()
@staticmethod
def get_media_prefix():
return getattr(settings, 'DAJAXICE_MEDIA_PREFIX', "dajaxice")
@staticmethod
def get_functions():
return getattr(settings, 'DAJAXICE_FUNCTIONS', ())
@staticmethod
def get_debug():
return getattr(settings, 'DAJAXICE_DEBUG', True)
@staticmethod
def get_notify_exceptions():
return getattr(settings, 'DAJAXICE_NOTIFY_EXCEPTIONS', False)
@staticmethod
def get_cache_control():
if settings.DEBUG:
return 0
return getattr(settings, 'DAJAXICE_CACHE_CONTROL', 5 * 24 * 60 * 60)
@staticmethod
def get_xmlhttprequest_js_import():
return getattr(settings, 'DAJAXICE_XMLHTTPREQUEST_JS_IMPORT', True)
@staticmethod
def get_json2_js_import():
return getattr(settings, 'DAJAXICE_JSON2_JS_IMPORT', True)
@staticmethod
def get_exception_message():
return getattr(settings, 'DAJAXICE_EXCEPTION', u'DAJAXICE_EXCEPTION')
@staticmethod
def get_js_docstrings():
return getattr(settings, 'DAJAXICE_JS_DOCSTRINGS', False)
def _is_callable(self):
"""
Return if the request function was registered.
"""
return dajaxice_functions.is_callable(self.full_name)
def _get_ajax_function(self):
"""
Return a callable ajax function.
This function should be imported according the Django version.
"""
return self._modern_get_ajax_function()
def _modern_get_ajax_function(self):
"""
Return a callable ajax function.
This function uses django.utils.importlib
"""
self.module_import_name = "%s.%s" % (self.project_name, self.module)
try:
return self._modern_import()
except:
self.module_import_name = self.module
return self._modern_import()
def _modern_import(self):
try:
mod = import_module(self.module_import_name)
return mod.__getattribute__(self.method)
except:
raise DajaxiceImportError()
def process(self):
"""
Process the dajax request calling the apropiate method.
"""
if self._is_callable():
log.debug('Function %s is callable' % self.full_name)
argv = self.request.POST.get('argv')
if argv != 'undefined':
try:
argv = simplejson.loads(self.request.POST.get('argv'))
argv = safe_dict(argv)
except Exception, e:
log.error('argv exception %s' % e)
argv = {}
else:
argv = {}
log.debug('argv %s' % argv)
try:
thefunction = self._get_ajax_function()
response = '%s' % thefunction(self.request, **argv)
except Exception, e:
trace = '\n'.join(traceback.format_exception(*sys.exc_info()))
log.error(trace)
response = '%s' % DajaxiceRequest.get_exception_message()
if DajaxiceRequest.get_notify_exceptions():
self.notify_exception(self.request, sys.exc_info())
log.info('response: %s' % response)
return HttpResponse(response, mimetype="application/x-json")
else:
log.debug('Function %s is not callable' % self.full_name)
raise FunctionNotCallableError(name=self.full_name)
def notify_exception(self, request, exc_info):
"""
Send Exception traceback to ADMINS
Similar to BaseHandler.handle_uncaught_exception
"""
from django.conf import settings
from django.core.mail import mail_admins
subject = 'Error (%s IP): %s' % ((request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS and 'internal' or 'EXTERNAL'), request.path)
try:
request_repr = repr(request)
except:
request_repr = "Request repr() unavailable"
trace = '\n'.join(traceback.format_exception(*(exc_info or sys.exc_info())))
message = "%s\n\n%s" % (trace, request_repr)
mail_admins(subject, message, fail_silently=True)

View file

@ -1,5 +1,38 @@
from Dajaxice import Dajaxice from django.conf import settings
dajaxice_functions = Dajaxice()
from DajaxiceRequest import DajaxiceRequest from Dajaxice import Dajaxice, dajaxice_autodiscover
from Dajaxice import dajaxice_autodiscover
class DajaxiceConfig(object):
""" Provide an easy to use way to read the dajaxice configuration and
return the default values if no configuration is present."""
default_config = {'DAJAXICE_XMLHTTPREQUEST_JS_IMPORT': True,
'DAJAXICE_JSON2_JS_IMPORT': True,
'DAJAXICE_EXCEPTION': 'DAJAXICE_EXCEPTION',
'DAJAXICE_MEDIA_PREFIX': 'dajaxice'}
def __getattr__(self, name):
""" Return the customized value for a setting (if it exists) or the
default value if not. """
if name in self.default_config:
if hasattr(settings, name):
return getattr(settings, name)
return self.default_config.get(name)
return None
@property
def dajaxice_url(self):
return r'^%s/' % self.DAJAXICE_MEDIA_PREFIX
@property
def django_settings(self):
return settings
@property
def modules(self):
return dajaxice_functions.modules
dajaxice_functions = Dajaxice()
dajaxice_config = DajaxiceConfig()

View file

@ -1,10 +1,48 @@
import functools
from dajaxice.core import dajaxice_functions from dajaxice.core import dajaxice_functions
def dajaxice_register(original_function): def dajaxice_register(*dargs, **dkwargs):
""" """ Register some function as a dajaxice function
Register the original funcion and returns it
For legacy purposes, if only a function is passed register it a simple
single ajax function using POST, i.e:
@dajaxice_register
def ajax_function(request):
...
After 0.5, dajaxice allow to customize the http method and the final name
of the registered function. This decorator covers both the legacy and
the new functionality, i.e:
@dajaxice_register(method='GET')
def ajax_function(request):
...
@dajaxice_register(method='GET', name='my.custom.name')
def ajax_function(request):
...
You can also register the same function to use a different http method
and/or use a different name.
@dajaxice_register(method='GET', name='users.get')
@dajaxice_register(method='POST', name='users.update')
def ajax_function(request):
...
""" """
dajaxice_functions.register(original_function) if len(dargs) and not dkwargs:
return original_function function = dargs[0]
dajaxice_functions.register(function)
return function
def decorator(function):
@functools.wraps(function)
def wrapper(request, *args, **kwargs):
return function(request, *args, **kwargs)
dajaxice_functions.register(function, *dargs, **dkwargs)
return wrapper
return decorator

View file

@ -1,41 +1,10 @@
#---------------------------------------------------------------------- class DajaxiceError(Exception):
# Copyright (c) 2009-2011 Benito Jorge Bastida pass
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are class FunctionNotCallableError(DajaxiceError):
# met: pass
#
# o Redistributions of source code must retain the above copyright
# notice, this list of conditions, and the disclaimer that follows. class DajaxiceImportError(DajaxiceError):
#
# o Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# o Neither the name of Digital Creations nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS
# IS* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL
# CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
#----------------------------------------------------------------------
class FunctionNotCallableError(Exception):
def __init__(self, name):
self.name = name
class DajaxiceImportError(Exception):
pass pass

View file

@ -44,7 +44,7 @@ class VirtualStorage(finders.FileSystemStorage):
for f in self.files: for f in self.files:
if f.startswith(path): if f.startswith(path):
f = f.replace(path, '', 1) f = f.replace(path, '', 1)
if os.sep in f: if os.sep in f:
folders.append(f.split(os.sep, 1)[0]) folders.append(f.split(os.sep, 1)[0])
else: else:
files.append(f) files.append(f)
@ -60,7 +60,7 @@ class VirtualStorage(finders.FileSystemStorage):
class DajaxiceStorage(VirtualStorage): class DajaxiceStorage(VirtualStorage):
files = {'dajaxice/dajaxice.core.js': 'dajaxice_core_js'} files = {os.path.join('dajaxice', 'dajaxice.core.js'): 'dajaxice_core_js'}
def dajaxice_core_js(self): def dajaxice_core_js(self):
from dajaxice.core import dajaxice_autodiscover, dajaxice_config from dajaxice.core import dajaxice_autodiscover, dajaxice_config
@ -68,7 +68,7 @@ class DajaxiceStorage(VirtualStorage):
dajaxice_autodiscover() dajaxice_autodiscover()
c = Context({'dajaxice_config': dajaxice_config}) c = Context({'dajaxice_config': dajaxice_config})
return get_template('dajaxice/dajaxice.core.js').render(c) return get_template(os.path.join('dajaxice', 'dajaxice.core.js')).render(c)
class DajaxiceFinder(finders.BaseStorageFinder): class DajaxiceFinder(finders.BaseStorageFinder):

View file

@ -1,83 +0,0 @@
#----------------------------------------------------------------------
# Copyright (c) 2009-2011 Benito Jorge Bastida
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# o Redistributions of source code must retain the above copyright
# notice, this list of conditions, and the disclaimer that follows.
#
# o Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# o Neither the name of Digital Creations nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS
# IS* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL
# CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
#----------------------------------------------------------------------
import httplib
import urllib
from django.core.management.base import BaseCommand
from django.template.loader import render_to_string
from optparse import make_option
from dajaxice.core import DajaxiceRequest
from dajaxice.core import dajaxice_autodiscover
dajaxice_autodiscover()
class Command(BaseCommand):
help = "Generate dajaxice.core.js file to import it as static file"
args = "[--compile]"
option_list = BaseCommand.option_list + (
make_option('--compile', default='no', dest='compile', help='Compile output using Google closure-compiler'),
)
requires_model_validation = False
def handle(self, *app_labels, **options):
compile_output = options.get('compile', 'yes')
data = {'dajaxice_js_functions': DajaxiceRequest.get_js_functions(),
'DAJAXICE_URL_PREFIX': DajaxiceRequest.get_media_prefix(),
'DAJAXICE_XMLHTTPREQUEST_JS_IMPORT': DajaxiceRequest.get_xmlhttprequest_js_import(),
'DAJAXICE_JSON2_JS_IMPORT': DajaxiceRequest.get_json2_js_import(),
'DAJAXICE_EXCEPTION': DajaxiceRequest.get_exception_message()}
js = render_to_string('dajaxice/dajaxice.core.js', data)
if compile_output.lower() == "closure":
print self.complie_js_with_closure(js)
else:
print js
def complie_js_with_closure(self, js):
params = urllib.urlencode([
('js_code', js),
('compilation_level', 'ADVANCED_OPTIMIZATIONS'),
('output_format', 'text'),
('output_info', 'compiled_code'),
])
# Always use the following value for the Content-type header.
headers = {"Content-type": "application/x-www-form-urlencoded"}
conn = httplib.HTTPConnection('closure-compiler.appspot.com')
conn.request('POST', '/compile', params, headers)
response = conn.getresponse()
data = response.read()
conn.close()
return data

View file

@ -0,0 +1 @@
# Don't delete me

View file

@ -1,8 +1,14 @@
{% load url from future %}
var Dajaxice = { var Dajaxice = {
{% for module in dajaxice_js_functions %}
{% include "dajaxice/dajaxice_core_loop.js" %} {% with module=dajaxice_config.modules top='top' %}
{% endfor %}{% ifnotequal dajaxice_js_functions|length 0 %},{% endifnotequal %} {% include "dajaxice/dajaxice_function_loop.js" %}
{% endwith %}
{% for name, module in dajaxice_config.modules.submodules.items %}
{% include "dajaxice/dajaxice_module_loop.js" %},
{% endfor %}
get_cookie: function(name) get_cookie: function(name)
{ {
var cookieValue = null; var cookieValue = null;
@ -19,95 +25,106 @@ var Dajaxice = {
} }
return cookieValue; return cookieValue;
}, },
call: function(dajaxice_function, dajaxice_callback, argv, exception_callback) call: function(dajaxice_function, method, dajaxice_callback, argv, custom_settings)
{ {
var send_data = []; var custom_settings = custom_settings || {},
var is_callback_a_function = (typeof(dajaxice_callback) == 'function'); error_callback = Dajaxice.get_setting('default_exception_callback');
if(!is_callback_a_function){
alert("dajaxice_callback should be a function since dajaxice 0.2") if('error_callback' in custom_settings && typeof(custom_settings['error_callback']) == 'function'){
error_callback = custom_settings['error_callback'];
} }
if(exception_callback==undefined || typeof(dajaxice_callback) != 'function'){ var send_data = 'argv='+encodeURIComponent(JSON.stringify(argv)),
exception_callback = this.get_setting('default_exception_callback'); oXMLHttpRequest = new XMLHttpRequest,
endpoint = '{% url 'dajaxice-endpoint' %}'+dajaxice_function+'/';
if(method == 'GET'){
endpoint = endpoint + '?' + send_data;
} }
oXMLHttpRequest.open(method, endpoint);
send_data.push('argv='+encodeURIComponent(JSON.stringify(argv))); oXMLHttpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
send_data = send_data.join('&');
var oXMLHttpRequest = new XMLHttpRequest;
oXMLHttpRequest.open('POST', '/{{DAJAXICE_URL_PREFIX}}/'+dajaxice_function+'/');
oXMLHttpRequest.setRequestHeader("X-Requested-With", "XMLHttpRequest"); oXMLHttpRequest.setRequestHeader("X-Requested-With", "XMLHttpRequest");
oXMLHttpRequest.setRequestHeader("X-CSRFToken",Dajaxice.get_cookie('csrftoken')); oXMLHttpRequest.setRequestHeader("X-CSRFToken", Dajaxice.get_cookie('{{ dajaxice_config.django_settings.CSRF_COOKIE_NAME }}'));
oXMLHttpRequest.onreadystatechange = function() { oXMLHttpRequest.onreadystatechange = function() {
if (this.readyState == XMLHttpRequest.DONE) { if (this.readyState == XMLHttpRequest.DONE) {
if(this.responseText == Dajaxice.EXCEPTION){ if(this.responseText == Dajaxice.EXCEPTION || !(this.status in Dajaxice.valid_http_responses())){
exception_callback(); error_callback();
} }
else{ else{
try{ var response;
dajaxice_callback(JSON.parse(this.responseText)); try {
response = JSON.parse(this.responseText);
} }
catch(exception){ catch (exception) {
dajaxice_callback(this.responseText); response = this.responseText;
} }
dajaxice_callback(response);
} }
} }
} }
oXMLHttpRequest.send(send_data); if(method == 'POST'){
oXMLHttpRequest.send(send_data);
}
else{
oXMLHttpRequest.send();
}
return oXMLHttpRequest;
}, },
setup: function(settings) setup: function(settings)
{ {
this.settings = settings; this.settings = settings;
}, },
get_setting: function(key){ get_setting: function(key){
if(this.settings == undefined || this.settings[key] == undefined){ if(this.settings == undefined || this.settings[key] == undefined){
return this.default_settings[key]; return Dajaxice.default_settings[key];
} }
return this.settings[key]; return this.settings[key];
}, },
default_exception_callback: function(data){
alert('Something goes wrong');
}
};
Dajaxice.EXCEPTION = '{{ DAJAXICE_EXCEPTION }}'; valid_http_responses: function(){
Dajaxice.default_settings = {'default_exception_callback': Dajaxice.default_exception_callback} return {200: null, 301: null, 302: null, 304: null}
},
EXCEPTION: '{{ dajaxice_config.DAJAXICE_EXCEPTION }}',
default_settings: {'default_exception_callback': function(){ console.log('Dajaxice: Something went wrong.')}}
};
window['Dajaxice'] = Dajaxice; window['Dajaxice'] = Dajaxice;
{% comment %} {% comment %}
/* /*
XMLHttpRequest.js Compiled with Google Closure XMLHttpRequest.js Compiled with Google Closure
XMLHttpRequest.js Copyright (C) 2008 Sergey Ilinsky (http://www.ilinsky.com) XMLHttpRequest.js Copyright (C) 2008 Sergey Ilinsky (http://www.ilinsky.com)
This work is free software; you can redistribute it and/or modify This work is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version. (at your option) any later version.
This work is distributed in the hope that it will be useful, This work is distributed in the hope that it will be useful,
but without any warranty; without even the implied warranty of but without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose. See the merchantability or fitness for a particular purpose. See the
GNU Lesser General Public License for more details. GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation, Inc., along with this library; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
{% endcomment %} {% endcomment %}
{% if DAJAXICE_XMLHTTPREQUEST_JS_IMPORT %} {% if dajaxice_config.DAJAXICE_XMLHTTPREQUEST_JS_IMPORT %}
(function(){function b(){this._object=i?new i:new window.ActiveXObject("Microsoft.XMLHTTP");this._listeners=[]}function k(a){b.onreadystatechange&&b.onreadystatechange.apply(a);a.dispatchEvent({type:"readystatechange",bubbles:false,cancelable:false,timeStamp:new Date+0})}function p(a){var c=a.responseXML,d=a.responseText;if(h&&d&&c&&!c.documentElement&&a.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/)){c=new window.ActiveXObject("Microsoft.XMLDOM");c.async=false;c.validateOnParse=false; (function(){function n(){this._object=h&&!p?new h:new window.ActiveXObject("Microsoft.XMLHTTP");this._listeners=[]}function a(){return new n}function j(b){a.onreadystatechange&&a.onreadystatechange.apply(b);b.dispatchEvent({type:"readystatechange",bubbles:!1,cancelable:!1,timeStamp:new Date+0})}function o(b){try{b.responseText=b._object.responseText}catch(a){}try{var d;var g=b._object,c=g.responseXML,f=g.responseText;i&&(f&&c&&!c.documentElement&&g.getResponseHeader("Content-Type").match(/[^\/]+\/[^\+]+\+xml/))&&
c.loadXML(d)}if(c)if(h&&c.parseError!=0||!c.documentElement||c.documentElement&&c.documentElement.tagName=="parsererror")return null;return c}function o(a){try{a.responseText=a._object.responseText}catch(c){}try{a.responseXML=p(a._object)}catch(d){}try{a.status=a._object.status}catch(g){}try{a.statusText=a._object.statusText}catch(e){}}function l(a){a._object.onreadystatechange=new window.Function}var i=window.XMLHttpRequest,j=!!window.controllers,h=window.document.all&&!window.opera;if(j&&i.wrapped)b.wrapped= (c=new window.ActiveXObject("Microsoft.XMLDOM"),c.async=!1,c.validateOnParse=!1,c.loadXML(f));d=c&&(i&&0!==c.parseError||!c.documentElement||c.documentElement&&"parsererror"==c.documentElement.tagName)?null:c;b.responseXML=d}catch(h){}try{b.status=b._object.status}catch(k){}try{b.statusText=b._object.statusText}catch(j){}}function l(b){b._object.onreadystatechange=new window.Function}var h=window.XMLHttpRequest,m=!!window.controllers,i=window.document.all&&!window.opera,p=i&&window.navigator.userAgent.match(/MSIE 7.0/);
i.wrapped;b.UNSENT=0;b.OPENED=1;b.HEADERS_RECEIVED=2;b.LOADING=3;b.DONE=4;b.prototype.readyState=b.UNSENT;b.prototype.responseText="";b.prototype.responseXML=null;b.prototype.status=0;b.prototype.statusText="";b.prototype.onreadystatechange=null;b.onreadystatechange=null;b.onopen=null;b.onsend=null;b.onabort=null;b.prototype.open=function(a,c,d,g,e){delete this._headers;if(arguments.length<3)d=true;this._async=d;var f=this,m=this.readyState,n;if(h&&d){n=function(){if(m!=b.DONE){l(f);f.abort()}};window.attachEvent("onunload", a.prototype=n.prototype;m&&h.wrapped&&(a.wrapped=h.wrapped);a.UNSENT=0;a.OPENED=1;a.HEADERS_RECEIVED=2;a.LOADING=3;a.DONE=4;a.prototype.readyState=a.UNSENT;a.prototype.responseText="";a.prototype.responseXML=null;a.prototype.status=0;a.prototype.statusText="";a.prototype.priority="NORMAL";a.prototype.onreadystatechange=null;a.onreadystatechange=null;a.onopen=null;a.onsend=null;a.onabort=null;a.prototype.open=function(b,e,d,g,c){delete this._headers;arguments.length<3&&(d=true);this._async=d;var f=
n)}b.onopen&&b.onopen.apply(this,arguments);if(arguments.length>4)this._object.open(a,c,d,g,e);else arguments.length>3?this._object.open(a,c,d,g):this._object.open(a,c,d);if(!j&&!h){this.readyState=b.OPENED;k(this)}this._object.onreadystatechange=function(){if(!(j&&!d)){f.readyState=f._object.readyState;o(f);if(f._aborted)f.readyState=b.UNSENT;else{if(f.readyState==b.DONE){l(f);h&&d&&window.detachEvent("onunload",n)}m!=f.readyState&&k(f);m=f.readyState}}}};b.prototype.send=function(a){b.onsend&&b.onsend.apply(this, this,h=this.readyState,k=null;if(i&&d){k=function(){if(h!=a.DONE){l(f);f.abort()}};window.attachEvent("onunload",k)}a.onopen&&a.onopen.apply(this,arguments);arguments.length>4?this._object.open(b,e,d,g,c):arguments.length>3?this._object.open(b,e,d,g):this._object.open(b,e,d);this.readyState=a.OPENED;j(this);this._object.onreadystatechange=function(){if(!m||d){f.readyState=f._object.readyState;o(f);if(f._aborted)f.readyState=a.UNSENT;else if(f.readyState==a.DONE){delete f._data;l(f);i&&d&&window.detachEvent("onunload",
arguments);if(a&&a.nodeType){a=window.XMLSerializer?(new window.XMLSerializer).serializeToString(a):a.xml;this._headers["Content-Type"]||this._object.setRequestHeader("Content-Type","application/xml")}this._object.send(a);if(j&&!this._async){this.readyState=b.OPENED;for(o(this);this.readyState<b.DONE;){this.readyState++;k(this);if(this._aborted)return}}};b.prototype.abort=function(){b.onabort&&b.onabort.apply(this,arguments);if(this.readyState>b.UNSENT)this._aborted=true;this._object.abort();l(this)}; k);h!=f.readyState&&j(f);h=f.readyState}}}};a.prototype.send=function(b){a.onsend&&a.onsend.apply(this,arguments);arguments.length||(b=null);if(b&&b.nodeType){b=window.XMLSerializer?(new window.XMLSerializer).serializeToString(b):b.xml;this._headers["Content-Type"]||this._object.setRequestHeader("Content-Type","application/xml")}this._data=b;a:{this._object.send(this._data);if(m&&!this._async){this.readyState=a.OPENED;for(o(this);this.readyState<a.DONE;){this.readyState++;j(this);if(this._aborted)break a}}}};
b.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders()};b.prototype.getResponseHeader=function(a){return this._object.getResponseHeader(a)};b.prototype.setRequestHeader=function(a,c){if(!this._headers)this._headers={};this._headers[a]=c;return this._object.setRequestHeader(a,c)};b.prototype.addEventListener=function(a,c,d){for(var g=0,e;e=this._listeners[g];g++)if(e[0]==a&&e[1]==c&&e[2]==d)return;this._listeners.push([a,c,d])};b.prototype.removeEventListener=function(a, a.prototype.abort=function(){a.onabort&&a.onabort.apply(this,arguments);if(this.readyState>a.UNSENT)this._aborted=true;this._object.abort();l(this);this.readyState=a.UNSENT;delete this._data};a.prototype.getAllResponseHeaders=function(){return this._object.getAllResponseHeaders()};a.prototype.getResponseHeader=function(b){return this._object.getResponseHeader(b)};a.prototype.setRequestHeader=function(b,a){if(!this._headers)this._headers={};this._headers[b]=a;return this._object.setRequestHeader(b,
c,d){for(var g=0,e;e=this._listeners[g];g++)if(e[0]==a&&e[1]==c&&e[2]==d)break;e&&this._listeners.splice(g,1)};b.prototype.dispatchEvent=function(a){a={type:a.type,target:this,currentTarget:this,eventPhase:2,bubbles:a.bubbles,cancelable:a.cancelable,timeStamp:a.timeStamp,stopPropagation:function(){},preventDefault:function(){},initEvent:function(){}};if(a.type=="readystatechange"&&this.onreadystatechange)(this.onreadystatechange.handleEvent||this.onreadystatechange).apply(this,[a]);for(var c=0,d;d= a)};a.prototype.addEventListener=function(a,e,d){for(var g=0,c;c=this._listeners[g];g++)if(c[0]==a&&c[1]==e&&c[2]==d)return;this._listeners.push([a,e,d])};a.prototype.removeEventListener=function(a,e,d){for(var g=0,c;c=this._listeners[g];g++)if(c[0]==a&&c[1]==e&&c[2]==d)break;c&&this._listeners.splice(g,1)};a.prototype.dispatchEvent=function(a){a={type:a.type,target:this,currentTarget:this,eventPhase:2,bubbles:a.bubbles,cancelable:a.cancelable,timeStamp:a.timeStamp,stopPropagation:function(){},preventDefault:function(){},
this._listeners[c];c++)if(d[0]==a.type&&!d[2])(d[1].handleEvent||d[1]).apply(this,[a])};b.prototype.toString=function(){return"[object XMLHttpRequest]"};b.toString=function(){return"[XMLHttpRequest]"};if(!window.Function.prototype.apply)window.Function.prototype.apply=function(a,c){c||(c=[]);a.__func=this;a.__func(c[0],c[1],c[2],c[3],c[4]);delete a.__func};window.XMLHttpRequest=b})(); initEvent:function(){}};a.type=="readystatechange"&&this.onreadystatechange&&(this.onreadystatechange.handleEvent||this.onreadystatechange).apply(this,[a]);for(var e=0,d;d=this._listeners[e];e++)d[0]==a.type&&!d[2]&&(d[1].handleEvent||d[1]).apply(this,[a])};a.prototype.toString=function(){return"[object XMLHttpRequest]"};a.toString=function(){return"[XMLHttpRequest]"};window.Function.prototype.apply||(window.Function.prototype.apply=function(a,e){e||(e=[]);a.__func=this;a.__func(e[0],e[1],e[2],e[3],
e[4]);delete a.__func});window.XMLHttpRequest=a})();
{% endif %} {% endif %}
{% comment %} {% comment %}
@ -117,12 +134,12 @@ this._listeners[c];c++)if(d[0]==a.type&&!d[2])(d[1].handleEvent||d[1]).apply(thi
I hope that in the future this code won't be neccessary, but today all browsers doesn't supports JSON.stringify(). I hope that in the future this code won't be neccessary, but today all browsers doesn't supports JSON.stringify().
*/ */
{% endcomment %} {% endcomment %}
{% if DAJAXICE_JSON2_JS_IMPORT %} {% if dajaxice_config.DAJAXICE_JSON2_JS_IMPORT %}
if(!this.JSON)this.JSON={}; var JSON;JSON||(JSON={});
(function(){function k(a){return a<10?"0"+a:a}function n(a){o.lastIndex=0;return o.test(a)?'"'+a.replace(o,function(c){var d=q[c];return typeof d==="string"?d:"\\u"+("0000"+c.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function l(a,c){var d,f,i=g,e,b=c[a];if(b&&typeof b==="object"&&typeof b.toJSON==="function")b=b.toJSON(a);if(typeof j==="function")b=j.call(c,a,b);switch(typeof b){case "string":return n(b);case "number":return isFinite(b)?String(b):"null";case "boolean":case "null":return String(b);case "object":if(!b)return"null"; (function(){function k(a){return 10>a?"0"+a:a}function o(a){p.lastIndex=0;return p.test(a)?'"'+a.replace(p,function(a){var c=r[a];return"string"===typeof c?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function m(a,j){var c,d,h,n,g=e,f,b=j[a];b&&("object"===typeof b&&"function"===typeof b.toJSON)&&(b=b.toJSON(a));"function"===typeof i&&(b=i.call(j,a,b));switch(typeof b){case "string":return o(b);case "number":return isFinite(b)?String(b):"null";case "boolean":case "null":return String(b);case "object":if(!b)return"null";
g+=m;e=[];if(Object.prototype.toString.apply(b)==="[object Array]"){f=b.length;for(a=0;a<f;a+=1)e[a]=l(a,b)||"null";c=e.length===0?"[]":g?"[\n"+g+e.join(",\n"+g)+"\n"+i+"]":"["+e.join(",")+"]";g=i;return c}if(j&&typeof j==="object"){f=j.length;for(a=0;a<f;a+=1){d=j[a];if(typeof d==="string")if(c=l(d,b))e.push(n(d)+(g?": ":":")+c)}}else for(d in b)if(Object.hasOwnProperty.call(b,d))if(c=l(d,b))e.push(n(d)+(g?": ":":")+c);c=e.length===0?"{}":g?"{\n"+g+e.join(",\n"+g)+"\n"+i+"}":"{"+e.join(",")+"}"; e+=l;f=[];if("[object Array]"===Object.prototype.toString.apply(b)){n=b.length;for(c=0;c<n;c+=1)f[c]=m(c,b)||"null";h=0===f.length?"[]":e?"[\n"+e+f.join(",\n"+e)+"\n"+g+"]":"["+f.join(",")+"]";e=g;return h}if(i&&"object"===typeof i){n=i.length;for(c=0;c<n;c+=1)"string"===typeof i[c]&&(d=i[c],(h=m(d,b))&&f.push(o(d)+(e?": ":":")+h))}else for(d in b)Object.prototype.hasOwnProperty.call(b,d)&&(h=m(d,b))&&f.push(o(d)+(e?": ":":")+h);h=0===f.length?"{}":e?"{\n"+e+f.join(",\n"+e)+"\n"+g+"}":"{"+f.join(",")+
g=i;return c}}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+k(this.getUTCMonth()+1)+"-"+k(this.getUTCDate())+"T"+k(this.getUTCHours())+":"+k(this.getUTCMinutes())+":"+k(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var p=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, "}";e=g;return h}}"function"!==typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+k(this.getUTCMonth()+1)+"-"+k(this.getUTCDate())+"T"+k(this.getUTCHours())+":"+k(this.getUTCMinutes())+":"+k(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var q=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
o=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,g,m,q={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},j;if(typeof JSON.stringify!=="function")JSON.stringify=function(a,c,d){var f;m=g="";if(typeof d==="number")for(f=0;f<d;f+=1)m+=" ";else if(typeof d==="string")m=d;if((j=c)&&typeof c!=="function"&&(typeof c!=="object"||typeof c.length!=="number"))throw new Error("JSON.stringify");return l("", p=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,e,l,r={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},i;"function"!==typeof JSON.stringify&&(JSON.stringify=function(a,j,c){var d;l=e="";if(typeof c==="number")for(d=0;d<c;d=d+1)l=l+" ";else typeof c==="string"&&(l=c);if((i=j)&&typeof j!=="function"&&(typeof j!=="object"||typeof j.length!=="number"))throw Error("JSON.stringify");return m("",{"":a})});
{"":a})};if(typeof JSON.parse!=="function")JSON.parse=function(a,c){function d(f,i){var e,b,h=f[i];if(h&&typeof h==="object")for(e in h)if(Object.hasOwnProperty.call(h,e)){b=d(h,e);if(b!==undefined)h[e]=b;else delete h[e]}return c.call(f,i,h)}p.lastIndex=0;if(p.test(a))a=a.replace(p,function(f){return"\\u"+("0000"+f.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "function"!==typeof JSON.parse&&(JSON.parse=function(a,e){function c(a,d){var g,f,b=a[d];if(b&&typeof b==="object")for(g in b)if(Object.prototype.hasOwnProperty.call(b,g)){f=c(b,g);f!==void 0?b[g]=f:delete b[g]}return e.call(a,d,b)}var d,a=String(a);q.lastIndex=0;q.test(a)&&(a=a.replace(q,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){a=eval("("+a+")");return typeof c==="function"?d({"":a},""):a}throw new SyntaxError("JSON.parse");}})(); "]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){d=eval("("+a+")");return typeof e==="function"?c({"":d},""):d}throw new SyntaxError("JSON.parse");})})();
{% endif %} {% endif %}

View file

@ -1,16 +0,0 @@
{{ module.name }}: {
{% for function in module.functions %}
{% if function.doc and DAJAXICE_JS_DOCSTRINGS %}/* {{ function.doc|default:'' }}*/ {% endif %}
{{ function.name }}: function(callback_function, argv, exception_callback){
Dajaxice.call('{{function.get_callable_path}}', callback_function, argv, exception_callback);
}{% if not forloop.last %},{% endif %}
{% endfor %}
{% for sub_module in module.sub_modules %}
{% with "dajaxice/dajaxice_core_loop.js" as filename %}
{% with sub_module as module %}
{% include filename %}
{% endwith %}
{% endwith %}
{% endfor %}
}{% if not forloop.last %},{% endif %}

View file

@ -1,5 +1,5 @@
{% for function_name, function in module.functions.items %} {% for function_name, function in module.functions.items %}
{{ function_name }}: function(callback_function, argv, custom_settings){ {{ function_name }}: function(callback_function, argv, custom_settings){
Dajaxice.call('{{ function.name }}', '{{ function.method }}', callback_function, argv, custom_settings); return Dajaxice.call('{{ function.name }}', '{{ function.method }}', callback_function, argv, custom_settings);
}{% if not forloop.last or top %},{% endif %} }{% if not forloop.last or top or module.submodules %},{% endif %}
{% endfor %} {% endfor %}

View file

@ -1 +0,0 @@
<script src="/{{ DAJAXICE_MEDIA_PREFIX }}/dajaxice.core.js" type="text/javascript" charset="utf-8"></script>

View file

@ -1,8 +1,11 @@
{{ name }}: { {{ name }}: {
{% include "dajaxice/dajaxice_function_loop.js" %} {% include "dajaxice/dajaxice_function_loop.js" %}
{% with parent_foorloop=forloop %}
{% for name, sub_module in module.submodules.items %} {% for name, sub_module in module.submodules.items %}
{% with filename="dajaxice/dajaxice_module_loop.js" module=sub_module %} {% with filename="dajaxice/dajaxice_module_loop.js" module=sub_module %}
{% include filename %} {% include filename %}
{% endwith %} {% endwith %}
{% if not forloop.last %},{% endif %}
{% endfor %} {% endfor %}
}{% if not forloop.last %},{% endif %} }
{% endwith %}

View file

@ -1,42 +1,35 @@
#---------------------------------------------------------------------- import logging
# Copyright (c) 2009-2011 Benito Jorge Bastida
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# o Redistributions of source code must retain the above copyright
# notice, this list of conditions, and the disclaimer that follows.
#
# o Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# o Neither the name of Digital Creations nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS
# IS* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL
# CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
#----------------------------------------------------------------------
from django import template from django import template
from dajaxice.core import DajaxiceRequest from django.middleware.csrf import get_token
from django.conf import settings
from django.core.files.storage import get_storage_class
staticfiles_storage = get_storage_class(settings.STATICFILES_STORAGE)()
register = template.Library() register = template.Library()
log = logging.getLogger('dajaxice')
@register.inclusion_tag('dajaxice/dajaxice_js_import.html', takes_context=True)
def dajaxice_js_import(context): @register.simple_tag(takes_context=True)
return {'DAJAXICE_MEDIA_PREFIX': DajaxiceRequest.get_media_prefix()} def dajaxice_js_import(context, csrf=True):
""" Return the js script tag for the dajaxice.core.js file
If the csrf argument is present and it's ``nocsrf`` dajaxice will not
try to mark the request as if it need the csrf token. By default use
the dajaxice_js_import template tag will make django set the csrftoken
cookie on the current request."""
csrf = csrf != 'nocsrf'
request = context.get('request')
if request and csrf:
get_token(request)
elif csrf:
log.warning("The 'request' object must be accesible within the "
"context. You must add 'django.contrib.messages.context"
"_processors.request' to your TEMPLATE_CONTEXT_PROCESSORS "
"and render your views using a RequestContext.")
url = staticfiles_storage.url('dajaxice/dajaxice.core.js')
return '<script src="%s" type="text/javascript" charset="utf-8"></script>' % url

View file

@ -1,46 +1,114 @@
#----------------------------------------------------------------------
# Copyright (c) 2009-2011 Benito Jorge Bastida
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# o Redistributions of source code must retain the above copyright
# notice, this list of conditions, and the disclaimer that follows.
#
# o Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# o Neither the name of Digital Creations nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS
# IS* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL
# CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
#----------------------------------------------------------------------
import os
import unittest
from django.test import TestCase from django.test import TestCase
from django.conf import settings from django.conf import settings
from dajaxice.exceptions import FunctionNotCallableError, DajaxiceImportError from dajaxice.core import DajaxiceConfig
from dajaxice.core import DajaxiceRequest from dajaxice.core.Dajaxice import DajaxiceModule, DajaxiceFunction, Dajaxice
from dajaxice.core.Dajaxice import Dajaxice, DajaxiceModule, DajaxiceFunction from dajaxice.exceptions import FunctionNotCallableError
from dajaxice.core import dajaxice_functions
class DajaxiceModuleTest(TestCase):
def setUp(self):
self.module = DajaxiceModule()
def test_constructor(self):
self.assertEqual(self.module.functions, {})
self.assertEqual(self.module.submodules, {})
def test_add_function(self):
function = lambda x: x
self.module.add('test', function)
self.assertEqual(self.module.functions, {'test': function})
self.assertEqual(self.module.submodules, {})
self.module.add('foo.bar', function)
self.assertEqual(self.module.functions, {'test': function})
self.assertEqual(self.module.submodules.keys(), ['foo'])
self.assertEqual(self.module.submodules['foo'].functions, {'bar': function})
class DajaxiceFunctionTest(TestCase):
def test_constructor(self):
class CalledEception(Exception):
pass
def callback():
raise CalledEception
function = DajaxiceFunction(callback, 'foo', 'POST')
self.assertEqual(function.function, callback)
self.assertEqual(function.name, 'foo')
self.assertEqual(function.method, 'POST')
self.assertRaises(CalledEception, function.call)
class DajaxiceTest(TestCase):
def setUp(self):
self.dajaxice = Dajaxice()
self.function = lambda x: x
def test_constructor(self):
self.assertEqual(self.dajaxice._registry, {})
def test_register(self):
self.dajaxice.register(self.function, 'foo')
self.assertTrue('foo' in self.dajaxice._registry)
self.assertEqual(type(self.dajaxice._registry['foo']), DajaxiceFunction)
def bar_function():
return
self.dajaxice.register(bar_function)
self.assertTrue('dajaxice.tests.bar_function' in self.dajaxice._registry)
self.assertEqual(type(self.dajaxice._registry['dajaxice.tests.bar_function']), DajaxiceFunction)
def test__is_callable(self):
self.dajaxice.register(self.function, 'foo')
self.dajaxice.register(self.function, 'bar', method='GET')
self.assertTrue(self.dajaxice.is_callable('foo', 'POST'))
self.assertTrue(self.dajaxice.is_callable('bar', 'GET'))
self.assertFalse(self.dajaxice.is_callable('foo', 'GET'))
self.assertFalse(self.dajaxice.is_callable('bar', 'POST'))
self.assertFalse(self.dajaxice.is_callable('test', 'POST'))
self.assertFalse(self.dajaxice.is_callable('test', 'GET'))
def test_clean_method(self):
self.assertEqual(self.dajaxice.clean_method('post'), 'POST')
self.assertEqual(self.dajaxice.clean_method('get'), 'GET')
self.assertEqual(self.dajaxice.clean_method('POST'), 'POST')
self.assertEqual(self.dajaxice.clean_method('GET'), 'GET')
self.assertEqual(self.dajaxice.clean_method('other'), 'POST')
def test_modules(self):
self.dajaxice.register(self.function, 'foo')
self.dajaxice.register(self.function, 'bar')
self.assertEqual(type(self.dajaxice.modules), DajaxiceModule)
self.assertEqual(self.dajaxice.modules.functions.keys(), ['foo', 'bar'])
class DajaxiceConfigTest(TestCase):
def setUp(self):
self.config = DajaxiceConfig()
def test_defaults(self):
self.assertTrue(self.config.DAJAXICE_XMLHTTPREQUEST_JS_IMPORT)
self.assertTrue(self.config.DAJAXICE_JSON2_JS_IMPORT)
self.assertEqual(self.config.DAJAXICE_EXCEPTION, 'DAJAXICE_EXCEPTION')
self.assertEqual(self.config.DAJAXICE_MEDIA_PREFIX, 'dajaxice')
dajaxice_url = r'^%s/' % self.config.DAJAXICE_MEDIA_PREFIX
self.assertEqual(self.config.dajaxice_url, dajaxice_url)
self.assertEqual(type(self.config.modules), DajaxiceModule)
class DjangoIntegrationTest(TestCase): class DjangoIntegrationTest(TestCase):
@ -48,127 +116,50 @@ class DjangoIntegrationTest(TestCase):
urls = 'dajaxice.tests.urls' urls = 'dajaxice.tests.urls'
def setUp(self): def setUp(self):
settings.DAJAXICE_MEDIA_PREFIX = "dajaxice" settings.INSTALLED_APPS += ('dajaxice.tests',)
settings.DAJAXICE_DEBUG = False
settings.INSTALLED_APPS += ('dajaxice.tests', 'dajaxice.tests.submodules',)
os.environ['DJANGO_SETTINGS_MODULE'] = 'dajaxice'
def test_calling_not_registered_function(self): def test_calling_not_registered_function(self):
self.failUnlessRaises(FunctionNotCallableError, self.client.post, '/dajaxice/dajaxice.tests.this_function_not_exist/', {'callback': 'my_callback'}) self.failUnlessRaises(FunctionNotCallableError, self.client.post, '/dajaxice/dajaxice.tests.this_function_not_exist/')
def test_calling_registered_function(self): def test_calling_registered_function(self):
response = self.client.post('/dajaxice/dajaxice.tests.test_foo/', {'callback': 'my_callback'}) response = self.client.post('/dajaxice/dajaxice.tests.test_foo/')
self.failUnlessEqual(response.status_code, 200) self.failUnlessEqual(response.status_code, 200)
self.failUnlessEqual(response.content, 'my_callback()') self.failUnlessEqual(response.content, '{"foo": "bar"}')
def test_calling_registered_function_with_params(self): def test_calling_registered_function_with_params(self):
response = self.client.post('/dajaxice/dajaxice.tests.test_foo_with_params/', {'callback': 'my_callback', 'argv': '{"param1":"value1"}'}) response = self.client.post('/dajaxice/dajaxice.tests.test_foo_with_params/', {'argv': '{"param1":"value1"}'})
self.failUnlessEqual(response.status_code, 200) self.failUnlessEqual(response.status_code, 200)
self.failUnlessEqual(response.content, 'my_callback("value1")') self.failUnlessEqual(response.content, '{"param1": "value1"}')
def test_bad_function(self): def test_bad_function(self):
response = self.client.post('/dajaxice/dajaxice.tests.test_ajax_exception/', {'callback': 'my_callback'}) response = self.client.post('/dajaxice/dajaxice.tests.test_ajax_exception/')
self.failUnlessEqual(response.status_code, 200) self.failUnlessEqual(response.status_code, 200)
self.failUnlessEqual(response.content, "my_callback('DAJAXICE_EXCEPTION')") self.failUnlessEqual(response.content, "DAJAXICE_EXCEPTION")
def test_is_callable(self): def test_get_register(self):
dr = DajaxiceRequest(None, 'dajaxice.tests.test_registered_function') response = self.client.get('/dajaxice/dajaxice.tests.test_get_register/')
self.failUnless(dr._is_callable())
dr = DajaxiceRequest(None, 'dajaxice.tests.test_ajax_not_registered') self.failUnlessEqual(response.status_code, 200)
self.failIf(dr._is_callable()) self.failUnlessEqual(response.content, '{"foo": "user"}')
def test_get_js_functions(self): def test_get_custom_name_register(self):
js_functions = DajaxiceRequest.get_js_functions() response = self.client.get('/dajaxice/get_user_data/')
functions = [DajaxiceFunction('test_registered_function', 'dajaxice.tests.ajax.test_registered_function'), self.failUnlessEqual(response.status_code, 200)
DajaxiceFunction('test_string', 'dajaxice.tests.ajax.test_string'), self.failUnlessEqual(response.content, '{"bar": "user"}')
DajaxiceFunction('test_ajax_exception', 'dajaxice.tests.ajax.test_ajax_exception'),
DajaxiceFunction('test_foo', 'dajaxice.tests.ajax.test_foo'),
DajaxiceFunction('test_foo_with_params', 'dajaxice.tests.ajax.test_foo_with_params'),
DajaxiceFunction('test_submodule_registered_function', 'dajaxice.tests.submodules.ajax.test_submodule_registered_function')]
callables = [f.path for f in functions] def test_multi_register(self):
self.failUnlessEqual(len(js_functions), 1) response = self.client.get('/dajaxice/get_multi/')
self.failUnlessEqual(dajaxice_functions._callable, callables) self.failUnlessEqual(response.status_code, 200)
self.failUnlessEqual(response.content, '{"foo": "multi"}')
sub = js_functions[0] response = self.client.post('/dajaxice/post_multi/')
self.failUnlessEqual(len(sub.sub_modules), 1) self.failUnlessEqual(response.status_code, 200)
self.failUnlessEqual(len(sub.functions), 0) self.failUnlessEqual(response.content, '{"foo": "multi"}')
self.failUnlessEqual(sub.name, 'dajaxice')
sub = js_functions[0].sub_modules[0]
self.failUnlessEqual(len(sub.sub_modules), 1)
self.failUnlessEqual(len(sub.functions), 5)
self.failUnlessEqual(sub.functions, functions[:-1])
self.failUnlessEqual(sub.name, 'tests')
sub = js_functions[0].sub_modules[0].sub_modules[0]
self.failUnlessEqual(len(sub.sub_modules), 0)
self.failUnlessEqual(len(sub.functions), 1)
self.failUnlessEqual(sub.functions, functions[-1:])
self.failUnlessEqual(sub.name, 'submodules')
def test_get_ajax_function(self):
# Test modern Import with a real ajax function
dr = DajaxiceRequest(None, 'dajaxice.tests.test_foo')
function = dr._modern_get_ajax_function()
self.failUnless(hasattr(function, '__call__'))
# Test modern Import without a real ajax function
dr = DajaxiceRequest(None, 'dajaxice.tests.test_foo2')
self.failUnlessRaises(DajaxiceImportError, dr._modern_get_ajax_function)
class DajaxiceFunctionTest(unittest.TestCase):
def setUp(self):
self.function = DajaxiceFunction('my_function', 'module.submodule.foo.ajax')
def test_constructor(self):
self.failUnlessEqual(self.function.name, 'my_function')
self.failUnlessEqual(self.function.path, 'module.submodule.foo.ajax')
def test_get_callable_path(self):
self.failUnlessEqual(self.function.get_callable_path(), 'module.submodule.foo.my_function')
class DajaxiceModuleTest(unittest.TestCase):
def setUp(self):
self.module = DajaxiceModule('module.submodule.foo.ajax'.split('.'))
def test_constructor(self):
self.failUnlessEqual(self.module.functions, [])
self.failUnlessEqual(self.module.name, 'module')
self.failUnlessEqual(len(self.module.sub_modules), 1)
def test_add_function(self):
function = DajaxiceFunction('my_function', 'module.submodule.foo.ajax')
self.failUnlessEqual(len(self.module.functions), 0)
self.module.add_function(function)
self.failUnlessEqual(len(self.module.functions), 1)
def test_has_sub_modules(self):
self.failUnlessEqual(self.module.has_sub_modules(), True)
def test_exist_submodule(self):
self.failUnlessEqual(self.module.exist_submodule('submodule'), 0)
self.assertFalse(self.module.exist_submodule('other'))
self.module.add_submodule('other.foo'.split('.'))
self.failUnlessEqual(self.module.exist_submodule('other'), 1)
def test_add_submodule(self):
self.failUnlessEqual(len(self.module.sub_modules), 1)
self.module.add_submodule('other.foo'.split('.'))
self.failUnlessEqual(len(self.module.sub_modules), 2)
self.assertTrue(type(self.module.sub_modules[1]), DajaxiceModule)

View file

@ -1,61 +1,43 @@
#---------------------------------------------------------------------- import json
# Copyright (c) 2009-2011 Benito Jorge Bastida from dajaxice.decorators import dajaxice_register
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# o Redistributions of source code must retain the above copyright
# notice, this list of conditions, and the disclaimer that follows.
#
# o Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# o Neither the name of Digital Creations nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS
# IS* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL
# CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
#----------------------------------------------------------------------
from django.utils import simplejson
from dajaxice.core import dajaxice_functions
@dajaxice_register
def test_registered_function(request): def test_registered_function(request):
return "" return ""
dajaxice_functions.register(test_registered_function)
@dajaxice_register
def test_string(request): def test_string(request):
return simplejson.dumps({'string': 'hello world'}) return json.dumps({'string': 'hello world'})
dajaxice_functions.register(test_string)
@dajaxice_register
def test_ajax_exception(request): def test_ajax_exception(request):
raise Exception() raise Exception()
return
dajaxice_functions.register(test_ajax_exception)
@dajaxice_register
def test_foo(request): def test_foo(request):
return "" return json.dumps({'foo': 'bar'})
dajaxice_functions.register(test_foo)
@dajaxice_register
def test_foo_with_params(request, param1): def test_foo_with_params(request, param1):
return simplejson.dumps(param1) return json.dumps({'param1': param1})
dajaxice_functions.register(test_foo_with_params)
@dajaxice_register(method='GET')
def test_get_register(request):
return json.dumps({'foo': 'user'})
@dajaxice_register(method='GET', name="get_user_data")
def test_get_with_name_register(request):
return json.dumps({'bar': 'user'})
@dajaxice_register(method='GET', name="get_multi")
@dajaxice_register(name="post_multi")
def test_multi_register(request):
return json.dumps({'foo': 'multi'})

View file

@ -1,40 +0,0 @@
#----------------------------------------------------------------------
# Copyright (c) 2009-2011 Benito Jorge Bastida
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# o Redistributions of source code must retain the above copyright
# notice, this list of conditions, and the disclaimer that follows.
#
# o Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# o Neither the name of Digital Creations nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS
# IS* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL
# CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
#----------------------------------------------------------------------
from dajaxice.core import dajaxice_functions
def test_submodule_registered_function(request):
return ""
dajaxice_functions.register(test_submodule_registered_function)

View file

@ -1,44 +1,10 @@
#----------------------------------------------------------------------
# Copyright (c) 2009-2011 Benito Jorge Bastida
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# o Redistributions of source code must retain the above copyright
# notice, this list of conditions, and the disclaimer that follows.
#
# o Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# o Neither the name of Digital Creations nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS
# IS* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL
# CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
#----------------------------------------------------------------------
from django.conf.urls.defaults import * from django.conf.urls.defaults import *
from django.conf import settings
from dajaxice.core import dajaxice_autodiscover
from dajaxice.core import dajaxice_autodiscover, dajaxice_config
dajaxice_autodiscover() dajaxice_autodiscover()
urlpatterns = patterns('', urlpatterns = patterns('',
#Dajaxice URLS #Dajaxice URLS
(r'^%s/' % settings.DAJAXICE_MEDIA_PREFIX, include('dajaxice.urls')), url(dajaxice_config.dajaxice_url, include('dajaxice.urls')),
) )

View file

@ -1,39 +1,7 @@
#---------------------------------------------------------------------- from django.conf.urls import *
# Copyright (c) 2009-2011 Benito Jorge Bastida from .views import DajaxiceRequest
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# o Redistributions of source code must retain the above copyright
# notice, this list of conditions, and the disclaimer that follows.
#
# o Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# o Neither the name of Digital Creations nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS
# IS* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL
# CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
#----------------------------------------------------------------------
from django.conf.urls.defaults import * urlpatterns = patterns('dajaxice.views',
url(r'^(.+)/$', DajaxiceRequest.as_view(), name='dajaxice-call-endpoint'),
url(r'', DajaxiceRequest.as_view(), name='dajaxice-endpoint'),
urlpatterns = patterns('', )
url(r'^dajaxice.core.js$', 'dajaxice.views.js_core'),
url(r'^(.*)/$', 'dajaxice.views.dajaxice_request'),)

View file

@ -1,50 +1,8 @@
#---------------------------------------------------------------------- from django.http import QueryDict
# Copyright (c) 2009-2011 Benito Jorge Bastida
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# o Redistributions of source code must retain the above copyright
# notice, this list of conditions, and the disclaimer that follows.
#
# o Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# o Neither the name of Digital Creations nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS
# IS* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL
# CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
#----------------------------------------------------------------------
def deserialize_form(data): def deserialize_form(data):
""" """
Create a new QueryDict from a serialized form. Create a new QueryDict from a serialized form.
""" """
from django.http import QueryDict return QueryDict(query_string=unicode(data).encode('utf-8'))
data = QueryDict(query_string=unicode(data).encode('utf-8'))
return data
def simple_import_module(name):
"""
Reduced version of import_module
"""
import sys
__import__(name)
return sys.modules[name]

View file

@ -1,62 +1,60 @@
#---------------------------------------------------------------------- import logging, json
# Copyright (c) 2009-2011 Benito Jorge Bastida
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# o Redistributions of source code must retain the above copyright
# notice, this list of conditions, and the disclaimer that follows.
#
# o Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# o Neither the name of Digital Creations nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS
# IS* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL
# CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
#----------------------------------------------------------------------
from django.shortcuts import render_to_response from django.conf import settings
from django.views.decorators.cache import cache_control from django.views.generic.base import View
from django.http import HttpResponse, Http404
from dajaxice.core import DajaxiceRequest from dajaxice.exceptions import FunctionNotCallableError
from dajaxice.core import dajaxice_functions, dajaxice_config
log = logging.getLogger('dajaxice')
def dajaxice_request(request, call): def safe_dict(d):
""" """
dajaxice_request Recursively clone json structure with UTF-8 dictionary keys
Uses DajaxRequest to handle dajax request. http://www.gossamer-threads.com/lists/python/bugs/684379
Return the apropiate json according app_name and method.
""" """
return DajaxiceRequest(request, call).process() if isinstance(d, dict):
return dict([(k.encode('utf-8'), safe_dict(v)) for k, v in d.iteritems()])
elif isinstance(d, list):
return [safe_dict(x) for x in d]
else:
return d
@cache_control(max_age=DajaxiceRequest.get_cache_control()) class DajaxiceRequest(View):
def js_core(request): """ Handle all the dajaxice xhr requests. """
"""
Return the dajax JS code according settings.DAJAXICE_FUNCTIONS
registered functions.
"""
data = {'dajaxice_js_functions': DajaxiceRequest.get_js_functions(),
'DAJAXICE_URL_PREFIX': DajaxiceRequest.get_media_prefix(),
'DAJAXICE_XMLHTTPREQUEST_JS_IMPORT': DajaxiceRequest.get_xmlhttprequest_js_import(),
'DAJAXICE_JSON2_JS_IMPORT': DajaxiceRequest.get_json2_js_import(),
'DAJAXICE_EXCEPTION': DajaxiceRequest.get_exception_message(),
'DAJAXICE_JS_DOCSTRINGS': DajaxiceRequest.get_js_docstrings()}
return render_to_response('dajaxice/dajaxice.core.js', data, mimetype="text/javascript") def dispatch(self, request, name=None):
if not name:
raise Http404
# Check if the function is callable
if dajaxice_functions.is_callable(name, request.method):
function = dajaxice_functions.get(name)
data = getattr(request, function.method).get('argv', '')
# Clean the argv
if data != 'undefined':
try:
data = safe_dict(json.loads(data))
except Exception:
data = {}
else:
data = {}
# Call the function. If something goes wrong, handle the Exception
try:
response = function.call(request, **data)
except Exception:
raise # always give us a backtrace
if settings.DEBUG:
raise
response = dajaxice_config.DAJAXICE_EXCEPTION
return HttpResponse(response, mimetype="application/x-json")
else:
raise FunctionNotCallableError(name)

1
django/.gitignore vendored
View file

@ -1 +0,0 @@
/*.pyc

View file

@ -1,16 +1,7 @@
VERSION = (1, 2, 7, 'final', 0) VERSION = (1, 6, 0, 'final', 0)
def get_version(): def get_version(*args, **kwargs):
version = '%s.%s' % (VERSION[0], VERSION[1]) # Don't litter django/__init__.py with all the get_version stuff.
if VERSION[2]: # Only import if it's actually called.
version = '%s.%s' % (version, VERSION[2]) from django.utils.version import get_version
if VERSION[3:] == ('alpha', 0): return get_version(*args, **kwargs)
version = '%s pre-alpha' % version
else:
if VERSION[3] != 'final':
version = '%s %s %s' % (version, VERSION[3], VERSION[4])
from django.utils.version import get_svn_revision
svn_rev = get_svn_revision()
if svn_rev != u'SVN-unknown':
version = "%s %s" % (version, svn_rev)
return version

View file

@ -1 +0,0 @@
/*.pyc

View file

@ -1,11 +0,0 @@
#!/usr/bin/env python
if __name__ == "__main__":
import sys
name = sys.argv[0]
args = ' '.join(sys.argv[1:])
print >> sys.stderr, "%s has been moved into django-admin.py" % name
print >> sys.stderr, 'Please run "django-admin.py compilemessages %s" instead.'% args
print >> sys.stderr
sys.exit(1)

View file

@ -7,7 +7,13 @@ Can be run as a cronjob to clean out old data from the database (only expired
sessions at the moment). sessions at the moment).
""" """
import warnings
from django.core import management from django.core import management
if __name__ == "__main__": if __name__ == "__main__":
management.call_command('cleanup') warnings.warn(
"The `daily_cleanup` script has been deprecated "
"in favor of `django-admin.py clearsessions`.",
DeprecationWarning)
management.call_command('clearsessions')

10
django/bin/django-2to3.py Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env python
# This works exactly like 2to3, except that it uses Django's fixers rather
# than 2to3's built-in fixers.
import sys
from lib2to3.main import main
sys.exit(main("django.utils.2to3_fixes"))

View file

@ -1,11 +0,0 @@
#!/usr/bin/env python
if __name__ == "__main__":
import sys
name = sys.argv[0]
args = ' '.join(sys.argv[1:])
print >> sys.stderr, "%s has been moved into django-admin.py" % name
print >> sys.stderr, 'Please run "django-admin.py makemessages %s" instead.'% args
print >> sys.stderr
sys.exit(1)

View file

@ -1 +0,0 @@
/*.pyc

View file

@ -8,8 +8,9 @@ hotshot.stats (the formats are incompatible)
""" """
from hotshot import stats from hotshot import stats
import os
import pstats import pstats
import sys, os import sys
def gather_stats(p): def gather_stats(p):
profiles = {} profiles = {}
@ -23,7 +24,7 @@ def gather_stats(p):
prof = stats.load(os.path.join(p, f)) prof = stats.load(os.path.join(p, f))
else: else:
continue continue
print "Processing %s" % f print("Processing %s" % f)
if path in profiles: if path in profiles:
profiles[path].add(prof) profiles[path].add(prof)
else: else:

View file

@ -11,7 +11,7 @@ def unique_messages():
elif os.path.isdir('locale'): elif os.path.isdir('locale'):
basedir = os.path.abspath('locale') basedir = os.path.abspath('locale')
else: else:
print "this script should be run from the django svn tree or your project or app tree" print("This script should be run from the Django Git tree or your project or app tree.")
sys.exit(1) sys.exit(1)
for (dirpath, dirnames, filenames) in os.walk(basedir): for (dirpath, dirnames, filenames) in os.walk(basedir):
@ -22,7 +22,8 @@ def unique_messages():
cmd = 'msguniq "%s.po"' % pf cmd = 'msguniq "%s.po"' % pf
stdout = os.popen(cmd) stdout = os.popen(cmd)
msg = stdout.read() msg = stdout.read()
open('%s.po' % pf, 'w').write(msg) with open('%s.po' % pf, 'w') as fp:
fp.write(msg)
if __name__ == "__main__": if __name__ == "__main__":
unique_messages() unique_messages()

View file

@ -1 +0,0 @@
/*.pyc

View file

@ -6,23 +6,29 @@ variable, and then from django.conf.global_settings; see the global settings fil
a list of all possible variables. a list of all possible variables.
""" """
import logging
import os import os
import re import sys
import time # Needed for Windows import time # Needed for Windows
import warnings
from django.conf import global_settings from django.conf import global_settings
from django.utils.functional import LazyObject from django.core.exceptions import ImproperlyConfigured
from django.utils.functional import LazyObject, empty
from django.utils import importlib from django.utils import importlib
from django.utils.module_loading import import_by_path
from django.utils import six
ENVIRONMENT_VARIABLE = "DJANGO_SETTINGS_MODULE" ENVIRONMENT_VARIABLE = "DJANGO_SETTINGS_MODULE"
class LazySettings(LazyObject): class LazySettings(LazyObject):
""" """
A lazy proxy for either global Django settings or a custom settings object. A lazy proxy for either global Django settings or a custom settings object.
The user can manually configure settings prior to using them. Otherwise, The user can manually configure settings prior to using them. Otherwise,
Django uses the settings module pointed to by DJANGO_SETTINGS_MODULE. Django uses the settings module pointed to by DJANGO_SETTINGS_MODULE.
""" """
def _setup(self): def _setup(self, name=None):
""" """
Load the settings module pointed to by the environment variable. This Load the settings module pointed to by the environment variable. This
is used the first time we need any settings at all, if the user has not is used the first time we need any settings at all, if the user has not
@ -33,11 +39,45 @@ class LazySettings(LazyObject):
if not settings_module: # If it's set but is an empty string. if not settings_module: # If it's set but is an empty string.
raise KeyError raise KeyError
except KeyError: except KeyError:
# NOTE: This is arguably an EnvironmentError, but that causes desc = ("setting %s" % name) if name else "settings"
# problems with Python's interactive help. raise ImproperlyConfigured(
raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE) "Requested %s, but settings are not configured. "
"You must either define the environment variable %s "
"or call settings.configure() before accessing settings."
% (desc, ENVIRONMENT_VARIABLE))
self._wrapped = Settings(settings_module) self._wrapped = Settings(settings_module)
self._configure_logging()
def __getattr__(self, name):
if self._wrapped is empty:
self._setup(name)
return getattr(self._wrapped, name)
def _configure_logging(self):
"""
Setup logging from LOGGING_CONFIG and LOGGING settings.
"""
if not sys.warnoptions:
try:
# Route warnings through python logging
logging.captureWarnings(True)
# Allow DeprecationWarnings through the warnings filters
warnings.simplefilter("default", DeprecationWarning)
except AttributeError:
# No captureWarnings on Python 2.6, DeprecationWarnings are on anyway
pass
if self.LOGGING_CONFIG:
from django.utils.log import DEFAULT_LOGGING
# First find the logging configuration function ...
logging_config_func = import_by_path(self.LOGGING_CONFIG)
logging_config_func(DEFAULT_LOGGING)
# ... then invoke it with the logging settings
if self.LOGGING:
logging_config_func(self.LOGGING)
def configure(self, default_settings=global_settings, **options): def configure(self, default_settings=global_settings, **options):
""" """
@ -45,21 +85,36 @@ class LazySettings(LazyObject):
parameter sets where to retrieve any unspecified values from (its parameter sets where to retrieve any unspecified values from (its
argument must support attribute access (__getattr__)). argument must support attribute access (__getattr__)).
""" """
if self._wrapped != None: if self._wrapped is not empty:
raise RuntimeError('Settings already configured.') raise RuntimeError('Settings already configured.')
holder = UserSettingsHolder(default_settings) holder = UserSettingsHolder(default_settings)
for name, value in options.items(): for name, value in options.items():
setattr(holder, name, value) setattr(holder, name, value)
self._wrapped = holder self._wrapped = holder
self._configure_logging()
@property
def configured(self): def configured(self):
""" """
Returns True if the settings have already been configured. Returns True if the settings have already been configured.
""" """
return bool(self._wrapped) return self._wrapped is not empty
configured = property(configured)
class Settings(object):
class BaseSettings(object):
"""
Common logic for settings whether set by a module or by the user.
"""
def __setattr__(self, name, value):
if name in ("MEDIA_URL", "STATIC_URL") and value and not value.endswith('/'):
raise ImproperlyConfigured("If set, %s must end with a slash" % name)
elif name == "ALLOWED_INCLUDE_ROOTS" and isinstance(value, six.string_types):
raise ValueError("The ALLOWED_INCLUDE_ROOTS setting must be set "
"to a tuple, not a string.")
object.__setattr__(self, name, value)
class Settings(BaseSettings):
def __init__(self, settings_module): def __init__(self, settings_module):
# update this dict from global settings (but only for ALL_CAPS settings) # update this dict from global settings (but only for ALL_CAPS settings)
for setting in dir(global_settings): for setting in dir(global_settings):
@ -71,8 +126,11 @@ class Settings(object):
try: try:
mod = importlib.import_module(self.SETTINGS_MODULE) mod = importlib.import_module(self.SETTINGS_MODULE)
except ImportError, e: except ImportError as e:
raise ImportError("Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)) raise ImportError(
"Could not import settings '%s' (Is it on sys.path? Is there an import error in the settings file?): %s"
% (self.SETTINGS_MODULE, e)
)
# Settings that should be converted into tuples if they're mistakenly entered # Settings that should be converted into tuples if they're mistakenly entered
# as strings. # as strings.
@ -81,34 +139,31 @@ class Settings(object):
for setting in dir(mod): for setting in dir(mod):
if setting == setting.upper(): if setting == setting.upper():
setting_value = getattr(mod, setting) setting_value = getattr(mod, setting)
if setting in tuple_settings and type(setting_value) == str: if setting in tuple_settings and \
isinstance(setting_value, six.string_types):
warnings.warn("The %s setting must be a tuple. Please fix your "
"settings, as auto-correction is now deprecated." % setting,
DeprecationWarning, stacklevel=2)
setting_value = (setting_value,) # In case the user forgot the comma. setting_value = (setting_value,) # In case the user forgot the comma.
setattr(self, setting, setting_value) setattr(self, setting, setting_value)
# Expand entries in INSTALLED_APPS like "django.contrib.*" to a list if not self.SECRET_KEY:
# of all those apps. raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
new_installed_apps = []
for app in self.INSTALLED_APPS:
if app.endswith('.*'):
app_mod = importlib.import_module(app[:-2])
appdir = os.path.dirname(app_mod.__file__)
app_subdirs = os.listdir(appdir)
app_subdirs.sort()
name_pattern = re.compile(r'[a-zA-Z]\w*')
for d in app_subdirs:
if name_pattern.match(d) and os.path.isdir(os.path.join(appdir, d)):
new_installed_apps.append('%s.%s' % (app[:-2], d))
else:
new_installed_apps.append(app)
self.INSTALLED_APPS = new_installed_apps
if hasattr(time, 'tzset') and getattr(self, 'TIME_ZONE'): if hasattr(time, 'tzset') and self.TIME_ZONE:
# When we can, attempt to validate the timezone. If we can't find
# this file, no check happens and it's harmless.
zoneinfo_root = '/usr/share/zoneinfo'
if (os.path.exists(zoneinfo_root) and not
os.path.exists(os.path.join(zoneinfo_root, *(self.TIME_ZONE.split('/'))))):
raise ValueError("Incorrect timezone setting: %s" % self.TIME_ZONE)
# Move the time zone info into os.environ. See ticket #2315 for why # Move the time zone info into os.environ. See ticket #2315 for why
# we don't do this unconditionally (breaks Windows). # we don't do this unconditionally (breaks Windows).
os.environ['TZ'] = self.TIME_ZONE os.environ['TZ'] = self.TIME_ZONE
time.tzset() time.tzset()
class UserSettingsHolder(object):
class UserSettingsHolder(BaseSettings):
""" """
Holder for user configured settings. Holder for user configured settings.
""" """
@ -121,16 +176,23 @@ class UserSettingsHolder(object):
Requests for configuration variables not in this class are satisfied Requests for configuration variables not in this class are satisfied
from the module specified in default_settings (if possible). from the module specified in default_settings (if possible).
""" """
self.__dict__['_deleted'] = set()
self.default_settings = default_settings self.default_settings = default_settings
def __getattr__(self, name): def __getattr__(self, name):
if name in self._deleted:
raise AttributeError
return getattr(self.default_settings, name) return getattr(self.default_settings, name)
def __dir__(self): def __setattr__(self, name, value):
return self.__dict__.keys() + dir(self.default_settings) self._deleted.discard(name)
return super(UserSettingsHolder, self).__setattr__(name, value)
# For Python < 2.6: def __delattr__(self, name):
__members__ = property(lambda self: self.__dir__()) self._deleted.add(name)
return super(UserSettingsHolder, self).__delattr__(name)
def __dir__(self):
return list(self.__dict__) + dir(self.default_settings)
settings = LazySettings() settings = LazySettings()

View file

@ -1 +0,0 @@
/*.pyc

View file

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

View file

@ -1,23 +1,3 @@
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase from django.test import TestCase
class SimpleTest(TestCase): # Create your tests here.
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
"""
self.failUnlessEqual(1 + 1, 2)
__test__ = {"doctest": """
Another way to test that 1 + 1 is equal to 2.
>>> 1 + 1 == 2
True
"""}

View file

@ -1 +1,3 @@
from django.shortcuts import render
# Create your views here. # Create your views here.

View file

@ -13,7 +13,7 @@ DEBUG = False
TEMPLATE_DEBUG = False TEMPLATE_DEBUG = False
# Whether the framework should propagate raw exceptions rather than catching # Whether the framework should propagate raw exceptions rather than catching
# them. This is useful under some testing siutations and should never be used # them. This is useful under some testing situations and should never be used
# on a live site. # on a live site.
DEBUG_PROPAGATE_EXCEPTIONS = False DEBUG_PROPAGATE_EXCEPTIONS = False
@ -21,7 +21,7 @@ DEBUG_PROPAGATE_EXCEPTIONS = False
USE_ETAGS = False USE_ETAGS = False
# People who get code error notifications. # People who get code error notifications.
# In the format (('Full Name', 'email@domain.com'), ('Full Name', 'anotheremail@domain.com')) # In the format (('Full Name', 'email@example.com'), ('Full Name', 'anotheremail@example.com'))
ADMINS = () ADMINS = ()
# Tuple of IP addresses, as strings, that: # Tuple of IP addresses, as strings, that:
@ -29,21 +29,32 @@ ADMINS = ()
# * Receive x-headers # * Receive x-headers
INTERNAL_IPS = () INTERNAL_IPS = ()
# Hosts/domain names that are valid for this site.
# "*" matches anything, ".example.com" matches example.com and all subdomains
ALLOWED_HOSTS = []
# Local time zone for this installation. All choices can be found here: # Local time zone for this installation. All choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name (although not all # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name (although not all
# systems may support all possibilities). # systems may support all possibilities). When USE_TZ is True, this is
# interpreted as the default user time zone.
TIME_ZONE = 'America/Chicago' TIME_ZONE = 'America/Chicago'
# If you set this to True, Django will use timezone-aware datetimes.
USE_TZ = False
# Language code for this installation. All choices can be found here: # Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html # http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = 'en-us'
# Languages we provide translations for, out of the box. The language name # Languages we provide translations for, out of the box.
# should be the utf-8 encoded local name for the language.
LANGUAGES = ( LANGUAGES = (
('af', gettext_noop('Afrikaans')),
('ar', gettext_noop('Arabic')), ('ar', gettext_noop('Arabic')),
('az', gettext_noop('Azerbaijani')),
('bg', gettext_noop('Bulgarian')), ('bg', gettext_noop('Bulgarian')),
('be', gettext_noop('Belarusian')),
('bn', gettext_noop('Bengali')), ('bn', gettext_noop('Bengali')),
('br', gettext_noop('Breton')),
('bs', gettext_noop('Bosnian')), ('bs', gettext_noop('Bosnian')),
('ca', gettext_noop('Catalan')), ('ca', gettext_noop('Catalan')),
('cs', gettext_noop('Czech')), ('cs', gettext_noop('Czech')),
@ -53,8 +64,12 @@ LANGUAGES = (
('el', gettext_noop('Greek')), ('el', gettext_noop('Greek')),
('en', gettext_noop('English')), ('en', gettext_noop('English')),
('en-gb', gettext_noop('British English')), ('en-gb', gettext_noop('British English')),
('eo', gettext_noop('Esperanto')),
('es', gettext_noop('Spanish')), ('es', gettext_noop('Spanish')),
('es-ar', gettext_noop('Argentinian Spanish')), ('es-ar', gettext_noop('Argentinian Spanish')),
('es-mx', gettext_noop('Mexican Spanish')),
('es-ni', gettext_noop('Nicaraguan Spanish')),
('es-ve', gettext_noop('Venezuelan Spanish')),
('et', gettext_noop('Estonian')), ('et', gettext_noop('Estonian')),
('eu', gettext_noop('Basque')), ('eu', gettext_noop('Basque')),
('fa', gettext_noop('Persian')), ('fa', gettext_noop('Persian')),
@ -67,23 +82,29 @@ LANGUAGES = (
('hi', gettext_noop('Hindi')), ('hi', gettext_noop('Hindi')),
('hr', gettext_noop('Croatian')), ('hr', gettext_noop('Croatian')),
('hu', gettext_noop('Hungarian')), ('hu', gettext_noop('Hungarian')),
('ia', gettext_noop('Interlingua')),
('id', gettext_noop('Indonesian')), ('id', gettext_noop('Indonesian')),
('is', gettext_noop('Icelandic')), ('is', gettext_noop('Icelandic')),
('it', gettext_noop('Italian')), ('it', gettext_noop('Italian')),
('ja', gettext_noop('Japanese')), ('ja', gettext_noop('Japanese')),
('ka', gettext_noop('Georgian')), ('ka', gettext_noop('Georgian')),
('kk', gettext_noop('Kazakh')),
('km', gettext_noop('Khmer')), ('km', gettext_noop('Khmer')),
('kn', gettext_noop('Kannada')), ('kn', gettext_noop('Kannada')),
('ko', gettext_noop('Korean')), ('ko', gettext_noop('Korean')),
('lb', gettext_noop('Luxembourgish')),
('lt', gettext_noop('Lithuanian')), ('lt', gettext_noop('Lithuanian')),
('lv', gettext_noop('Latvian')), ('lv', gettext_noop('Latvian')),
('mk', gettext_noop('Macedonian')), ('mk', gettext_noop('Macedonian')),
('ml', gettext_noop('Malayalam')), ('ml', gettext_noop('Malayalam')),
('mn', gettext_noop('Mongolian')), ('mn', gettext_noop('Mongolian')),
('nl', gettext_noop('Dutch')), ('my', gettext_noop('Burmese')),
('no', gettext_noop('Norwegian')),
('nb', gettext_noop('Norwegian Bokmal')), ('nb', gettext_noop('Norwegian Bokmal')),
('ne', gettext_noop('Nepali')),
('nl', gettext_noop('Dutch')),
('nn', gettext_noop('Norwegian Nynorsk')), ('nn', gettext_noop('Norwegian Nynorsk')),
('os', gettext_noop('Ossetic')),
('pa', gettext_noop('Punjabi')),
('pl', gettext_noop('Polish')), ('pl', gettext_noop('Polish')),
('pt', gettext_noop('Portuguese')), ('pt', gettext_noop('Portuguese')),
('pt-br', gettext_noop('Brazilian Portuguese')), ('pt-br', gettext_noop('Brazilian Portuguese')),
@ -95,18 +116,22 @@ LANGUAGES = (
('sr', gettext_noop('Serbian')), ('sr', gettext_noop('Serbian')),
('sr-latn', gettext_noop('Serbian Latin')), ('sr-latn', gettext_noop('Serbian Latin')),
('sv', gettext_noop('Swedish')), ('sv', gettext_noop('Swedish')),
('sw', gettext_noop('Swahili')),
('ta', gettext_noop('Tamil')), ('ta', gettext_noop('Tamil')),
('te', gettext_noop('Telugu')), ('te', gettext_noop('Telugu')),
('th', gettext_noop('Thai')), ('th', gettext_noop('Thai')),
('tr', gettext_noop('Turkish')), ('tr', gettext_noop('Turkish')),
('tt', gettext_noop('Tatar')),
('udm', gettext_noop('Udmurt')),
('uk', gettext_noop('Ukrainian')), ('uk', gettext_noop('Ukrainian')),
('ur', gettext_noop('Urdu')),
('vi', gettext_noop('Vietnamese')), ('vi', gettext_noop('Vietnamese')),
('zh-cn', gettext_noop('Simplified Chinese')), ('zh-cn', gettext_noop('Simplified Chinese')),
('zh-tw', gettext_noop('Traditional Chinese')), ('zh-tw', gettext_noop('Traditional Chinese')),
) )
# Languages using BiDi (right-to-left) layout # Languages using BiDi (right-to-left) layout
LANGUAGES_BIDI = ("he", "ar", "fa") LANGUAGES_BIDI = ("he", "ar", "fa", "ur")
# If you set this to False, Django will make some optimizations so as not # If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery. # to load the internationalization machinery.
@ -115,11 +140,11 @@ LOCALE_PATHS = ()
LANGUAGE_COOKIE_NAME = 'django_language' LANGUAGE_COOKIE_NAME = 'django_language'
# If you set this to True, Django will format dates, numbers and calendars # If you set this to True, Django will format dates, numbers and calendars
# according to user current locale # according to user current locale.
USE_L10N = False USE_L10N = False
# Not-necessarily-technical managers of the site. They get broken link # Not-necessarily-technical managers of the site. They get broken link
# notifications and other various e-mails. # notifications and other various emails.
MANAGERS = ADMINS MANAGERS = ADMINS
# Default content type and charset to use for all HttpResponse objects, if a # Default content type and charset to use for all HttpResponse objects, if a
@ -131,27 +156,16 @@ DEFAULT_CHARSET = 'utf-8'
# Encoding of files read from disk (template and initial SQL files). # Encoding of files read from disk (template and initial SQL files).
FILE_CHARSET = 'utf-8' FILE_CHARSET = 'utf-8'
# E-mail address that error messages come from. # Email address that error messages come from.
SERVER_EMAIL = 'root@localhost' SERVER_EMAIL = 'root@localhost'
# Whether to send broken-link e-mails. # Whether to send broken-link emails. Deprecated, must be removed in 1.8.
SEND_BROKEN_LINK_EMAILS = False SEND_BROKEN_LINK_EMAILS = False
# Database connection info. # Database connection info. If left empty, will default to the dummy backend.
# Legacy format DATABASES = {}
DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = '' # Or path to database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
DATABASE_OPTIONS = {} # Set to empty dictionary for default.
# New format # Classes used to implement DB routing behavior.
DATABASES = {
}
# Classes used to implement db routing behaviour
DATABASE_ROUTERS = [] DATABASE_ROUTERS = []
# The email backend to use. For possible shortcuts see django.core.mail. # The email backend to use. For possible shortcuts see django.core.mail.
@ -160,10 +174,10 @@ DATABASE_ROUTERS = []
# to a module that defines an EmailBackend class. # to a module that defines an EmailBackend class.
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# Host for sending e-mail. # Host for sending email.
EMAIL_HOST = 'localhost' EMAIL_HOST = 'localhost'
# Port for sending e-mail. # Port for sending email.
EMAIL_PORT = 25 EMAIL_PORT = 25
# Optional SMTP authentication information for EMAIL_HOST. # Optional SMTP authentication information for EMAIL_HOST.
@ -194,6 +208,8 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.debug', 'django.core.context_processors.debug',
'django.core.context_processors.i18n', 'django.core.context_processors.i18n',
'django.core.context_processors.media', 'django.core.context_processors.media',
'django.core.context_processors.static',
'django.core.context_processors.tz',
# 'django.core.context_processors.request', # 'django.core.context_processors.request',
'django.contrib.messages.context_processors.messages', 'django.contrib.messages.context_processors.messages',
) )
@ -201,12 +217,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
# Output to use in template system for invalid (e.g. misspelled) variables. # Output to use in template system for invalid (e.g. misspelled) variables.
TEMPLATE_STRING_IF_INVALID = '' TEMPLATE_STRING_IF_INVALID = ''
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # Default email address to use for various automated correspondence from
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/media/'
# Default e-mail address to use for various automated correspondence from
# the site managers. # the site managers.
DEFAULT_FROM_EMAIL = 'webmaster@localhost' DEFAULT_FROM_EMAIL = 'webmaster@localhost'
@ -246,9 +257,17 @@ ALLOWED_INCLUDE_ROOTS = ()
# is an admin. # is an admin.
ADMIN_FOR = () ADMIN_FOR = ()
# 404s that may be ignored. # List of compiled regular expression objects representing URLs that need not
IGNORABLE_404_STARTS = ('/cgi-bin/', '/_vti_bin', '/_vti_inf') # be reported by BrokenLinkEmailsMiddleware. Here are a few examples:
IGNORABLE_404_ENDS = ('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi', 'favicon.ico', '.php') # import re
# IGNORABLE_404_URLS = (
# re.compile(r'^/apple-touch-icon.*\.png$'),
# re.compile(r'^/favicon.ico$),
# re.compile(r'^/robots.txt$),
# re.compile(r'^/phpmyadmin/),
# re.compile(r'\.(cgi|php|pl)$'),
# )
IGNORABLE_404_URLS = ()
# A secret key for this particular Django installation. Used in secret-key # A secret key for this particular Django installation. Used in secret-key
# hashing algorithms. Set this in your settings, or Django will complain # hashing algorithms. Set this in your settings, or Django will complain
@ -259,13 +278,21 @@ SECRET_KEY = ''
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage' DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
# Absolute filesystem path to the directory that will hold user-uploaded files. # Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/" # Example: "/var/www/example.com/media/"
MEDIA_ROOT = '' MEDIA_ROOT = ''
# URL that handles the media served from MEDIA_ROOT. # URL that handles the media served from MEDIA_ROOT.
# Example: "http://media.lawrence.com" # Examples: "http://example.com/media/", "http://media.example.com/"
MEDIA_URL = '' MEDIA_URL = ''
# Absolute path to the directory static files should be collected to.
# Example: "/var/www/example.com/static/"
STATIC_ROOT = ''
# URL that handles the static files served from STATIC_ROOT.
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = None
# List of upload handler classes to be applied in order. # List of upload handler classes to be applied in order.
FILE_UPLOAD_HANDLERS = ( FILE_UPLOAD_HANDLERS = (
'django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.MemoryFileUploadHandler',
@ -340,6 +367,7 @@ DATE_INPUT_FORMATS = (
# * Note that these format strings are different from the ones to display dates # * Note that these format strings are different from the ones to display dates
TIME_INPUT_FORMATS = ( TIME_INPUT_FORMATS = (
'%H:%M:%S', # '14:30:59' '%H:%M:%S', # '14:30:59'
'%H:%M:%S.%f', # '14:30:59.000200'
'%H:%M', # '14:30' '%H:%M', # '14:30'
) )
@ -350,12 +378,15 @@ TIME_INPUT_FORMATS = (
# * Note that these format strings are different from the ones to display dates # * Note that these format strings are different from the ones to display dates
DATETIME_INPUT_FORMATS = ( DATETIME_INPUT_FORMATS = (
'%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59' '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
'%Y-%m-%d %H:%M:%S.%f', # '2006-10-25 14:30:59.000200'
'%Y-%m-%d %H:%M', # '2006-10-25 14:30' '%Y-%m-%d %H:%M', # '2006-10-25 14:30'
'%Y-%m-%d', # '2006-10-25' '%Y-%m-%d', # '2006-10-25'
'%m/%d/%Y %H:%M:%S', # '10/25/2006 14:30:59' '%m/%d/%Y %H:%M:%S', # '10/25/2006 14:30:59'
'%m/%d/%Y %H:%M:%S.%f', # '10/25/2006 14:30:59.000200'
'%m/%d/%Y %H:%M', # '10/25/2006 14:30' '%m/%d/%Y %H:%M', # '10/25/2006 14:30'
'%m/%d/%Y', # '10/25/2006' '%m/%d/%Y', # '10/25/2006'
'%m/%d/%y %H:%M:%S', # '10/25/06 14:30:59' '%m/%d/%y %H:%M:%S', # '10/25/06 14:30:59'
'%m/%d/%y %H:%M:%S.%f', # '10/25/06 14:30:59.000200'
'%m/%d/%y %H:%M', # '10/25/06 14:30' '%m/%d/%y %H:%M', # '10/25/06 14:30'
'%m/%d/%y', # '10/25/06' '%m/%d/%y', # '10/25/06'
) )
@ -370,7 +401,7 @@ DECIMAL_SEPARATOR = '.'
# Boolean that sets whether to add thousand separator when formatting numbers # Boolean that sets whether to add thousand separator when formatting numbers
USE_THOUSAND_SEPARATOR = False USE_THOUSAND_SEPARATOR = False
# Number of digits that will be together, when spliting them by # Number of digits that will be together, when splitting them by
# THOUSAND_SEPARATOR. 0 means no grouping, 3 means splitting by thousands... # THOUSAND_SEPARATOR. 0 means no grouping, 3 means splitting by thousands...
NUMBER_GROUPING = 0 NUMBER_GROUPING = 0
@ -381,17 +412,31 @@ THOUSAND_SEPARATOR = ','
# Hint: you really don't! # Hint: you really don't!
TRANSACTIONS_MANAGED = False TRANSACTIONS_MANAGED = False
# The User-Agent string to use when checking for URL validity through the
# isExistingURL validator.
from django import get_version
URL_VALIDATOR_USER_AGENT = "Django/%s (http://www.djangoproject.com)" % get_version()
# The tablespaces to use for each model when not specified otherwise. # The tablespaces to use for each model when not specified otherwise.
DEFAULT_TABLESPACE = '' DEFAULT_TABLESPACE = ''
DEFAULT_INDEX_TABLESPACE = '' DEFAULT_INDEX_TABLESPACE = ''
# Default X-Frame-Options header value
X_FRAME_OPTIONS = 'SAMEORIGIN'
USE_X_FORWARDED_HOST = False USE_X_FORWARDED_HOST = False
# The Python dotted path to the WSGI application that Django's internal servers
# (runserver, runfcgi) will use. If `None`, the return value of
# 'django.core.wsgi.get_wsgi_application' is used, thus preserving the same
# behavior as previous versions of Django. Otherwise this should point to an
# actual WSGI application object.
WSGI_APPLICATION = None
# If your Django app is behind a proxy that sets a header to specify secure
# connections, AND that proxy ensures that user-submitted headers with the
# same name are ignored (so that people can't spoof it), set this value to
# a tuple of (header_name, header_value). For any requests that come in with
# that header/value, request.is_secure() will return True.
# WARNING! Only set this if you fully understand what you're doing. Otherwise,
# you may be opening yourself up to a security risk.
SECURE_PROXY_SSL_HEADER = None
############## ##############
# MIDDLEWARE # # MIDDLEWARE #
############## ##############
@ -413,25 +458,32 @@ MIDDLEWARE_CLASSES = (
# SESSIONS # # SESSIONS #
############ ############
SESSION_CACHE_ALIAS = 'default' # Cache to store session data if using the cache session backend.
SESSION_COOKIE_NAME = 'sessionid' # Cookie name. This can be whatever you want. SESSION_COOKIE_NAME = 'sessionid' # Cookie name. This can be whatever you want.
SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2 # Age of cookie, in seconds (default: 2 weeks). SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2 # Age of cookie, in seconds (default: 2 weeks).
SESSION_COOKIE_DOMAIN = None # A string like ".lawrence.com", or None for standard domain cookie. SESSION_COOKIE_DOMAIN = None # A string like ".example.com", or None for standard domain cookie.
SESSION_COOKIE_SECURE = False # Whether the session cookie should be secure (https:// only). SESSION_COOKIE_SECURE = False # Whether the session cookie should be secure (https:// only).
SESSION_COOKIE_PATH = '/' # The path of the session cookie. SESSION_COOKIE_PATH = '/' # The path of the session cookie.
SESSION_COOKIE_HTTPONLY = True # Whether to use the non-RFC standard httpOnly flag (IE, FF3+, others)
SESSION_SAVE_EVERY_REQUEST = False # Whether to save the session data on every request. SESSION_SAVE_EVERY_REQUEST = False # Whether to save the session data on every request.
SESSION_EXPIRE_AT_BROWSER_CLOSE = False # Whether a user's session cookie expires when the Web browser is closed. SESSION_EXPIRE_AT_BROWSER_CLOSE = False # Whether a user's session cookie expires when the Web browser is closed.
SESSION_ENGINE = 'django.contrib.sessions.backends.db' # The module to store session data SESSION_ENGINE = 'django.contrib.sessions.backends.db' # The module to store session data
SESSION_FILE_PATH = None # Directory to store session files if using the file session module. If None, the backend will use a sensible default. SESSION_FILE_PATH = None # Directory to store session files if using the file session module. If None, the backend will use a sensible default.
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer' # class to serialize session data
######### #########
# CACHE # # CACHE #
######### #########
# The cache backend to use. See the docstring in django.core.cache for the # The cache backends to use.
# possible values. CACHES = {
CACHE_BACKEND = 'locmem://' 'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
}
}
CACHE_MIDDLEWARE_KEY_PREFIX = '' CACHE_MIDDLEWARE_KEY_PREFIX = ''
CACHE_MIDDLEWARE_SECONDS = 600 CACHE_MIDDLEWARE_SECONDS = 600
CACHE_MIDDLEWARE_ALIAS = 'default'
#################### ####################
# COMMENTS # # COMMENTS #
@ -439,34 +491,16 @@ CACHE_MIDDLEWARE_SECONDS = 600
COMMENTS_ALLOW_PROFANITIES = False COMMENTS_ALLOW_PROFANITIES = False
# The profanities that will trigger a validation error in the # The profanities that will trigger a validation error in
# 'hasNoProfanities' validator. All of these should be in lowercase. # CommentDetailsForm.clean_comment. All of these should be in lowercase.
PROFANITIES_LIST = ('asshat', 'asshead', 'asshole', 'cunt', 'fuck', 'gook', 'nigger', 'shit') PROFANITIES_LIST = ()
# The group ID that designates which users are banned.
# Set to None if you're not using it.
COMMENTS_BANNED_USERS_GROUP = None
# The group ID that designates which users can moderate comments.
# Set to None if you're not using it.
COMMENTS_MODERATORS_GROUP = None
# The group ID that designates the users whose comments should be e-mailed to MANAGERS.
# Set to None if you're not using it.
COMMENTS_SKETCHY_USERS_GROUP = None
# The system will e-mail MANAGERS the first COMMENTS_FIRST_FEW comments by each
# user. Set this to 0 if you want to disable it.
COMMENTS_FIRST_FEW = 0
# A tuple of IP addresses that have been banned from participating in various
# Django-powered features.
BANNED_IPS = ()
################## ##################
# AUTHENTICATION # # AUTHENTICATION #
################## ##################
AUTH_USER_MODEL = 'auth.User'
AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend',) AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend',)
LOGIN_URL = '/accounts/login/' LOGIN_URL = '/accounts/login/'
@ -478,6 +512,27 @@ LOGIN_REDIRECT_URL = '/accounts/profile/'
# The number of days a password reset link is valid for # The number of days a password reset link is valid for
PASSWORD_RESET_TIMEOUT_DAYS = 3 PASSWORD_RESET_TIMEOUT_DAYS = 3
# the first hasher in this list is the preferred algorithm. any
# password using different algorithms will be converted automatically
# upon login
PASSWORD_HASHERS = (
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
'django.contrib.auth.hashers.BCryptPasswordHasher',
'django.contrib.auth.hashers.SHA1PasswordHasher',
'django.contrib.auth.hashers.MD5PasswordHasher',
'django.contrib.auth.hashers.UnsaltedSHA1PasswordHasher',
'django.contrib.auth.hashers.UnsaltedMD5PasswordHasher',
'django.contrib.auth.hashers.CryptPasswordHasher',
)
###########
# SIGNING #
###########
SIGNING_BACKEND = 'django.core.signing.TimestampSigner'
######## ########
# CSRF # # CSRF #
######## ########
@ -486,37 +541,43 @@ PASSWORD_RESET_TIMEOUT_DAYS = 3
# rejected by the CSRF middleware. # rejected by the CSRF middleware.
CSRF_FAILURE_VIEW = 'django.views.csrf.csrf_failure' CSRF_FAILURE_VIEW = 'django.views.csrf.csrf_failure'
# Name and domain for CSRF cookie. # Settings for CSRF cookie.
CSRF_COOKIE_NAME = 'csrftoken' CSRF_COOKIE_NAME = 'csrftoken'
CSRF_COOKIE_DOMAIN = None CSRF_COOKIE_DOMAIN = None
CSRF_COOKIE_PATH = '/'
CSRF_COOKIE_SECURE = False
CSRF_COOKIE_HTTPONLY = False
############ ############
# MESSAGES # # MESSAGES #
############ ############
# Class to use as messges backend # Class to use as messages backend
MESSAGE_STORAGE = 'django.contrib.messages.storage.user_messages.LegacyFallbackStorage' MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
# Default values of MESSAGE_LEVEL and MESSAGE_TAGS are defined within # Default values of MESSAGE_LEVEL and MESSAGE_TAGS are defined within
# django.contrib.messages to avoid imports in this settings file. # django.contrib.messages to avoid imports in this settings file.
###########
# LOGGING #
###########
# The callable to use to configure logging
LOGGING_CONFIG = 'django.utils.log.dictConfig'
# Custom logging configuration.
LOGGING = {}
# Default exception reporter filter class used in case none has been
# specifically assigned to the HttpRequest instance.
DEFAULT_EXCEPTION_REPORTER_FILTER = 'django.views.debug.SafeExceptionReporterFilter'
########### ###########
# TESTING # # TESTING #
########### ###########
# The name of the class to use to run the test suite # The name of the class to use to run the test suite
TEST_RUNNER = 'django.test.simple.DjangoTestSuiteRunner' TEST_RUNNER = 'django.test.runner.DiscoverRunner'
# The name of the database to use for testing purposes.
# If None, a name of 'test_' + DATABASE_NAME will be assumed
TEST_DATABASE_NAME = None
# Strings used to set the character set and collation order for the test
# database. These values are passed literally to the server, so they are
# backend-dependent. If None, no special settings are sent (system defaults are
# used).
TEST_DATABASE_CHARSET = None
TEST_DATABASE_COLLATION = None
############ ############
# FIXTURES # # FIXTURES #
@ -524,3 +585,21 @@ TEST_DATABASE_COLLATION = None
# The list of directories to search for fixtures # The list of directories to search for fixtures
FIXTURE_DIRS = () FIXTURE_DIRS = ()
###############
# STATICFILES #
###############
# A list of locations of additional static files
STATICFILES_DIRS = ()
# The default file storage backend used during the build process
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

View file

@ -1 +0,0 @@
/*.pyc

View file

@ -0,0 +1,494 @@
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
# About name_local: capitalize it as if your language name was appearing
# inside a sentence in your language.
LANG_INFO = {
'af': {
'bidi': False,
'code': 'af',
'name': 'Afrikaans',
'name_local': 'Afrikaans',
},
'ar': {
'bidi': True,
'code': 'ar',
'name': 'Arabic',
'name_local': 'العربيّة',
},
'az': {
'bidi': True,
'code': 'az',
'name': 'Azerbaijani',
'name_local': 'azərbaycan dili',
},
'be': {
'bidi': False,
'code': 'be',
'name': 'Belarusian',
'name_local': 'беларуская',
},
'bg': {
'bidi': False,
'code': 'bg',
'name': 'Bulgarian',
'name_local': 'български',
},
'bn': {
'bidi': False,
'code': 'bn',
'name': 'Bengali',
'name_local': 'বাংলা',
},
'br': {
'bidi': False,
'code': 'br',
'name': 'Breton',
'name_local': 'brezhoneg',
},
'bs': {
'bidi': False,
'code': 'bs',
'name': 'Bosnian',
'name_local': 'bosanski',
},
'ca': {
'bidi': False,
'code': 'ca',
'name': 'Catalan',
'name_local': 'català',
},
'cs': {
'bidi': False,
'code': 'cs',
'name': 'Czech',
'name_local': 'česky',
},
'cy': {
'bidi': False,
'code': 'cy',
'name': 'Welsh',
'name_local': 'Cymraeg',
},
'da': {
'bidi': False,
'code': 'da',
'name': 'Danish',
'name_local': 'dansk',
},
'de': {
'bidi': False,
'code': 'de',
'name': 'German',
'name_local': 'Deutsch',
},
'el': {
'bidi': False,
'code': 'el',
'name': 'Greek',
'name_local': 'Ελληνικά',
},
'en': {
'bidi': False,
'code': 'en',
'name': 'English',
'name_local': 'English',
},
'en-gb': {
'bidi': False,
'code': 'en-gb',
'name': 'British English',
'name_local': 'British English',
},
'eo': {
'bidi': False,
'code': 'eo',
'name': 'Esperanto',
'name_local': 'Esperanto',
},
'es': {
'bidi': False,
'code': 'es',
'name': 'Spanish',
'name_local': 'español',
},
'es-ar': {
'bidi': False,
'code': 'es-ar',
'name': 'Argentinian Spanish',
'name_local': 'español de Argentina',
},
'es-mx': {
'bidi': False,
'code': 'es-mx',
'name': 'Mexican Spanish',
'name_local': 'español de Mexico',
},
'es-ni': {
'bidi': False,
'code': 'es-ni',
'name': 'Nicaraguan Spanish',
'name_local': 'español de Nicaragua',
},
'es-ve': {
'bidi': False,
'code': 'es-ve',
'name': 'Venezuelan Spanish',
'name_local': 'español de Venezuela',
},
'et': {
'bidi': False,
'code': 'et',
'name': 'Estonian',
'name_local': 'eesti',
},
'eu': {
'bidi': False,
'code': 'eu',
'name': 'Basque',
'name_local': 'Basque',
},
'fa': {
'bidi': True,
'code': 'fa',
'name': 'Persian',
'name_local': 'فارسی',
},
'fi': {
'bidi': False,
'code': 'fi',
'name': 'Finnish',
'name_local': 'suomi',
},
'fr': {
'bidi': False,
'code': 'fr',
'name': 'French',
'name_local': 'français',
},
'fy-nl': {
'bidi': False,
'code': 'fy-nl',
'name': 'Frisian',
'name_local': 'Frisian',
},
'ga': {
'bidi': False,
'code': 'ga',
'name': 'Irish',
'name_local': 'Gaeilge',
},
'gl': {
'bidi': False,
'code': 'gl',
'name': 'Galician',
'name_local': 'galego',
},
'he': {
'bidi': True,
'code': 'he',
'name': 'Hebrew',
'name_local': 'עברית',
},
'hi': {
'bidi': False,
'code': 'hi',
'name': 'Hindi',
'name_local': 'Hindi',
},
'hr': {
'bidi': False,
'code': 'hr',
'name': 'Croatian',
'name_local': 'Hrvatski',
},
'hu': {
'bidi': False,
'code': 'hu',
'name': 'Hungarian',
'name_local': 'Magyar',
},
'ia': {
'bidi': False,
'code': 'ia',
'name': 'Interlingua',
'name_local': 'Interlingua',
},
'id': {
'bidi': False,
'code': 'id',
'name': 'Indonesian',
'name_local': 'Bahasa Indonesia',
},
'is': {
'bidi': False,
'code': 'is',
'name': 'Icelandic',
'name_local': 'Íslenska',
},
'it': {
'bidi': False,
'code': 'it',
'name': 'Italian',
'name_local': 'italiano',
},
'ja': {
'bidi': False,
'code': 'ja',
'name': 'Japanese',
'name_local': '日本語',
},
'ka': {
'bidi': False,
'code': 'ka',
'name': 'Georgian',
'name_local': 'ქართული',
},
'kk': {
'bidi': False,
'code': 'kk',
'name': 'Kazakh',
'name_local': 'Қазақ',
},
'km': {
'bidi': False,
'code': 'km',
'name': 'Khmer',
'name_local': 'Khmer',
},
'kn': {
'bidi': False,
'code': 'kn',
'name': 'Kannada',
'name_local': 'Kannada',
},
'ko': {
'bidi': False,
'code': 'ko',
'name': 'Korean',
'name_local': '한국어',
},
'lb': {
'bidi': False,
'code': 'lb',
'name': 'Luxembourgish',
'name_local': 'Lëtzebuergesch',
},
'lt': {
'bidi': False,
'code': 'lt',
'name': 'Lithuanian',
'name_local': 'Lietuviškai',
},
'lv': {
'bidi': False,
'code': 'lv',
'name': 'Latvian',
'name_local': 'latviešu',
},
'mk': {
'bidi': False,
'code': 'mk',
'name': 'Macedonian',
'name_local': 'Македонски',
},
'ml': {
'bidi': False,
'code': 'ml',
'name': 'Malayalam',
'name_local': 'Malayalam',
},
'mn': {
'bidi': False,
'code': 'mn',
'name': 'Mongolian',
'name_local': 'Mongolian',
},
'my': {
'bidi': False,
'code': 'my',
'name': 'Burmese',
'name_local': 'မြန်မာဘာသာ',
},
'nb': {
'bidi': False,
'code': 'nb',
'name': 'Norwegian Bokmal',
'name_local': 'norsk (bokmål)',
},
'ne': {
'bidi': False,
'code': 'ne',
'name': 'Nepali',
'name_local': 'नेपाली',
},
'nl': {
'bidi': False,
'code': 'nl',
'name': 'Dutch',
'name_local': 'Nederlands',
},
'nn': {
'bidi': False,
'code': 'nn',
'name': 'Norwegian Nynorsk',
'name_local': 'norsk (nynorsk)',
},
'no': {
'bidi': False,
'code': 'no',
'name': 'Norwegian',
'name_local': 'norsk',
},
'os': {
'bidi': False,
'code': 'os',
'name': 'Ossetic',
'name_local': 'Ирон',
},
'pa': {
'bidi': False,
'code': 'pa',
'name': 'Punjabi',
'name_local': 'Punjabi',
},
'pl': {
'bidi': False,
'code': 'pl',
'name': 'Polish',
'name_local': 'polski',
},
'pt': {
'bidi': False,
'code': 'pt',
'name': 'Portuguese',
'name_local': 'Português',
},
'pt-br': {
'bidi': False,
'code': 'pt-br',
'name': 'Brazilian Portuguese',
'name_local': 'Português Brasileiro',
},
'ro': {
'bidi': False,
'code': 'ro',
'name': 'Romanian',
'name_local': 'Română',
},
'ru': {
'bidi': False,
'code': 'ru',
'name': 'Russian',
'name_local': 'Русский',
},
'sk': {
'bidi': False,
'code': 'sk',
'name': 'Slovak',
'name_local': 'slovenský',
},
'sl': {
'bidi': False,
'code': 'sl',
'name': 'Slovenian',
'name_local': 'Slovenščina',
},
'sq': {
'bidi': False,
'code': 'sq',
'name': 'Albanian',
'name_local': 'shqip',
},
'sr': {
'bidi': False,
'code': 'sr',
'name': 'Serbian',
'name_local': 'српски',
},
'sr-latn': {
'bidi': False,
'code': 'sr-latn',
'name': 'Serbian Latin',
'name_local': 'srpski (latinica)',
},
'sv': {
'bidi': False,
'code': 'sv',
'name': 'Swedish',
'name_local': 'svenska',
},
'sw': {
'bidi': False,
'code': 'sw',
'name': 'Swahili',
'name_local': 'Kiswahili',
},
'ta': {
'bidi': False,
'code': 'ta',
'name': 'Tamil',
'name_local': 'தமிழ்',
},
'te': {
'bidi': False,
'code': 'te',
'name': 'Telugu',
'name_local': 'తెలుగు',
},
'th': {
'bidi': False,
'code': 'th',
'name': 'Thai',
'name_local': 'ภาษาไทย',
},
'tr': {
'bidi': False,
'code': 'tr',
'name': 'Turkish',
'name_local': 'Türkçe',
},
'tt': {
'bidi': False,
'code': 'tt',
'name': 'Tatar',
'name_local': 'Татарча',
},
'udm': {
'bidi': False,
'code': 'udm',
'name': 'Udmurt',
'name_local': 'Удмурт',
},
'uk': {
'bidi': False,
'code': 'uk',
'name': 'Ukrainian',
'name_local': 'Українська',
},
'ur': {
'bidi': True,
'code': 'ur',
'name': 'Urdu',
'name_local': 'اردو',
},
'vi': {
'bidi': False,
'code': 'vi',
'name': 'Vietnamese',
'name_local': 'Tiếng Việt',
},
'zh-cn': {
'bidi': False,
'code': 'zh-cn',
'name': 'Simplified Chinese',
'name_local': '简体中文',
},
'zh-tw': {
'bidi': False,
'code': 'zh-tw',
'name': 'Traditional Chinese',
'name_local': '繁體中文',
}
}

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -1 +0,0 @@
/*.pyc

View file

@ -1 +0,0 @@
/*.pyc

File diff suppressed because it is too large Load diff

View file

@ -1,118 +0,0 @@
# translation of djangojs.po to Arabic
# This file is distributed under the same license as the django package.
#
msgid ""
msgstr ""
"Project-Id-Version: djangojs\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-11-29 10:58-0600\n"
"PO-Revision-Date: 2008-09-02 00:53+0300\n"
"Last-Translator: Ossama M. Khayat <okhayat@yahoo.com>\n"
"Language-Team: Arabic <support@arabeyes.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.11.4\n"
"Plural-Forms: nplurals=4; plural=(n == 1? 0 : (n == 2? 1 : (n <= 10? 2 : 3)))\n"
#: contrib/admin/media/js/SelectFilter2.js:33
#, perl-format
msgid "Available %s"
msgstr "%s المتوفرة"
#: contrib/admin/media/js/SelectFilter2.js:41
msgid "Choose all"
msgstr "اختر الكل"
#: contrib/admin/media/js/SelectFilter2.js:46
msgid "Add"
msgstr "أضف"
#: contrib/admin/media/js/SelectFilter2.js:48
msgid "Remove"
msgstr "احذف"
#: contrib/admin/media/js/SelectFilter2.js:53
#, perl-format
msgid "Chosen %s"
msgstr "%s المُختارة"
#: contrib/admin/media/js/SelectFilter2.js:54
msgid "Select your choice(s) and click "
msgstr "حدد خياراتك واضغط"
#: contrib/admin/media/js/SelectFilter2.js:59
msgid "Clear all"
msgstr "امسح الكل"
#: contrib/admin/media/js/calendar.js:24
#: contrib/admin/media/js/dateparse.js:32
msgid ""
"January February March April May June July August September October November "
"December"
msgstr "يناير فبراير مارس إبريل مايو يونيو يوليو أغسطس سبتمبر أكتوبر نوفمبر ديسمبر"
#: contrib/admin/media/js/calendar.js:25
msgid "S M T W T F S"
msgstr "أ إ ث أ خ ج س"
#: contrib/admin/media/js/dateparse.js:33
msgid "Sunday Monday Tuesday Wednesday Thursday Friday Saturday"
msgstr "الأحد الإثنين الثلاثاء الأربعاء الخميس الجمعة السبت"
#: contrib/admin/media/js/admin/CollapsedFieldsets.js:34
#: contrib/admin/media/js/admin/CollapsedFieldsets.js:72
msgid "Show"
msgstr "أظهر"
#: contrib/admin/media/js/admin/CollapsedFieldsets.js:63
msgid "Hide"
msgstr "اخف"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:47
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:81
msgid "Now"
msgstr "الآن"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:51
msgid "Clock"
msgstr "الساعة"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:78
msgid "Choose a time"
msgstr "اختر وقتاً"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:82
msgid "Midnight"
msgstr "منتصف الليل"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:83
msgid "6 a.m."
msgstr "6 ص."
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:84
msgid "Noon"
msgstr "الظهر"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:88
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:183
msgid "Cancel"
msgstr "ألغ"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:128
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:177
msgid "Today"
msgstr "اليوم"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:132
msgid "Calendar"
msgstr "التقويم"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:175
msgid "Yesterday"
msgstr "أمس"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:179
msgid "Tomorrow"
msgstr "غداً"

View file

@ -1,7 +1,10 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package. # This file is distributed under the same license as the Django package.
# #
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j F، Y' DATE_FORMAT = 'j F، Y'
TIME_FORMAT = 'g:i:s A' TIME_FORMAT = 'g:i:s A'
# DATETIME_FORMAT = # DATETIME_FORMAT =
@ -10,6 +13,9 @@ MONTH_DAY_FORMAT = 'j F'
SHORT_DATE_FORMAT = 'd/m/Y' SHORT_DATE_FORMAT = 'd/m/Y'
# SHORT_DATETIME_FORMAT = # SHORT_DATETIME_FORMAT =
# FIRST_DAY_OF_WEEK = # FIRST_DAY_OF_WEEK =
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
# DATE_INPUT_FORMATS = # DATE_INPUT_FORMATS =
# TIME_INPUT_FORMATS = # TIME_INPUT_FORMATS =
# DATETIME_INPUT_FORMATS = # DATETIME_INPUT_FORMATS =

Binary file not shown.

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -1 +0,0 @@
/*.pyc

View file

@ -1 +0,0 @@
/*.pyc

File diff suppressed because it is too large Load diff

View file

@ -1,106 +0,0 @@
# translation of djangojs.po to Bulgarian
#
msgid ""
msgstr ""
"Project-Id-Version: Django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-12-09 11:51+0100\n"
"PO-Revision-Date: 2007-05-12 17:51+0300\n"
"Last-Translator: Jordan Dimov <s3x3y1@gmail.com>\n"
"Language-Team: Bulgarian\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: contrib/admin/media/js/SelectFilter2.js:33
#, perl-format
msgid "Available %s"
msgstr "Налични %s"
#: contrib/admin/media/js/SelectFilter2.js:41
msgid "Choose all"
msgstr "Избери всички"
#: contrib/admin/media/js/SelectFilter2.js:46
msgid "Add"
msgstr "Добави"
#: contrib/admin/media/js/SelectFilter2.js:48
msgid "Remove"
msgstr "Премахни"
#: contrib/admin/media/js/SelectFilter2.js:53
#, perl-format
msgid "Chosen %s"
msgstr "Избрахме %s"
#: contrib/admin/media/js/SelectFilter2.js:54
msgid "Select your choice(s) and click "
msgstr "Направете своя избор и щракнете "
#: contrib/admin/media/js/SelectFilter2.js:59
msgid "Clear all"
msgstr "Изчисти всички"
#: contrib/admin/media/js/dateparse.js:26
#: contrib/admin/media/js/calendar.js:24
msgid ""
"January February March April May June July August September October November "
"December"
msgstr "Януари Февруари Март Април Май Юни Юли Август Септември Октомври Ноември Декември"
#: contrib/admin/media/js/dateparse.js:27
msgid "Sunday Monday Tuesday Wednesday Thursday Friday Saturday"
msgstr "Неделя Понеделник Вторник Сряда Четвъртък Петък Събота"
#: contrib/admin/media/js/calendar.js:25
msgid "S M T W T F S"
msgstr "Н П В С Ч П С"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:45
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:80
msgid "Now"
msgstr "Сега"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:48
msgid "Clock"
msgstr "Часовник"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:77
msgid "Choose a time"
msgstr "Избери време"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:81
msgid "Midnight"
msgstr "Полунощ"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:82
msgid "6 a.m."
msgstr "6 a.m."
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:83
msgid "Noon"
msgstr "По обяд"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:87
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:168
msgid "Cancel"
msgstr "Отказ"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:111
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:162
msgid "Today"
msgstr "Днес"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:114
msgid "Calendar"
msgstr "Календар"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:160
msgid "Yesterday"
msgstr "Вчера"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:164
msgid "Tomorrow"
msgstr "Утре"

View file

@ -1,7 +1,10 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package. # This file is distributed under the same license as the Django package.
# #
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'd F Y' DATE_FORMAT = 'd F Y'
TIME_FORMAT = 'H:i:s' TIME_FORMAT = 'H:i:s'
# DATETIME_FORMAT = # DATETIME_FORMAT =
@ -10,9 +13,12 @@ MONTH_DAY_FORMAT = 'j F'
SHORT_DATE_FORMAT = 'd.m.Y' SHORT_DATE_FORMAT = 'd.m.Y'
# SHORT_DATETIME_FORMAT = # SHORT_DATETIME_FORMAT =
# FIRST_DAY_OF_WEEK = # FIRST_DAY_OF_WEEK =
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
# DATE_INPUT_FORMATS = # DATE_INPUT_FORMATS =
# TIME_INPUT_FORMATS = # TIME_INPUT_FORMATS =
# DATETIME_INPUT_FORMATS = # DATETIME_INPUT_FORMATS =
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = u' ' # Non-breaking space THOUSAND_SEPARATOR = ' ' # Non-breaking space
# NUMBER_GROUPING = # NUMBER_GROUPING =

View file

@ -1 +0,0 @@
/*.pyc

View file

@ -1 +0,0 @@
/*.pyc

File diff suppressed because it is too large Load diff

View file

@ -1,114 +0,0 @@
# This file is distributed under the same license as the Django package.
#
msgid ""
msgstr ""
"Project-Id-Version: Django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-09-02 22:36-0700\n"
"PO-Revision-Date: 2009-07-19 22:49+0000\n"
"Last-Translator: Nasimul Haque <nasim.haque@gmail.com>\n"
"Language-Team: Nasimul Haque <nasim.haque@gmail.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: contrib/admin/media/js/SelectFilter2.js:33
#, perl-format
msgid "Available %s"
msgstr "%s বিদ্যমান"
#: contrib/admin/media/js/SelectFilter2.js:41
msgid "Choose all"
msgstr "সব বাছাই করুন"
#: contrib/admin/media/js/SelectFilter2.js:46
msgid "Add"
msgstr "যোগ করুন"
#: contrib/admin/media/js/SelectFilter2.js:48
msgid "Remove"
msgstr "মুছে ফেলুন"
#: contrib/admin/media/js/SelectFilter2.js:53
#, perl-format
msgid "Chosen %s"
msgstr "%s বাছাই করা হয়েছে"
#: contrib/admin/media/js/SelectFilter2.js:54
msgid "Select your choice(s) and click "
msgstr "আপনার পছন্দ বাছাই এবং ক্লিক করুন"
#: contrib/admin/media/js/SelectFilter2.js:59
msgid "Clear all"
msgstr "সব পরিষ্কার করুন"
#: contrib/admin/media/js/calendar.js:24
#: contrib/admin/media/js/dateparse.js:32
msgid ""
"January February March April May June July August September October November "
"December"
msgstr "জানুয়ারি ফেব্রুয়ারি মার্চ এপ্রিল মে জুন জুলাই অাগস্ট সেপ্টেম্বর অক্টোবর নভেম্বর ডিসেম্বর"
#: contrib/admin/media/js/calendar.js:25
msgid "S M T W T F S"
msgstr "র স ম ব ব শ শ"
#: contrib/admin/media/js/dateparse.js:33
msgid "Sunday Monday Tuesday Wednesday Thursday Friday Saturday"
msgstr "রবিবার সোমবার মঙ্গলবার বুধবার বৃহস্পতিবার শুক্রবার শনিবার"
#: contrib/admin/media/js/admin/CollapsedFieldsets.js:34
#: contrib/admin/media/js/admin/CollapsedFieldsets.js:72
msgid "Show"
msgstr "দেখান"
#: contrib/admin/media/js/admin/CollapsedFieldsets.js:63
msgid "Hide"
msgstr "লুকান"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:47
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:81
msgid "Now"
msgstr "এখন"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:51
msgid "Clock"
msgstr "ঘড়ি"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:78
msgid "Choose a time"
msgstr "সময় নির্বাচন করুন"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:82
msgid "Midnight"
msgstr "মধ্যরাত"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:83
msgid "6 a.m."
msgstr "৬ পূর্বাহ্ন"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:84
msgid "Noon"
msgstr "দুপুর"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:88
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:183
msgid "Cancel"
msgstr "বাতিল"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:128
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:177
msgid "Today"
msgstr "আজ"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:132
msgid "Calendar"
msgstr "দিনপঞ্জিকা"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:175
msgid "Yesterday"
msgstr "গতকাল"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:179
msgid "Tomorrow"
msgstr "আগামীকাল"

View file

@ -1,7 +1,10 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package. # This file is distributed under the same license as the Django package.
# #
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j F, Y' DATE_FORMAT = 'j F, Y'
TIME_FORMAT = 'g:i:s A' TIME_FORMAT = 'g:i:s A'
# DATETIME_FORMAT = # DATETIME_FORMAT =
@ -10,6 +13,9 @@ MONTH_DAY_FORMAT = 'j F'
SHORT_DATE_FORMAT = 'j M, Y' SHORT_DATE_FORMAT = 'j M, Y'
# SHORT_DATETIME_FORMAT = # SHORT_DATETIME_FORMAT =
# FIRST_DAY_OF_WEEK = # FIRST_DAY_OF_WEEK =
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
# DATE_INPUT_FORMATS = # DATE_INPUT_FORMATS =
# TIME_INPUT_FORMATS = # TIME_INPUT_FORMATS =
# DATETIME_INPUT_FORMATS = # DATETIME_INPUT_FORMATS =

Binary file not shown.

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,10 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package. # This file is distributed under the same license as the Django package.
# #
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j. N Y.' DATE_FORMAT = 'j. N Y.'
TIME_FORMAT = 'G:i' TIME_FORMAT = 'G:i'
DATETIME_FORMAT = 'j. N. Y. G:i T' DATETIME_FORMAT = 'j. N. Y. G:i T'
@ -10,6 +13,9 @@ MONTH_DAY_FORMAT = 'j. F'
SHORT_DATE_FORMAT = 'Y M j' SHORT_DATE_FORMAT = 'Y M j'
# SHORT_DATETIME_FORMAT = # SHORT_DATETIME_FORMAT =
# FIRST_DAY_OF_WEEK = # FIRST_DAY_OF_WEEK =
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
# DATE_INPUT_FORMATS = # DATE_INPUT_FORMATS =
# TIME_INPUT_FORMATS = # TIME_INPUT_FORMATS =
# DATETIME_INPUT_FORMATS = # DATETIME_INPUT_FORMATS =

View file

@ -1 +0,0 @@
/*.pyc

View file

@ -1 +0,0 @@
/*.pyc

File diff suppressed because it is too large Load diff

View file

@ -1,115 +0,0 @@
# translation of djangojs.po to catalan
# This file is distributed under the same license as the Django package.
msgid ""
msgstr ""
"Project-Id-Version: Django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-02-15 01:00+0200\n"
"PO-Revision-Date: 2008-03-25 18:54+0100\n"
"Last-Translator: Django Catalan Group <django-cat@googlegroups.com>\n"
"Language-Team: Catalan <ca@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: VIM 7.1\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: contrib/admin/media/js/SelectFilter2.js:33
#, perl-format
msgid "Available %s"
msgstr "%s Disponibles"
#: contrib/admin/media/js/SelectFilter2.js:41
msgid "Choose all"
msgstr "Seleccionar tots"
#: contrib/admin/media/js/SelectFilter2.js:46
msgid "Add"
msgstr "Afegir"
#: contrib/admin/media/js/SelectFilter2.js:48
msgid "Remove"
msgstr "Eliminar"
#: contrib/admin/media/js/SelectFilter2.js:53
#, perl-format
msgid "Chosen %s"
msgstr "%s Escollits"
#: contrib/admin/media/js/SelectFilter2.js:54
msgid "Select your choice(s) and click "
msgstr "Faci les seves seleccions i faci click a"
#: contrib/admin/media/js/SelectFilter2.js:59
msgid "Clear all"
msgstr "Deseleccionar tots"
#: contrib/admin/media/js/dateparse.js:32
#: contrib/admin/media/js/calendar.js:24
msgid "January February March April May June July August September October November December"
msgstr "Gener Febrer Març Abril Maig Juny Juliol Agost Setembre Octubre Novembre Desembre"
#: contrib/admin/media/js/dateparse.js:33
msgid "Sunday Monday Tuesday Wednesday Thursday Friday Saturday"
msgstr "Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte"
#: contrib/admin/media/js/calendar.js:25
msgid "S M T W T F S"
msgstr "Dg Dl Dt Dc Dj Dv Ds"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:47
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:81
msgid "Now"
msgstr "Ara"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:51
msgid "Clock"
msgstr "Rellotje"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:78
msgid "Choose a time"
msgstr "Esculli una hora"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:82
msgid "Midnight"
msgstr "Mitja nit"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:83
msgid "6 a.m."
msgstr "6 a.m."
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:84
msgid "Noon"
msgstr "Migdia"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:88
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:183
msgid "Cancel"
msgstr "Cancel·lar"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:128
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:177
msgid "Today"
msgstr "Avui"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:132
msgid "Calendar"
msgstr "Calendari"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:175
msgid "Yesterday"
msgstr "Ahir"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:179
msgid "Tomorrow"
msgstr "Demà"
#: contrib/admin/media/js/admin/CollapsedFieldsets.js:34
#: contrib/admin/media/js/admin/CollapsedFieldsets.js:72
msgid "Show"
msgstr "Mostrar"
#: contrib/admin/media/js/admin/CollapsedFieldsets.js:63
msgid "Hide"
msgstr "Ocultar"

View file

@ -1,27 +1,31 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package. # This file is distributed under the same license as the Django package.
# #
from __future__ import unicode_literals
DATE_FORMAT = r'j \de F \de Y' # The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = r'j \d\e F \d\e Y'
TIME_FORMAT = 'G:i:s' TIME_FORMAT = 'G:i:s'
DATETIME_FORMAT = r'j \de F \de Y \a \le\s G:i' DATETIME_FORMAT = r'j \d\e F \d\e Y \a \l\e\s G:i'
YEAR_MONTH_FORMAT = r'F \de\l Y' YEAR_MONTH_FORMAT = r'F \d\e\l Y'
MONTH_DAY_FORMAT = r'j \de F' MONTH_DAY_FORMAT = r'j \d\e F'
SHORT_DATE_FORMAT = 'd/m/Y' SHORT_DATE_FORMAT = 'd/m/Y'
SHORT_DATETIME_FORMAT = 'd/m/Y G:i' SHORT_DATETIME_FORMAT = 'd/m/Y G:i'
FIRST_DAY_OF_WEEK = 1 # Monday FIRST_DAY_OF_WEEK = 1 # Monday
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
DATE_INPUT_FORMATS = ( DATE_INPUT_FORMATS = (
# '31/12/2009', '31/12/09' # '31/12/2009', '31/12/09'
'%d/%m/%Y', '%d/%m/%y' '%d/%m/%Y', '%d/%m/%y'
) )
TIME_INPUT_FORMATS = (
# '14:30:59', '14:30'
'%H:%M:%S', '%H:%M'
)
DATETIME_INPUT_FORMATS = ( DATETIME_INPUT_FORMATS = (
'%d/%m/%Y %H:%M:%S', '%d/%m/%Y %H:%M:%S',
'%d/%m/%Y %H:%M:%S.%f',
'%d/%m/%Y %H:%M', '%d/%m/%Y %H:%M',
'%d/%m/%y %H:%M:%S', '%d/%m/%y %H:%M:%S',
'%d/%m/%y %H:%M:%S.%f',
'%d/%m/%y %H:%M', '%d/%m/%y %H:%M',
) )
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','

View file

@ -1 +0,0 @@
/*.pyc

View file

@ -1 +0,0 @@
/*.pyc

File diff suppressed because it is too large Load diff

View file

@ -1,159 +0,0 @@
# Translation of djangojs.po to Czech
# Copyright (C) 2005 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the DJANGO package.
# Radek Svarz <translate@svarz.cz>, 2005,
# Vlada Macek <macek@sandbox.cz>, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: Django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-08-06 18:35+0200\n"
"PO-Revision-Date: 2010-08-06 18:34+0100\n"
"Last-Translator: Vlada Macek <macek@sandbox.cz>\n"
"Language-Team: Czech\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n==1 ? 0 : n>1 && n<5 ? 1 : 2;\n"
#: contrib/admin/media/js/SelectFilter2.js:37
#, perl-format
msgid "Available %s"
msgstr "Dostupné položky: %s"
#: contrib/admin/media/js/SelectFilter2.js:45
msgid "Choose all"
msgstr "Vybrat vše"
#: contrib/admin/media/js/SelectFilter2.js:50
msgid "Add"
msgstr "Přidat"
#: contrib/admin/media/js/SelectFilter2.js:52
msgid "Remove"
msgstr "Odebrat"
#: contrib/admin/media/js/SelectFilter2.js:57
#, perl-format
msgid "Chosen %s"
msgstr "Vybrané položky: %s"
#: contrib/admin/media/js/SelectFilter2.js:58
msgid "Select your choice(s) and click "
msgstr "Vyberte si a klikněte "
#: contrib/admin/media/js/SelectFilter2.js:63
msgid "Clear all"
msgstr "Odebrat vše"
#: contrib/admin/media/js/actions.js:18
#: contrib/admin/media/js/actions.min.js:1
msgid "%(sel)s of %(cnt)s selected"
msgid_plural "%(sel)s of %(cnt)s selected"
msgstr[0] "Vybrána je %(sel)s položka z celkem %(cnt)s."
msgstr[1] "Vybrány jsou %(sel)s položky z celkem %(cnt)s."
msgstr[2] "Vybraných je %(sel)s položek z celkem %(cnt)s."
#: contrib/admin/media/js/actions.js:109
#: contrib/admin/media/js/actions.min.js:5
msgid ""
"You have unsaved changes on individual editable fields. If you run an "
"action, your unsaved changes will be lost."
msgstr ""
"V jednotlivých polích jsou neuložené změny, které budou ztraceny, pokud "
"operaci provedete."
#: contrib/admin/media/js/actions.js:121
#: contrib/admin/media/js/actions.min.js:6
msgid ""
"You have selected an action, but you haven't saved your changes to "
"individual fields yet. Please click OK to save. You'll need to re-run the "
"action."
msgstr ""
"Byla vybrána operace, ale dosud nedošlo k uložení změn jednotlivých polí. "
"Uložíte klepnutím na tlačítko OK. Pak bude třeba operaci spustit znovu."
#: contrib/admin/media/js/actions.js:123
#: contrib/admin/media/js/actions.min.js:6
msgid ""
"You have selected an action, and you haven't made any changes on individual "
"fields. You're probably looking for the Go button rather than the Save "
"button."
msgstr ""
"Byla vybrána operace a jednotlivá pole nejsou změněná. Patrně hledáte "
"tlačítko Provést spíše než Uložit."
#: contrib/admin/media/js/calendar.js:24
#: contrib/admin/media/js/dateparse.js:32
msgid ""
"January February March April May June July August September October November "
"December"
msgstr ""
"leden únor březen duben květen červen červenec srpen září říjen listopad "
"prosinec"
#: contrib/admin/media/js/calendar.js:25
msgid "S M T W T F S"
msgstr "n p ú s č p s"
#: contrib/admin/media/js/collapse.js:9 contrib/admin/media/js/collapse.js:21
#: contrib/admin/media/js/collapse.min.js:1
msgid "Show"
msgstr "Zobrazit"
#: contrib/admin/media/js/collapse.js:16
#: contrib/admin/media/js/collapse.min.js:1
msgid "Hide"
msgstr "Skrýt"
#: contrib/admin/media/js/dateparse.js:33
msgid "Sunday Monday Tuesday Wednesday Thursday Friday Saturday"
msgstr "Neděle Pondělí Úterý Středa Čtvrtek Pátek Sobota"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:49
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:84
msgid "Now"
msgstr "Nyní"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:53
msgid "Clock"
msgstr "Hodiny"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:80
msgid "Choose a time"
msgstr "Vyberte čas"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:85
msgid "Midnight"
msgstr "Půlnoc"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:86
msgid "6 a.m."
msgstr "6h ráno"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:87
msgid "Noon"
msgstr "Poledne"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:91
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:188
msgid "Cancel"
msgstr "Storno"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:133
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:182
msgid "Today"
msgstr "Dnes"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:137
msgid "Calendar"
msgstr "Kalendář"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:180
msgid "Yesterday"
msgstr "Včera"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:184
msgid "Tomorrow"
msgstr "Zítra"

View file

@ -1,32 +1,45 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package. # This file is distributed under the same license as the Django package.
# #
from __future__ import unicode_literals
DATE_FORMAT = 'j. F Y' # The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j. E Y'
TIME_FORMAT = 'G:i:s' TIME_FORMAT = 'G:i:s'
DATETIME_FORMAT = 'j. F Y G:i:s' DATETIME_FORMAT = 'j. E Y G:i:s'
YEAR_MONTH_FORMAT = 'F Y' YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j. F' MONTH_DAY_FORMAT = 'j. F'
SHORT_DATE_FORMAT = 'd.m.Y' SHORT_DATE_FORMAT = 'd.m.Y'
SHORT_DATETIME_FORMAT = 'd.m.Y G:i:s' SHORT_DATETIME_FORMAT = 'd.m.Y G:i:s'
FIRST_DAY_OF_WEEK = 1 # Monday FIRST_DAY_OF_WEEK = 1 # Monday
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
DATE_INPUT_FORMATS = ( DATE_INPUT_FORMATS = (
'%d.%m.%Y', '%d.%m.%y', # '25.10.2006', '25.10.06' '%d.%m.%Y', '%d.%m.%y', # '05.01.2006', '05.01.06'
'%Y-%m-%d', '%y-%m-%d', # '2006-10-25', '06-10-25' '%d. %m. %Y', '%d. %m. %y', # '5. 1. 2006', '5. 1. 06'
# '%d. %B %Y', '%d. %b. %Y', # '25. October 2006', '25. Oct. 2006' # '%d. %B %Y', '%d. %b. %Y', # '25. October 2006', '25. Oct. 2006'
) )
# Kept ISO formats as one is in first position
TIME_INPUT_FORMATS = ( TIME_INPUT_FORMATS = (
'%H:%M:%S', # '14:30:59' '%H:%M:%S', # '04:30:59'
'%H:%M', # '14:30' '%H.%M', # '04.30'
'%H:%M', # '04:30'
) )
DATETIME_INPUT_FORMATS = ( DATETIME_INPUT_FORMATS = (
'%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59' '%d.%m.%Y %H:%M:%S', # '05.01.2006 04:30:59'
'%d.%m.%Y %H:%M', # '25.10.2006 14:30' '%d.%m.%Y %H:%M:%S.%f', # '05.01.2006 04:30:59.000200'
'%d.%m.%Y', # '25.10.2006' '%d.%m.%Y %H.%M', # '05.01.2006 04.30'
'%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59' '%d.%m.%Y %H:%M', # '05.01.2006 04:30'
'%Y-%m-%d %H:%M', # '2006-10-25 14:30' '%d.%m.%Y', # '05.01.2006'
'%Y-%m-%d', # '2006-10-25' '%d. %m. %Y %H:%M:%S', # '05. 01. 2006 04:30:59'
'%d. %m. %Y %H:%M:%S.%f', # '05. 01. 2006 04:30:59.000200'
'%d. %m. %Y %H.%M', # '05. 01. 2006 04.30'
'%d. %m. %Y %H:%M', # '05. 01. 2006 04:30'
'%d. %m. %Y', # '05. 01. 2006'
'%Y-%m-%d %H.%M', # '2006-01-05 04.30'
) )
DECIMAL_SEPARATOR = ',' DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = ' ' THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3 NUMBER_GROUPING = 3

View file

@ -1 +0,0 @@
/*.pyc

View file

@ -1 +0,0 @@
/*.pyc

File diff suppressed because it is too large Load diff

View file

@ -1,111 +0,0 @@
# Translation of Django admin JS to Welsh.
# Copyright (C) 2005 Django project
# This file is distributed under the same license as the Django package.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-12-09 11:51+0100\n"
"PO-Revision-Date: 2005-12-04 16:53+0000\n"
"Last-Translator: Jason Davies <jason@jasondavies.com>\n"
"Language-Team: Cymraeg <cy@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: contrib/admin/media/js/SelectFilter2.js:33
#, perl-format
msgid "Available %s"
msgstr ""
#: contrib/admin/media/js/SelectFilter2.js:41
#, fuzzy
msgid "Choose all"
msgstr "Dewis amser"
#: contrib/admin/media/js/SelectFilter2.js:46
msgid "Add"
msgstr ""
#: contrib/admin/media/js/SelectFilter2.js:48
msgid "Remove"
msgstr ""
#: contrib/admin/media/js/SelectFilter2.js:53
#, perl-format
msgid "Chosen %s"
msgstr ""
#: contrib/admin/media/js/SelectFilter2.js:54
msgid "Select your choice(s) and click "
msgstr ""
#: contrib/admin/media/js/SelectFilter2.js:59
msgid "Clear all"
msgstr ""
#: contrib/admin/media/js/dateparse.js:26
#: contrib/admin/media/js/calendar.js:24
msgid ""
"January February March April May June July August September October November "
"December"
msgstr ""
"Ionawr Chwefror Mawrth Ebrill Mai Mehefin Gorffennaf Medi Hydref Tachwedd "
"Rhagfyr"
#: contrib/admin/media/js/dateparse.js:27
msgid "Sunday Monday Tuesday Wednesday Thursday Friday Saturday"
msgstr ""
#: contrib/admin/media/js/calendar.js:25
msgid "S M T W T F S"
msgstr "S Ll M M I G S"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:45
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:80
msgid "Now"
msgstr "Nawr"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:48
msgid "Clock"
msgstr "Cloc"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:77
msgid "Choose a time"
msgstr "Dewis amser"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:81
msgid "Midnight"
msgstr "Hanner nos"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:82
msgid "6 a.m."
msgstr "6 y.b."
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:83
msgid "Noon"
msgstr "Hanner dydd"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:87
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:168
msgid "Cancel"
msgstr "Diddymu"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:111
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:162
msgid "Today"
msgstr "Heddiw"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:114
msgid "Calendar"
msgstr "Calendr"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:160
msgid "Yesterday"
msgstr "Ddoe"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:164
msgid "Tomorrow"
msgstr "Yfory"

View file

@ -1,7 +1,10 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package. # This file is distributed under the same license as the Django package.
# #
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'd F Y' DATE_FORMAT = 'd F Y'
TIME_FORMAT = 'g:i:s A' TIME_FORMAT = 'g:i:s A'
# DATETIME_FORMAT = # DATETIME_FORMAT =
@ -10,6 +13,9 @@ TIME_FORMAT = 'g:i:s A'
SHORT_DATE_FORMAT = 'j M Y' SHORT_DATE_FORMAT = 'j M Y'
# SHORT_DATETIME_FORMAT = # SHORT_DATETIME_FORMAT =
# FIRST_DAY_OF_WEEK = # FIRST_DAY_OF_WEEK =
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
# DATE_INPUT_FORMATS = # DATE_INPUT_FORMATS =
# TIME_INPUT_FORMATS = # TIME_INPUT_FORMATS =
# DATETIME_INPUT_FORMATS = # DATETIME_INPUT_FORMATS =

View file

@ -1 +0,0 @@
/*.pyc

View file

@ -1 +0,0 @@
/*.pyc

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more