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
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.
# 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
log = logging.getLogger('dajaxice')
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.path = path
self.doc = doc
self.method = method
def get_callable_path(self):
return '%s.%s' % (self.path.replace('.ajax', ''), self.name)
def __cmp__(self, other):
return (self.name == other.name and self.path == other.path)
def call(self, *args, **kwargs):
""" Call the function. """
return self.function(*args, **kwargs)
class DajaxiceModule(object):
def __init__(self, module):
self.functions = []
self.sub_modules = []
self.name = module[0]
""" Basic representation of a dajaxice module. """
sub_module = module[1:]
if len(sub_module) != 0:
self.add_submodule(sub_module)
def __init__(self, name=None):
self.name = name
self.functions = {}
self.submodules = {}
def get_module(self, module):
"""
Recursively get_module util we found it.
"""
if len(module) == 0:
return self
def add(self, name, function):
""" Add this function at the ``name`` deep. If the submodule already
exists, recusively call the add method into the submodule. If not,
create the module and call the add method."""
for dajaxice_module in self.sub_modules:
if dajaxice_module.name == module[0]:
return dajaxice_module.get_module(module[1:])
return None
def add_function(self, function):
self.functions.append(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
# If this is not the final function name (there are more modules)
# split the name again an register a new submodule.
if '.' in name:
module, extra = name.split('.', 1)
if module not in self.submodules:
self.submodules[module] = DajaxiceModule(module)
self.submodules[module].add(extra, function)
else:
sub_module = self.exist_submodule(module[0])
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
self.functions[name] = function
class Dajaxice(object):
def __init__(self):
self._registry = []
self._callable = []
self._registry = {}
self._modules = None
for function in getattr(settings, 'DAJAXICE_FUNCTIONS', ()):
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):
def register(self, function, name=None, method='POST'):
"""
Register function at 'module' depth
"""
#Create the dajaxice function.
function = DajaxiceFunction(name=name, path=module, doc=doc)
Register this function as a dajaxice function.
#Check for already registered functions.
full_path = '%s.%s' % (module, name)
if full_path in self._callable:
log.warning('%s already registered as dajaxice function.' % full_path)
If no name is provided, the module and the function name will be used.
The final (customized or not) must be unique. """
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
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.
module_without_ajax = module.replace('.ajax', '').split('.')
# Create the dajaxice function.
function = DajaxiceFunction(function=function,
name=name,
method=method)
#Register module if necessary.
exist_module = self._exist_module(module_without_ajax[0])
# Register this new ajax function
self._registry[name] = function
if type(exist_module) == int:
self._registry[exist_module].add_submodule(module_without_ajax[1:])
else:
self._registry.append(DajaxiceModule(module_without_ajax))
def is_callable(self, name, method):
""" Return if the function callable or not. """
return name in self._registry and self._registry[name].method == method
#Register Function
module = self.get_module(module_without_ajax)
if module:
module.add_function(function)
def clean_method(self, method):
""" Clean the http method. """
method = method.upper()
if method not in ['GET', 'POST']:
method = 'POST'
return method
def get_module(self, module):
"""
Recursively get module from registry
"""
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
def get(self, name):
""" Return the dajaxice function."""
return self._registry[name]
@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
@ -158,8 +109,8 @@ LOADING_DAJAXICE = False
def dajaxice_autodiscover():
"""
Auto-discover INSTALLED_APPS ajax.py modules and fail silently when
not present.
NOTE: dajaxice_autodiscover was inspired/copied from django.contrib.admin autodiscover
not present. NOTE: dajaxice_autodiscover was inspired/copied from
django.contrib.admin autodiscover
"""
global 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
dajaxice_functions = Dajaxice()
from django.conf import settings
from DajaxiceRequest import DajaxiceRequest
from Dajaxice import dajaxice_autodiscover
from Dajaxice import Dajaxice, 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
def dajaxice_register(original_function):
"""
Register the original funcion and returns it
def dajaxice_register(*dargs, **dkwargs):
""" Register some function as a dajaxice function
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)
return original_function
if len(dargs) and not dkwargs:
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 @@
#----------------------------------------------------------------------
# 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.
#----------------------------------------------------------------------
class FunctionNotCallableError(Exception):
def __init__(self, name):
self.name = name
class DajaxiceImportError(Exception):
class DajaxiceError(Exception):
pass
class FunctionNotCallableError(DajaxiceError):
pass
class DajaxiceImportError(DajaxiceError):
pass

View file

@ -44,7 +44,7 @@ class VirtualStorage(finders.FileSystemStorage):
for f in self.files:
if f.startswith(path):
f = f.replace(path, '', 1)
if os.sep in f:
if os.sep in f:
folders.append(f.split(os.sep, 1)[0])
else:
files.append(f)
@ -60,7 +60,7 @@ class VirtualStorage(finders.FileSystemStorage):
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):
from dajaxice.core import dajaxice_autodiscover, dajaxice_config
@ -68,7 +68,7 @@ class DajaxiceStorage(VirtualStorage):
dajaxice_autodiscover()
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):

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 = {
{% for module in dajaxice_js_functions %}
{% include "dajaxice/dajaxice_core_loop.js" %}
{% endfor %}{% ifnotequal dajaxice_js_functions|length 0 %},{% endifnotequal %}
{% with module=dajaxice_config.modules top='top' %}
{% 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)
{
var cookieValue = null;
@ -19,95 +25,106 @@ var Dajaxice = {
}
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 is_callback_a_function = (typeof(dajaxice_callback) == 'function');
if(!is_callback_a_function){
alert("dajaxice_callback should be a function since dajaxice 0.2")
var custom_settings = custom_settings || {},
error_callback = Dajaxice.get_setting('default_exception_callback');
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'){
exception_callback = this.get_setting('default_exception_callback');
var send_data = 'argv='+encodeURIComponent(JSON.stringify(argv)),
oXMLHttpRequest = new XMLHttpRequest,
endpoint = '{% url 'dajaxice-endpoint' %}'+dajaxice_function+'/';
if(method == 'GET'){
endpoint = endpoint + '?' + send_data;
}
send_data.push('argv='+encodeURIComponent(JSON.stringify(argv)));
send_data = send_data.join('&');
var oXMLHttpRequest = new XMLHttpRequest;
oXMLHttpRequest.open('POST', '/{{DAJAXICE_URL_PREFIX}}/'+dajaxice_function+'/');
oXMLHttpRequest.open(method, endpoint);
oXMLHttpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
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() {
if (this.readyState == XMLHttpRequest.DONE) {
if(this.responseText == Dajaxice.EXCEPTION){
exception_callback();
if(this.responseText == Dajaxice.EXCEPTION || !(this.status in Dajaxice.valid_http_responses())){
error_callback();
}
else{
try{
dajaxice_callback(JSON.parse(this.responseText));
var response;
try {
response = JSON.parse(this.responseText);
}
catch(exception){
dajaxice_callback(this.responseText);
catch (exception) {
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)
{
this.settings = settings;
},
get_setting: function(key){
if(this.settings == undefined || this.settings[key] == undefined){
return this.default_settings[key];
return Dajaxice.default_settings[key];
}
return this.settings[key];
},
default_exception_callback: function(data){
alert('Something goes wrong');
}
};
Dajaxice.EXCEPTION = '{{ DAJAXICE_EXCEPTION }}';
Dajaxice.default_settings = {'default_exception_callback': Dajaxice.default_exception_callback}
valid_http_responses: function(){
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;
{% comment %}
/*
XMLHttpRequest.js Compiled with Google Closure
XMLHttpRequest.js Copyright (C) 2008 Sergey Ilinsky (http://www.ilinsky.com)
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
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This work is distributed in the hope that it will be useful,
but without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose. See the
GNU Lesser General Public License for more details.
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.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
{% endcomment %}
{% if 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;
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=
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",
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,
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)};
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,
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=
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})();
{% if dajaxice_config.DAJAXICE_XMLHTTPREQUEST_JS_IMPORT %}
(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=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/);
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=
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",
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}}}};
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,
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(){},
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 %}
{% 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().
*/
{% endcomment %}
{% if DAJAXICE_JSON2_JS_IMPORT %}
if(!this.JSON)this.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";
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(",")+"}";
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,
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("",
{"":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,
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){a=eval("("+a+")");return typeof c==="function"?d({"":a},""):a}throw new SyntaxError("JSON.parse");}})();
{% endif %}
{% if dajaxice_config.DAJAXICE_JSON2_JS_IMPORT %}
var JSON;JSON||(JSON={});
(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";
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(",")+
"}";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,
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})});
"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,""))){d=eval("("+a+")");return typeof e==="function"?c({"":d},""):d}throw new SyntaxError("JSON.parse");})})();
{% 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 %}
{{ function_name }}: function(callback_function, argv, custom_settings){
Dajaxice.call('{{ function.name }}', '{{ function.method }}', callback_function, argv, custom_settings);
}{% if not forloop.last or top %},{% endif %}
return Dajaxice.call('{{ function.name }}', '{{ function.method }}', callback_function, argv, custom_settings);
}{% if not forloop.last or top or module.submodules %},{% endif %}
{% 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 }}: {
{% include "dajaxice/dajaxice_function_loop.js" %}
{% with parent_foorloop=forloop %}
{% for name, sub_module in module.submodules.items %}
{% with filename="dajaxice/dajaxice_module_loop.js" module=sub_module %}
{% include filename %}
{% endwith %}
{% if not forloop.last %},{% endif %}
{% endfor %}
}{% if not forloop.last %},{% endif %}
}
{% endwith %}

View file

@ -1,42 +1,35 @@
#----------------------------------------------------------------------
# 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 logging
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()
log = logging.getLogger('dajaxice')
@register.inclusion_tag('dajaxice/dajaxice_js_import.html', takes_context=True)
def dajaxice_js_import(context):
return {'DAJAXICE_MEDIA_PREFIX': DajaxiceRequest.get_media_prefix()}
@register.simple_tag(takes_context=True)
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.conf import settings
from dajaxice.exceptions import FunctionNotCallableError, DajaxiceImportError
from dajaxice.core import DajaxiceRequest
from dajaxice.core.Dajaxice import Dajaxice, DajaxiceModule, DajaxiceFunction
from dajaxice.core import dajaxice_functions
from dajaxice.core import DajaxiceConfig
from dajaxice.core.Dajaxice import DajaxiceModule, DajaxiceFunction, Dajaxice
from dajaxice.exceptions import FunctionNotCallableError
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):
@ -48,127 +116,50 @@ class DjangoIntegrationTest(TestCase):
urls = 'dajaxice.tests.urls'
def setUp(self):
settings.DAJAXICE_MEDIA_PREFIX = "dajaxice"
settings.DAJAXICE_DEBUG = False
settings.INSTALLED_APPS += ('dajaxice.tests', 'dajaxice.tests.submodules',)
os.environ['DJANGO_SETTINGS_MODULE'] = 'dajaxice'
settings.INSTALLED_APPS += ('dajaxice.tests',)
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):
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.content, 'my_callback()')
self.failUnlessEqual(response.content, '{"foo": "bar"}')
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.content, 'my_callback("value1")')
self.failUnlessEqual(response.content, '{"param1": "value1"}')
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.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')
self.failUnless(dr._is_callable())
response = self.client.get('/dajaxice/dajaxice.tests.test_get_register/')
dr = DajaxiceRequest(None, 'dajaxice.tests.test_ajax_not_registered')
self.failIf(dr._is_callable())
self.failUnlessEqual(response.status_code, 200)
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'),
DajaxiceFunction('test_string', 'dajaxice.tests.ajax.test_string'),
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')]
self.failUnlessEqual(response.status_code, 200)
self.failUnlessEqual(response.content, '{"bar": "user"}')
callables = [f.path for f in functions]
def test_multi_register(self):
self.failUnlessEqual(len(js_functions), 1)
self.failUnlessEqual(dajaxice_functions._callable, callables)
response = self.client.get('/dajaxice/get_multi/')
self.failUnlessEqual(response.status_code, 200)
self.failUnlessEqual(response.content, '{"foo": "multi"}')
sub = js_functions[0]
self.failUnlessEqual(len(sub.sub_modules), 1)
self.failUnlessEqual(len(sub.functions), 0)
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)
response = self.client.post('/dajaxice/post_multi/')
self.failUnlessEqual(response.status_code, 200)
self.failUnlessEqual(response.content, '{"foo": "multi"}')

View file

@ -1,61 +1,43 @@
#----------------------------------------------------------------------
# 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.utils import simplejson
from dajaxice.core import dajaxice_functions
import json
from dajaxice.decorators import dajaxice_register
@dajaxice_register
def test_registered_function(request):
return ""
dajaxice_functions.register(test_registered_function)
@dajaxice_register
def test_string(request):
return simplejson.dumps({'string': 'hello world'})
dajaxice_functions.register(test_string)
return json.dumps({'string': 'hello world'})
@dajaxice_register
def test_ajax_exception(request):
raise Exception()
return
dajaxice_functions.register(test_ajax_exception)
@dajaxice_register
def test_foo(request):
return ""
dajaxice_functions.register(test_foo)
return json.dumps({'foo': 'bar'})
@dajaxice_register
def test_foo_with_params(request, param1):
return simplejson.dumps(param1)
dajaxice_functions.register(test_foo_with_params)
return json.dumps({'param1': param1})
@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 import settings
from dajaxice.core import dajaxice_autodiscover
from dajaxice.core import dajaxice_autodiscover, dajaxice_config
dajaxice_autodiscover()
urlpatterns = patterns('',
#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 @@
#----------------------------------------------------------------------
# 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 import *
from .views import DajaxiceRequest
from django.conf.urls.defaults import *
urlpatterns = patterns('',
url(r'^dajaxice.core.js$', 'dajaxice.views.js_core'),
url(r'^(.*)/$', 'dajaxice.views.dajaxice_request'),)
urlpatterns = patterns('dajaxice.views',
url(r'^(.+)/$', DajaxiceRequest.as_view(), name='dajaxice-call-endpoint'),
url(r'', DajaxiceRequest.as_view(), name='dajaxice-endpoint'),
)

View file

@ -1,50 +1,8 @@
#----------------------------------------------------------------------
# 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.http import QueryDict
def deserialize_form(data):
"""
Create a new QueryDict from a serialized form.
"""
from django.http import QueryDict
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]
return QueryDict(query_string=unicode(data).encode('utf-8'))

View file

@ -1,62 +1,60 @@
#----------------------------------------------------------------------
# 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 logging, json
from django.shortcuts import render_to_response
from django.views.decorators.cache import cache_control
from django.conf import settings
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
Uses DajaxRequest to handle dajax request.
Return the apropiate json according app_name and method.
Recursively clone json structure with UTF-8 dictionary keys
http://www.gossamer-threads.com/lists/python/bugs/684379
"""
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())
def js_core(request):
"""
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()}
class DajaxiceRequest(View):
""" Handle all the dajaxice xhr requests. """
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():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version = '%s.%s' % (version, VERSION[2])
if VERSION[3:] == ('alpha', 0):
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
def get_version(*args, **kwargs):
# Don't litter django/__init__.py with all the get_version stuff.
# Only import if it's actually called.
from django.utils.version import get_version
return get_version(*args, **kwargs)

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).
"""
import warnings
from django.core import management
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
import os
import pstats
import sys, os
import sys
def gather_stats(p):
profiles = {}
@ -23,7 +24,7 @@ def gather_stats(p):
prof = stats.load(os.path.join(p, f))
else:
continue
print "Processing %s" % f
print("Processing %s" % f)
if path in profiles:
profiles[path].add(prof)
else:

