Made the form display on the setup view display the function's docstring by default
This commit is contained in:
@@ -10,6 +10,16 @@ from common.utils import proper_name
|
|||||||
|
|
||||||
from storage.backends.filebasedstorage import FileBasedStorage
|
from storage.backends.filebasedstorage import FileBasedStorage
|
||||||
|
|
||||||
|
|
||||||
|
def default_checksum(x):
|
||||||
|
"""hashlib.sha256(x).hexdigest()"""
|
||||||
|
return hashlib.sha256(x).hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
def default_uuid():
|
||||||
|
"""unicode(uuid.uuid4())"""
|
||||||
|
return unicode(uuid.uuid4())
|
||||||
|
|
||||||
default_available_functions = {
|
default_available_functions = {
|
||||||
'current_date':datetime.datetime.now().date,
|
'current_date':datetime.datetime.now().date,
|
||||||
}
|
}
|
||||||
@@ -22,7 +32,6 @@ available_transformations = {
|
|||||||
'rotate': {'label':_(u'Rotate [degrees]'), 'arguments':[{'name':'degrees'}]}
|
'rotate': {'label':_(u'Rotate [degrees]'), 'arguments':[{'name':'degrees'}]}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
available_indexing_functions = {
|
available_indexing_functions = {
|
||||||
'proper_name': proper_name
|
'proper_name': proper_name
|
||||||
}
|
}
|
||||||
@@ -42,8 +51,8 @@ UNCOMPRESS_COMPRESSED_LOCAL_FILES = getattr(settings, 'DOCUMENTS_UNCOMPRESS_COMP
|
|||||||
UNCOMPRESS_COMPRESSED_STAGING_FILES = getattr(settings, 'DOCUMENTS_UNCOMPRESS_COMPRESSED_STAGING_FILES', True)
|
UNCOMPRESS_COMPRESSED_STAGING_FILES = getattr(settings, 'DOCUMENTS_UNCOMPRESS_COMPRESSED_STAGING_FILES', True)
|
||||||
|
|
||||||
# Saving
|
# Saving
|
||||||
CHECKSUM_FUNCTION = getattr(settings, 'DOCUMENTS_CHECKSUM_FUNCTION', lambda x: hashlib.sha256(x).hexdigest())
|
CHECKSUM_FUNCTION = getattr(settings, 'DOCUMENTS_CHECKSUM_FUNCTION', default_checksum)
|
||||||
UUID_FUNCTION = getattr(settings, 'DOCUMENTS_UUID_FUNCTION', lambda:unicode(uuid.uuid4()))
|
UUID_FUNCTION = getattr(settings, 'DOCUMENTS_UUID_FUNCTION', default_uuid)
|
||||||
|
|
||||||
# Storage
|
# Storage
|
||||||
STORAGE_BACKEND = getattr(settings, 'DOCUMENTS_STORAGE_BACKEND', FileBasedStorage)
|
STORAGE_BACKEND = getattr(settings, 'DOCUMENTS_STORAGE_BACKEND', FileBasedStorage)
|
||||||
|
|||||||
+1
-1
@@ -120,7 +120,7 @@ def check_settings(request):
|
|||||||
|
|
||||||
def _return_type(value):
|
def _return_type(value):
|
||||||
if isinstance(value, types.FunctionType):
|
if isinstance(value, types.FunctionType):
|
||||||
return _(u'function found')
|
return value.__doc__ if value.__doc__ else _(u'function found')
|
||||||
elif isinstance(value, types.ClassType):
|
elif isinstance(value, types.ClassType):
|
||||||
return _(u'class found: %s') % unicode(value).split("'")[1].split('.')[-1]
|
return _(u'class found: %s') % unicode(value).split("'")[1].split('.')[-1]
|
||||||
elif isinstance(value, types.TypeType):
|
elif isinstance(value, types.TypeType):
|
||||||
|
|||||||
Reference in New Issue
Block a user