View file

@ -11,7 +11,7 @@ def unique_messages():
elif os.path.isdir('locale'):
basedir = os.path.abspath('locale')
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)
for (dirpath, dirnames, filenames) in os.walk(basedir):
@ -22,7 +22,8 @@ def unique_messages():
cmd = 'msguniq "%s.po"' % pf
stdout = os.popen(cmd)
msg = stdout.read()
open('%s.po' % pf, 'w').write(msg)
with open('%s.po' % pf, 'w') as fp:
fp.write(msg)
if __name__ == "__main__":
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.
"""
import logging
import os
import re
import sys
import time # Needed for Windows
import warnings
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.module_loading import import_by_path
from django.utils import six
ENVIRONMENT_VARIABLE = "DJANGO_SETTINGS_MODULE"
class LazySettings(LazyObject):
"""
A lazy proxy for either global Django settings or a custom settings object.
The user can manually configure settings prior to using them. Otherwise,
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
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.
raise KeyError
except KeyError:
# NOTE: This is arguably an EnvironmentError, but that causes
# problems with Python's interactive help.
raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE)
desc = ("setting %s" % name) if name else "settings"
raise ImproperlyConfigured(
"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._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):
"""
@ -45,21 +85,36 @@ class LazySettings(LazyObject):
parameter sets where to retrieve any unspecified values from (its
argument must support attribute access (__getattr__)).
"""
if self._wrapped != None:
if self._wrapped is not empty:
raise RuntimeError('Settings already configured.')
holder = UserSettingsHolder(default_settings)
for name, value in options.items():
setattr(holder, name, value)
self._wrapped = holder
self._configure_logging()
@property
def configured(self):
"""
Returns True if the settings have already been configured.
"""
return bool(self._wrapped)
configured = property(configured)
return self._wrapped is not empty
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):
# update this dict from global settings (but only for ALL_CAPS settings)
for setting in dir(global_settings):
@ -71,8 +126,11 @@ class Settings(object):
try:
mod = importlib.import_module(self.SETTINGS_MODULE)
except ImportError, e:
raise ImportError("Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e))
except ImportError as 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
# as strings.
@ -81,34 +139,31 @@ class Settings(object):
for setting in dir(mod):
if setting == setting.upper():
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.
setattr(self, setting, setting_value)
# Expand entries in INSTALLED_APPS like "django.contrib.*" to a list
# of all those apps.
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 not self.SECRET_KEY:
raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
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
# we don't do this unconditionally (breaks Windows).
os.environ['TZ'] = self.TIME_ZONE
time.tzset()
class UserSettingsHolder(object):
class UserSettingsHolder(BaseSettings):
"""
Holder for user configured settings.
"""
@ -121,16 +176,23 @@ class UserSettingsHolder(object):
Requests for configuration variables not in this class are satisfied
from the module specified in default_settings (if possible).
"""
self.__dict__['_deleted'] = set()
self.default_settings = default_settings
def __getattr__(self, name):
if name in self._deleted:
raise AttributeError
return getattr(self.default_settings, name)
def __dir__(self):
return self.__dict__.keys() + dir(self.default_settings)
def __setattr__(self, name, value):
self._deleted.discard(name)
return super(UserSettingsHolder, self).__setattr__(name, value)
# For Python < 2.6:
__members__ = property(lambda self: self.__dir__())
def __delattr__(self, name):
self._deleted.add(name)
return super(UserSettingsHolder, self).__delattr__(name)
def __dir__(self):
return list(self.__dict__) + dir(self.default_settings)
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
class SimpleTest(TestCase):
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
"""}
# Create your tests here.

View file

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

View file

@ -13,7 +13,7 @@ DEBUG = False
TEMPLATE_DEBUG = False
# 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.
DEBUG_PROPAGATE_EXCEPTIONS = False
@ -21,7 +21,7 @@ DEBUG_PROPAGATE_EXCEPTIONS = False
USE_ETAGS = False
# 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 = ()
# Tuple of IP addresses, as strings, that:
@ -29,21 +29,32 @@ ADMINS = ()
# * Receive x-headers
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:
# 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'
# 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:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
# Languages we provide translations for, out of the box. The language name
# should be the utf-8 encoded local name for the language.
# Languages we provide translations for, out of the box.
LANGUAGES = (
('af', gettext_noop('Afrikaans')),
('ar', gettext_noop('Arabic')),
('az', gettext_noop('Azerbaijani')),
('bg', gettext_noop('Bulgarian')),
('be', gettext_noop('Belarusian')),
('bn', gettext_noop('Bengali')),
('br', gettext_noop('Breton')),
('bs', gettext_noop('Bosnian')),
('ca', gettext_noop('Catalan')),
('cs', gettext_noop('Czech')),
@ -53,8 +64,12 @@ LANGUAGES = (
('el', gettext_noop('Greek')),
('en', gettext_noop('English')),
('en-gb', gettext_noop('British English')),
('eo', gettext_noop('Esperanto')),
('es', gettext_noop('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')),
('eu', gettext_noop('Basque')),
('fa', gettext_noop('Persian')),
@ -67,23 +82,29 @@ LANGUAGES = (
('hi', gettext_noop('Hindi')),
('hr', gettext_noop('Croatian')),
('hu', gettext_noop('Hungarian')),
('ia', gettext_noop('Interlingua')),
('id', gettext_noop('Indonesian')),
('is', gettext_noop('Icelandic')),
('it', gettext_noop('Italian')),
('ja', gettext_noop('Japanese')),
('ka', gettext_noop('Georgian')),
('kk', gettext_noop('Kazakh')),
('km', gettext_noop('Khmer')),
('kn', gettext_noop('Kannada')),
('ko', gettext_noop('Korean')),
('lb', gettext_noop('Luxembourgish')),
('lt', gettext_noop('Lithuanian')),
('lv', gettext_noop('Latvian')),
('mk', gettext_noop('Macedonian')),
('ml', gettext_noop('Malayalam')),
('mn', gettext_noop('Mongolian')),
('nl', gettext_noop('Dutch')),
('no', gettext_noop('Norwegian')),
('my', gettext_noop('Burmese')),
('nb', gettext_noop('Norwegian Bokmal')),
('ne', gettext_noop('Nepali')),
('nl', gettext_noop('Dutch')),
('nn', gettext_noop('Norwegian Nynorsk')),
('os', gettext_noop('Ossetic')),
('pa', gettext_noop('Punjabi')),
('pl', gettext_noop('Polish')),
('pt', gettext_noop('Portuguese')),
('pt-br', gettext_noop('Brazilian Portuguese')),
@ -95,18 +116,22 @@ LANGUAGES = (
('sr', gettext_noop('Serbian')),
('sr-latn', gettext_noop('Serbian Latin')),
('sv', gettext_noop('Swedish')),
('sw', gettext_noop('Swahili')),
('ta', gettext_noop('Tamil')),
('te', gettext_noop('Telugu')),
('th', gettext_noop('Thai')),
('tr', gettext_noop('Turkish')),
('tt', gettext_noop('Tatar')),
('udm', gettext_noop('Udmurt')),
('uk', gettext_noop('Ukrainian')),
('ur', gettext_noop('Urdu')),
('vi', gettext_noop('Vietnamese')),
('zh-cn', gettext_noop('Simplified Chinese')),
('zh-tw', gettext_noop('Traditional Chinese')),
)
# 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
# to load the internationalization machinery.
@ -115,11 +140,11 @@ LOCALE_PATHS = ()
LANGUAGE_COOKIE_NAME = 'django_language'
# 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
# Not-necessarily-technical managers of the site. They get broken link
# notifications and other various e-mails.
# notifications and other various emails.
MANAGERS = ADMINS
# 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).
FILE_CHARSET = 'utf-8'
# E-mail address that error messages come from.
# Email address that error messages come from.
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
# Database connection info.
# Legacy format
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.
# Database connection info. If left empty, will default to the dummy backend.
DATABASES = {}
# New format
DATABASES = {
}
# Classes used to implement db routing behaviour
# Classes used to implement DB routing behavior.
DATABASE_ROUTERS = []
# 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.
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# Host for sending e-mail.
# Host for sending email.
EMAIL_HOST = 'localhost'
# Port for sending e-mail.
# Port for sending email.
EMAIL_PORT = 25
# Optional SMTP authentication information for EMAIL_HOST.
@ -194,6 +208,8 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.core.context_processors.tz',
# 'django.core.context_processors.request',
'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.
TEMPLATE_STRING_IF_INVALID = ''
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/media/'
# Default e-mail address to use for various automated correspondence from
# Default email address to use for various automated correspondence from
# the site managers.
DEFAULT_FROM_EMAIL = 'webmaster@localhost'
@ -246,9 +257,17 @@ ALLOWED_INCLUDE_ROOTS = ()
# is an admin.
ADMIN_FOR = ()
# 404s that may be ignored.
IGNORABLE_404_STARTS = ('/cgi-bin/', '/_vti_bin', '/_vti_inf')
IGNORABLE_404_ENDS = ('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi', 'favicon.ico', '.php')
# List of compiled regular expression objects representing URLs that need not
# be reported by BrokenLinkEmailsMiddleware. Here are a few examples:
# 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
# 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'
# 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 = ''
# 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 = ''
# 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.
FILE_UPLOAD_HANDLERS = (
'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
TIME_INPUT_FORMATS = (
'%H:%M:%S', # '14:30:59'
'%H:%M:%S.%f', # '14:30:59.000200'
'%H:%M', # '14:30'
)
@ -350,12 +378,15 @@ TIME_INPUT_FORMATS = (
# * Note that these format strings are different from the ones to display dates
DATETIME_INPUT_FORMATS = (
'%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', # '2006-10-25'
'%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', # '10/25/2006'
'%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', # '10/25/06'
)
@ -370,7 +401,7 @@ DECIMAL_SEPARATOR = '.'
# Boolean that sets whether to add thousand separator when formatting numbers
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...
NUMBER_GROUPING = 0
@ -381,17 +412,31 @@ THOUSAND_SEPARATOR = ','
# Hint: you really don't!
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.
DEFAULT_TABLESPACE = ''
DEFAULT_INDEX_TABLESPACE = ''
# Default X-Frame-Options header value
X_FRAME_OPTIONS = 'SAMEORIGIN'
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 #
##############
@ -413,25 +458,32 @@ MIDDLEWARE_CLASSES = (
# 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_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_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_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_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 #
#########
# The cache backend to use. See the docstring in django.core.cache for the
# possible values.
CACHE_BACKEND = 'locmem://'
# The cache backends to use.
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
}
}
CACHE_MIDDLEWARE_KEY_PREFIX = ''
CACHE_MIDDLEWARE_SECONDS = 600
CACHE_MIDDLEWARE_ALIAS = 'default'
####################
# COMMENTS #
@ -439,34 +491,16 @@ CACHE_MIDDLEWARE_SECONDS = 600
COMMENTS_ALLOW_PROFANITIES = False
# The profanities that will trigger a validation error in the
# 'hasNoProfanities' validator. All of these should be in lowercase.
PROFANITIES_LIST = ('asshat', 'asshead', 'asshole', 'cunt', 'fuck', 'gook', 'nigger', 'shit')
# 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 = ()
# The profanities that will trigger a validation error in
# CommentDetailsForm.clean_comment. All of these should be in lowercase.
PROFANITIES_LIST = ()
##################
# AUTHENTICATION #
##################
AUTH_USER_MODEL = 'auth.User'
AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend',)
LOGIN_URL = '/accounts/login/'
@ -478,6 +512,27 @@ LOGIN_REDIRECT_URL = '/accounts/profile/'
# The number of days a password reset link is valid for
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 #
########
@ -486,37 +541,43 @@ PASSWORD_RESET_TIMEOUT_DAYS = 3
# rejected by the CSRF middleware.
CSRF_FAILURE_VIEW = 'django.views.csrf.csrf_failure'
# Name and domain for CSRF cookie.
# Settings for CSRF cookie.
CSRF_COOKIE_NAME = 'csrftoken'
CSRF_COOKIE_DOMAIN = None
CSRF_COOKIE_PATH = '/'
CSRF_COOKIE_SECURE = False
CSRF_COOKIE_HTTPONLY = False
############
# MESSAGES #
############
# Class to use as messges backend
MESSAGE_STORAGE = 'django.contrib.messages.storage.user_messages.LegacyFallbackStorage'
# Class to use as messages backend
MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
# Default values of MESSAGE_LEVEL and MESSAGE_TAGS are defined within
# 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 #
###########
# The name of the class to use to run the test suite
TEST_RUNNER = 'django.test.simple.DjangoTestSuiteRunner'
# 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
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
############
# FIXTURES #
@ -524,3 +585,21 @@ TEST_DATABASE_COLLATION = None
# The list of directories to search for fixtures
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 -*-
# 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'
TIME_FORMAT = 'g:i:s A'
# DATETIME_FORMAT =
@ -10,6 +13,9 @@ MONTH_DAY_FORMAT = 'j F'
SHORT_DATE_FORMAT = 'd/m/Y'
# SHORT_DATETIME_FORMAT =
# 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 =
# TIME_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 -*-
# 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'
TIME_FORMAT = 'H:i:s'
# DATETIME_FORMAT =
@ -10,9 +13,12 @@ MONTH_DAY_FORMAT = 'j F'
SHORT_DATE_FORMAT = 'd.m.Y'
# SHORT_DATETIME_FORMAT =
# 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 =
# TIME_INPUT_FORMATS =
# DATETIME_INPUT_FORMATS =
DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = u' ' # Non-breaking space
THOUSAND_SEPARATOR = ' ' # Non-breaking space
# 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 -*-
# 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'
TIME_FORMAT = 'g:i:s A'
# DATETIME_FORMAT =
@ -10,6 +13,9 @@ MONTH_DAY_FORMAT = 'j F'
SHORT_DATE_FORMAT = 'j M, Y'
# SHORT_DATETIME_FORMAT =
# 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 =
# TIME_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 -*-
# 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.'
TIME_FORMAT = 'G:i'
DATETIME_FORMAT = 'j. N. Y. G:i T'
@ -10,6 +13,9 @@ MONTH_DAY_FORMAT = 'j. F'
SHORT_DATE_FORMAT = 'Y M j'
# SHORT_DATETIME_FORMAT =
# 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 =
# TIME_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 -*-
# 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'
DATETIME_FORMAT = r'j \de F \de Y \a \le\s G:i'
YEAR_MONTH_FORMAT = r'F \de\l Y'
MONTH_DAY_FORMAT = r'j \de F'
DATETIME_FORMAT = r'j \d\e F \d\e Y \a \l\e\s G:i'
YEAR_MONTH_FORMAT = r'F \d\e\l Y'
MONTH_DAY_FORMAT = r'j \d\e F'
SHORT_DATE_FORMAT = 'd/m/Y'
SHORT_DATETIME_FORMAT = 'd/m/Y G:i'
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 = (
# '31/12/2009', '31/12/09'
'%d/%m/%Y', '%d/%m/%y'
)
TIME_INPUT_FORMATS = (
# '14:30:59', '14:30'
'%H:%M:%S', '%H:%M'
)
DATETIME_INPUT_FORMATS = (
'%d/%m/%Y %H:%M:%S',
'%d/%m/%Y %H:%M:%S.%f',
'%d/%m/%Y %H:%M',
'%d/%m/%y %H:%M:%S',
'%d/%m/%y %H:%M:%S.%f',
'%d/%m/%y %H:%M',
)
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 -*-
# 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'
DATETIME_FORMAT = 'j. F Y G:i:s'
DATETIME_FORMAT = 'j. E Y G:i:s'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j. F'
SHORT_DATE_FORMAT = 'd.m.Y'
SHORT_DATETIME_FORMAT = 'd.m.Y G:i:s'
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 = (
'%d.%m.%Y', '%d.%m.%y', # '25.10.2006', '25.10.06'
'%Y-%m-%d', '%y-%m-%d', # '2006-10-25', '06-10-25'
'%d.%m.%Y', '%d.%m.%y', # '05.01.2006', '05.01.06'
'%d. %m. %Y', '%d. %m. %y', # '5. 1. 2006', '5. 1. 06'
# '%d. %B %Y', '%d. %b. %Y', # '25. October 2006', '25. Oct. 2006'
)
# Kept ISO formats as one is in first position
TIME_INPUT_FORMATS = (
'%H:%M:%S', # '14:30:59'
'%H:%M', # '14:30'
'%H:%M:%S', # '04:30:59'
'%H.%M', # '04.30'
'%H:%M', # '04:30'
)
DATETIME_INPUT_FORMATS = (
'%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59'
'%d.%m.%Y %H:%M', # '25.10.2006 14:30'
'%d.%m.%Y', # '25.10.2006'
'%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
'%Y-%m-%d %H:%M', # '2006-10-25 14:30'
'%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'
'%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 = ','
THOUSAND_SEPARATOR = ' '
THOUSAND_SEPARATOR = '\xa0' # non-breaking space
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 -*-
# 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'
TIME_FORMAT = 'g:i:s A'
# DATETIME_FORMAT =
@ -10,6 +13,9 @@ TIME_FORMAT = 'g:i:s A'
SHORT_DATE_FORMAT = 'j M Y'
# SHORT_DATETIME_FORMAT =
# 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 =
# TIME_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