Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63224e8ce6 | ||
|
|
ff7f9568db | ||
|
|
3635dd8faf | ||
|
|
d5fda056ff | ||
|
|
d8e8d1d597 | ||
|
|
59290534bc | ||
|
|
8fb0b71be6 | ||
|
|
ddc0fc9949 | ||
|
|
5428fdbd04 | ||
|
|
98f2bfbfb6 | ||
|
|
d780d26cc9 | ||
|
|
a5711bd933 | ||
|
|
b96cde2f77 | ||
|
|
a3f3ed1298 | ||
|
|
5f34193ac7 | ||
|
|
6fe6852a0c |
2
Makefile
2
Makefile
@@ -30,7 +30,7 @@ update:
|
||||
echo "remember that pymysql was tweaked"
|
||||
src:
|
||||
### Use semantic versioning
|
||||
echo 'Version 2.7.2-stable+timestamp.'`date +%Y.%m.%d.%H.%M.%S` > VERSION
|
||||
echo 'Version 2.7.3-stable+timestamp.'`date +%Y.%m.%d.%H.%M.%S` > VERSION
|
||||
### rm -f all junk files
|
||||
make clean
|
||||
### clean up baisc apps
|
||||
|
||||
2
VERSION
2
VERSION
@@ -1 +1 @@
|
||||
Version 2.7.2-stable+timestamp.2013.10.07.08.39.32
|
||||
Version 2.7.3-stable+timestamp.2013.10.11.18.10.01
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
'%s %%{row} updated': '%s filas actualizadas',
|
||||
'%Y-%m-%d': '%Y-%m-%d',
|
||||
'%Y-%m-%d %H:%M:%S': '%Y-%m-%d %H:%M:%S',
|
||||
'(requires internet access, experimental)': '(requires internet access, experimental)',
|
||||
'(requires internet access, experimental)': '(requiere acceso a internet, experimental)',
|
||||
'(something like "it-it")': '(algo como "it-it")',
|
||||
'@markmin\x01(file **gluon/contrib/plural_rules/%s.py** is not found)': '(file **gluon/contrib/plural_rules/%s.py** is not found)',
|
||||
'@markmin\x01An error occured, please [[reload %s]] the page': 'An error occured, please [[reload %s]] the page',
|
||||
@@ -17,16 +17,16 @@
|
||||
'About': 'acerca de',
|
||||
'About application': 'Acerca de la aplicación',
|
||||
'additional code for your application': 'código adicional para su aplicación',
|
||||
'Additional code for your application': 'Additional code for your application',
|
||||
'admin disabled because no admin password': ' por falta de contraseña',
|
||||
'Additional code for your application': 'Código adicional para su aplicación',
|
||||
'admin disabled because no admin password': 'admin deshabilitado por falta de contraseña',
|
||||
'admin disabled because not supported on google app engine': 'admin deshabilitado, no es soportado en GAE',
|
||||
'admin disabled because unable to access password file': 'admin deshabilitado, imposible acceder al archivo con la contraseña',
|
||||
'Admin is disabled because insecure channel': 'Admin deshabilitado, el canal no es seguro',
|
||||
'Admin is disabled because unsecure channel': 'Admin deshabilitado, el canal no es seguro',
|
||||
'Admin language': 'Admin language',
|
||||
'administrative interface': 'administrative interface',
|
||||
'Admin language': 'Lenguaje de administración',
|
||||
'administrative interface': 'interfaz administrativa',
|
||||
'Administrator Password:': 'Contraseña del Administrador:',
|
||||
'An error occured, please %s the page': 'An error occured, please %s the page',
|
||||
'An error occured, please %s the page': 'Ha ocurrido un error, por favor %s la página',
|
||||
'and rename it (required):': 'y renombrela (requerido):',
|
||||
'and rename it:': ' y renombrelo:',
|
||||
'appadmin': 'appadmin',
|
||||
@@ -35,7 +35,7 @@
|
||||
'application %(appname)s installed with md5sum: %(digest)s': 'application %(appname)s installed with md5sum: %(digest)s',
|
||||
'application compiled': 'aplicación compilada',
|
||||
'application is compiled and cannot be designed': 'la aplicación está compilada y no puede ser modificada',
|
||||
'Application name:': 'Application name:',
|
||||
'Application name:': 'Nombre de la aplicación:',
|
||||
'are not used': 'are not used',
|
||||
'are not used yet': 'are not used yet',
|
||||
'Are you sure you want to delete file "%s"?': '¿Está seguro que desea eliminar el archivo "%s"?',
|
||||
@@ -45,13 +45,13 @@
|
||||
'Are you sure you want to uninstall application "%s"?': '¿Está seguro que desea desinstalar la aplicación "%s"?',
|
||||
'Are you sure you want to upgrade web2py now?': '¿Está seguro que desea actualizar web2py ahora?',
|
||||
'arguments': 'argumentos',
|
||||
'at char %s': 'at char %s',
|
||||
'at line %s': 'at line %s',
|
||||
'at char %s': 'en el caracter %s',
|
||||
'at line %s': 'en la línea %s',
|
||||
'ATTENTION: Login requires a secure (HTTPS) connection or running on localhost.': 'ATENCION: Inicio de sesión requiere una conexión segura (HTTPS) o localhost.',
|
||||
'ATTENTION: TESTING IS NOT THREAD SAFE SO DO NOT PERFORM MULTIPLE TESTS CONCURRENTLY.': 'ATENCION: NO EJECUTE VARIAS PRUEBAS SIMULTANEAMENTE, NO SON THREAD SAFE.',
|
||||
'ATTENTION: you cannot edit the running application!': 'ATENCION: no puede modificar la aplicación que se ejecuta!',
|
||||
'Autocomplete': 'Autocomplete',
|
||||
'Autocomplete Python Code': 'Autocomplete Python Code',
|
||||
'Autocomplete Python Code': 'Autocompletar código Python',
|
||||
'Available databases and tables': 'Bases de datos y tablas disponibles',
|
||||
'back': 'atrás',
|
||||
'breakpoint': 'breakpoint',
|
||||
@@ -59,17 +59,17 @@
|
||||
'browse': 'buscar',
|
||||
'cache': 'cache',
|
||||
'cache, errors and sessions cleaned': 'cache, errores y sesiones eliminados',
|
||||
'can be a git repo': 'can be a git repo',
|
||||
'can be a git repo': 'puede ser un repositorio git',
|
||||
'Cannot be empty': 'No puede estar vacío',
|
||||
'Cannot compile: there are errors in your app. Debug it, correct errors and try again.': 'No se puede compilar: hay errores en su aplicación. Depure, corrija errores y vuelva a intentarlo.',
|
||||
'Cannot compile: there are errors in your app:': 'No se puede compilar: hay errores en su aplicación:',
|
||||
'cannot create file': 'no es posible crear archivo',
|
||||
'cannot upload file "%(filename)s"': 'no es posible subir archivo "%(filename)s"',
|
||||
'Change admin password': 'cambie contraseña admin',
|
||||
'change editor settings': 'change editor settings',
|
||||
'change editor settings': 'cambiar la configuración del editor',
|
||||
'Change Password': 'Cambie Contraseña',
|
||||
'check all': 'marcar todos',
|
||||
'Check for upgrades': 'Check for upgrades',
|
||||
'Check for upgrades': 'buscar actualizaciones',
|
||||
'Check to delete': 'Marque para eliminar',
|
||||
'Checking for upgrades...': 'Buscando actulizaciones...',
|
||||
'Clean': 'limpiar',
|
||||
@@ -77,21 +77,21 @@
|
||||
'click here for the administrative interface': 'haga clic aquí para usar la interfaz administrativa',
|
||||
'Click row to expand traceback': 'Click row to expand traceback',
|
||||
'click to check for upgrades': 'haga clic para buscar actualizaciones',
|
||||
'click to open': 'click to open',
|
||||
'click to open': 'click para abrir',
|
||||
'Client IP': 'IP del Cliente',
|
||||
'code': 'código',
|
||||
'Code listing': 'Code listing',
|
||||
'collapse/expand all': 'collapse/expand all',
|
||||
'commit (mercurial)': 'commit (mercurial)',
|
||||
'Code listing': 'Listado de código',
|
||||
'collapse/expand all': 'contraer/expandir todo',
|
||||
'commit (mercurial)': 'confirmar (mercurial)',
|
||||
'Compile': 'compilar',
|
||||
'compiled application removed': 'aplicación compilada removida',
|
||||
'continue': 'continue',
|
||||
'continue': 'continuar',
|
||||
'Controllers': 'Controladores',
|
||||
'controllers': 'controladores',
|
||||
'Count': 'Count',
|
||||
'Create': 'crear',
|
||||
'Create': 'Crear',
|
||||
'create file with filename:': 'cree archivo con nombre:',
|
||||
'Create new application using the Wizard': 'Create new application using the Wizard',
|
||||
'Create new application using the Wizard': 'Crear nueva aplicación utilizando el asistente',
|
||||
'create new application:': 'nombre de la nueva aplicación:',
|
||||
'Create new simple application': 'Cree una nueva aplicación',
|
||||
'Create/Upload': 'Create/Upload',
|
||||
@@ -115,25 +115,25 @@
|
||||
'delete': 'eliminar',
|
||||
'delete all checked': 'eliminar marcados',
|
||||
'delete plugin': 'eliminar plugin',
|
||||
'Delete this file (you will be asked to confirm deletion)': 'Delete this file (you will be asked to confirm deletion)',
|
||||
'Delete this file (you will be asked to confirm deletion)': 'Elimine este fichero (se le pedirá confirmación)',
|
||||
'Delete:': 'Elimine:',
|
||||
'Deploy': 'Deploy',
|
||||
'Deploy on Google App Engine': 'Instale en Google App Engine',
|
||||
'Deploy to OpenShift': 'Deploy to OpenShift',
|
||||
'Deploy to OpenShift': 'Instale en OpenShift',
|
||||
'Description': 'Descripción',
|
||||
'design': 'modificar',
|
||||
'DESIGN': 'DISEÑO',
|
||||
'Design for': 'Diseño para',
|
||||
'Detailed traceback description': 'Detailed traceback description',
|
||||
'details': 'details',
|
||||
'details': 'detalles',
|
||||
'direction: ltr': 'direction: ltr',
|
||||
'Disable': 'Disable',
|
||||
'Disable': 'Deshabilitar',
|
||||
'docs': 'docs',
|
||||
'done!': 'listo!',
|
||||
'Download': 'Download',
|
||||
'download files via http:': 'download files via http:',
|
||||
'download layouts': 'download layouts',
|
||||
'download plugins': 'download plugins',
|
||||
'Download': 'Descargar',
|
||||
'download files via http:': 'descargar archivos via http:',
|
||||
'download layouts': 'descargar layouts',
|
||||
'download plugins': 'descargar plugins',
|
||||
'E-mail': 'Correo electrónico',
|
||||
'EDIT': 'EDITAR',
|
||||
'Edit': 'editar',
|
||||
@@ -160,7 +160,7 @@
|
||||
'Expand Abbreviation': 'Expand Abbreviation',
|
||||
'export as csv file': 'exportar como archivo CSV',
|
||||
'exposes': 'expone',
|
||||
'exposes:': 'exposes:',
|
||||
'exposes:': 'expone:',
|
||||
'extends': 'extiende',
|
||||
'failed to compile file because:': 'failed to compile file because:',
|
||||
'failed to reload module': 'recarga del módulo ha fallado',
|
||||
@@ -176,8 +176,8 @@
|
||||
'file saved on %(time)s': 'archivo guardado %(time)s',
|
||||
'file saved on %s': 'archivo guardado %s',
|
||||
'filter': 'filter',
|
||||
'Find Next': 'Find Next',
|
||||
'Find Previous': 'Find Previous',
|
||||
'Find Next': 'Buscar próximo',
|
||||
'Find Previous': 'Bucar anterior',
|
||||
'First name': 'Nombre',
|
||||
'Frames': 'Frames',
|
||||
'Functions with no doctests will result in [passed] tests.': 'Funciones sin doctests equivalen a pruebas [aceptadas].',
|
||||
@@ -224,8 +224,8 @@
|
||||
'Login to the Administrative Interface': 'Inicio de sesión para la Interfaz Administrativa',
|
||||
'Logout': 'fin de sesión',
|
||||
'Lost Password': 'Contraseña perdida',
|
||||
'manage': 'manage',
|
||||
'Manage': 'Manage',
|
||||
'manage': 'gestionar',
|
||||
'Manage': 'Gestionar',
|
||||
'merge': 'combinar',
|
||||
'Models': 'Modelos',
|
||||
'models': 'modelos',
|
||||
@@ -233,11 +233,11 @@
|
||||
'modules': 'módulos',
|
||||
'Name': 'Nombre',
|
||||
'new application "%s" created': 'nueva aplicación "%s" creada',
|
||||
'New application wizard': 'New application wizard',
|
||||
'New application wizard': 'Asistente para nueva aplicación',
|
||||
'new plugin installed': 'nuevo plugin instalado',
|
||||
'New Record': 'Registro nuevo',
|
||||
'new record inserted': 'nuevo registro insertado',
|
||||
'New simple application': 'New simple application',
|
||||
'New simple application': 'Nueva aplicación',
|
||||
'next': 'next',
|
||||
'next 100 rows': '100 filas siguientes',
|
||||
'NO': 'NO',
|
||||
@@ -248,16 +248,16 @@
|
||||
'No ticket_storage.txt found under /private folder': 'No ticket_storage.txt found under /private folder',
|
||||
'online designer': 'online designer',
|
||||
'or alternatively': 'or alternatively',
|
||||
'Or Get from URL:': 'Or Get from URL:',
|
||||
'Or Get from URL:': 'O obtener desde una URL:',
|
||||
'or import from csv file': 'o importar desde archivo CSV',
|
||||
'or provide app url:': 'o provea URL de la aplicación:',
|
||||
'or provide application url:': 'o provea URL de la aplicación:',
|
||||
'Origin': 'Origen',
|
||||
'Original/Translation': 'Original/Traducción',
|
||||
'Overwrite installed app': 'sobreescriba aplicación instalada',
|
||||
'Overwrite installed app': 'sobreescriba la aplicación instalada',
|
||||
'Pack all': 'empaquetar todo',
|
||||
'Pack compiled': 'empaquete compiladas',
|
||||
'Pack custom': 'Pack custom',
|
||||
'Pack custom': 'empaquetar personalizado',
|
||||
'pack plugin': 'empaquetar plugin',
|
||||
'PAM authenticated user, cannot change password here': 'usuario autenticado por PAM, no puede cambiar la contraseña aquí',
|
||||
'Password': 'Contraseña',
|
||||
@@ -271,8 +271,8 @@
|
||||
'Plural-Forms:': 'Plural-Forms:',
|
||||
'Powered by': 'Este sitio usa',
|
||||
'previous 100 rows': '100 filas anteriores',
|
||||
'Private files': 'Private files',
|
||||
'private files': 'private files',
|
||||
'Private files': 'Archivos privados',
|
||||
'private files': 'archivos privados',
|
||||
'Query:': 'Consulta:',
|
||||
'Rapid Search': 'Rapid Search',
|
||||
'record': 'registro',
|
||||
@@ -285,9 +285,9 @@
|
||||
'reload': 'reload',
|
||||
'Reload routes': 'Reload routes',
|
||||
'Remove compiled': 'eliminar compiladas',
|
||||
'Removed Breakpoint on %s at line %s': 'Removed Breakpoint on %s at line %s',
|
||||
'Replace': 'Replace',
|
||||
'Replace All': 'Replace All',
|
||||
'Removed Breakpoint on %s at line %s': 'Eliminado punto de ruptura en %s en la línea %s',
|
||||
'Replace': 'Reemplazar',
|
||||
'Replace All': 'Reemplazar todos',
|
||||
'request': 'request',
|
||||
'Resolve Conflict file': 'archivo Resolución de Conflicto',
|
||||
'response': 'response',
|
||||
@@ -303,19 +303,19 @@
|
||||
'Running on %s': 'Running on %s',
|
||||
'Save': 'Save',
|
||||
'save': 'guardar',
|
||||
'Save file:': 'Save file:',
|
||||
'Save file: %s': 'Save file: %s',
|
||||
'Save via Ajax': 'Save via Ajax',
|
||||
'Save file:': 'Guardar:',
|
||||
'Save file: %s': 'Guardar: %s',
|
||||
'Save via Ajax': 'Guardar via Ajax',
|
||||
'Saved file hash:': 'Hash del archivo guardado:',
|
||||
'selected': 'seleccionado(s)',
|
||||
'session': 'session',
|
||||
'session expired': 'sesión expirada',
|
||||
'Set Breakpoint on %s at line %s: %s': 'Set Breakpoint on %s at line %s: %s',
|
||||
'Set Breakpoint on %s at line %s: %s': 'Establecer punto de ruptura en %s en la línea %s: %s',
|
||||
'shell': 'shell',
|
||||
'Site': 'sitio',
|
||||
'some files could not be removed': 'algunos archivos no pudieron ser removidos',
|
||||
'Start searching': 'Start searching',
|
||||
'Start wizard': 'Start wizard',
|
||||
'Start searching': 'Iniciar búsqueda',
|
||||
'Start wizard': 'Iniciar asistente',
|
||||
'state': 'estado',
|
||||
'Static': 'Static',
|
||||
'static': 'estáticos',
|
||||
@@ -324,7 +324,7 @@
|
||||
'stop': 'stop',
|
||||
'submit': 'enviar',
|
||||
'Submit': 'Submit',
|
||||
'successful': 'successful',
|
||||
'successful': 'exitoso',
|
||||
'Sure you want to delete this object?': '¿Está seguro que desea eliminar este objeto?',
|
||||
'table': 'tabla',
|
||||
'Table name': 'Nombre de la tabla',
|
||||
@@ -332,21 +332,21 @@
|
||||
'Testing application': 'Probando aplicación',
|
||||
'The "query" is a condition like "db.table1.field1==\'value\'". Something like "db.table1.field1==db.table2.field2" results in a SQL JOIN.': 'La "consulta" es una condición como "db.tabla1.campo1==\'valor\'". Algo como "db.tabla1.campo1==db.tabla2.campo2" resulta en un JOIN SQL.',
|
||||
'the application logic, each URL path is mapped in one exposed function in the controller': 'la lógica de la aplicación, cada ruta URL se mapea en una función expuesta en el controlador',
|
||||
'The application logic, each URL path is mapped in one exposed function in the controller': 'The application logic, each URL path is mapped in one exposed function in the controller',
|
||||
'The application logic, each URL path is mapped in one exposed function in the controller': 'La lógica de la aplicación, cada ruta URL se mapea en una función expuesta en el controlador',
|
||||
'the data representation, define database tables and sets': 'la representación de datos, define tablas y conjuntos de base de datos',
|
||||
'The data representation, define database tables and sets': 'The data representation, define database tables and sets',
|
||||
'The presentations layer, views are also known as templates': 'The presentations layer, views are also known as templates',
|
||||
'The data representation, define database tables and sets': 'La representación de datos, define tablas y conjuntos de base de datos',
|
||||
'The presentations layer, views are also known as templates': 'La capa de presentación, las vistas también son llamadas plantillas',
|
||||
'the presentations layer, views are also known as templates': 'la capa de presentación, las vistas también son llamadas plantillas',
|
||||
'There are no controllers': 'No hay controladores',
|
||||
'There are no models': 'No hay modelos',
|
||||
'There are no modules': 'No hay módulos',
|
||||
'There are no plugins': 'There are no plugins',
|
||||
'There are no private files': 'There are no private files',
|
||||
'There are no plugins': 'No hay plugins',
|
||||
'There are no private files': 'No hay archivos privados',
|
||||
'There are no static files': 'No hay archivos estáticos',
|
||||
'There are no translators, only default language is supported': 'No hay traductores, sólo el lenguaje por defecto es soportado',
|
||||
'There are no views': 'No hay vistas',
|
||||
'These files are not served, they are only available from within your app': 'These files are not served, they are only available from within your app',
|
||||
'These files are served without processing, your images go here': 'These files are served without processing, your images go here',
|
||||
'These files are not served, they are only available from within your app': 'Estos archivos no son servidos, ellos solo estan disponibles para su aplicación',
|
||||
'These files are served without processing, your images go here': 'Estos archivos son servidos sin procesar, sus imágenes van aquí',
|
||||
'these files are served without processing, your images go here': 'estos archivos son servidos sin procesar, sus imágenes van aquí',
|
||||
'This is the %(filename)s template': 'Esta es la plantilla %(filename)s',
|
||||
'this page to see if a breakpoint was hit and debug interaction is required.': 'this page to see if a breakpoint was hit and debug interaction is required.',
|
||||
@@ -358,14 +358,14 @@
|
||||
'To create a plugin, name a file/folder plugin_[name]': 'Para crear un plugin, nombre un archivo/carpeta plugin_[nombre]',
|
||||
'To emulate a breakpoint programatically, write:': 'To emulate a breakpoint programatically, write:',
|
||||
'to use the debugger!': 'to use the debugger!',
|
||||
'toggle breakpoint': 'toggle breakpoint',
|
||||
'Toggle Fullscreen': 'Toggle Fullscreen',
|
||||
'toggle breakpoint': 'alternar punto de ruptura',
|
||||
'Toggle Fullscreen': 'Alternar pantalla completa',
|
||||
'Traceback': 'Traceback',
|
||||
'translation strings for the application': 'cadenas de caracteres de traducción para la aplicación',
|
||||
'Translation strings for the application': 'Translation strings for the application',
|
||||
'Translation strings for the application': 'Cadenas de caracteres de traducción para la aplicación',
|
||||
'try': 'intente',
|
||||
'try something like': 'intente algo como',
|
||||
'Try the mobile interface': 'Try the mobile interface',
|
||||
'Try the mobile interface': 'Pruebe la interfaz móvil',
|
||||
'try view': 'try view',
|
||||
'Type some Python code in here and hit Return (Enter) to execute it.': 'Type some Python code in here and hit Return (Enter) to execute it.',
|
||||
'Unable to check for upgrades': 'No es posible verificar la existencia de actualizaciones',
|
||||
@@ -386,10 +386,10 @@
|
||||
'Update:': 'Actualice:',
|
||||
'upgrade now to %s': 'upgrade now to %s',
|
||||
'upgrade web2py now': 'actualize web2py ahora',
|
||||
'Upload': 'Upload',
|
||||
'Upload': 'Subir',
|
||||
'Upload & install packed application': 'Suba e instale aplicación empaquetada',
|
||||
'Upload a package:': 'Upload a package:',
|
||||
'Upload and install packed application': 'Upload and install packed application',
|
||||
'Upload a package:': 'Subir un paquete:',
|
||||
'Upload and install packed application': 'Suba e instale una aplicación empaquetada',
|
||||
'upload application:': 'subir aplicación:',
|
||||
'Upload existing application': 'Suba esta aplicación',
|
||||
'upload file:': 'suba archivo:',
|
||||
|
||||
@@ -8,6 +8,7 @@ from gluon.fileutils import read_file
|
||||
# ## make sure administrator is on localhost or https
|
||||
# ###########################################################
|
||||
|
||||
|
||||
http_host = request.env.http_host.split(':')[0]
|
||||
|
||||
if request.env.web2py_runtime_gae:
|
||||
@@ -145,6 +146,10 @@ elif session.is_mobile == 'false':
|
||||
else:
|
||||
is_mobile = request.user_agent().is_mobile
|
||||
|
||||
if DEMO_MODE:
|
||||
session.authorized = True
|
||||
session.forget()
|
||||
|
||||
if request.controller == "webservices":
|
||||
basic = request.env.http_authorization
|
||||
if not basic or not basic[:6].lower() == 'basic ':
|
||||
|
||||
@@ -380,7 +380,6 @@ _base_environment_['SQLFORM'] = SQLFORM
|
||||
_base_environment_['SQLTABLE'] = SQLTABLE
|
||||
_base_environment_['LOAD'] = LOAD
|
||||
|
||||
|
||||
def build_environment(request, response, session, store_current=True):
|
||||
"""
|
||||
Build the environment dictionary into which web2py files are executed.
|
||||
@@ -392,8 +391,11 @@ def build_environment(request, response, session, store_current=True):
|
||||
request.env = Storage()
|
||||
# Enable standard conditional models (i.e., /*.py, /[controller]/*.py, and
|
||||
# /[controller]/[function]/*.py)
|
||||
response.models_to_run = [r'^\w+\.py$', r'^%s/\w+\.py$' % request.controller,
|
||||
r'^%s/%s/\w+\.py$' % (request.controller, request.function)]
|
||||
response.models_to_run = [
|
||||
r'^\w+\.py$',
|
||||
r'^%s/\w+\.py$' % request.controller,
|
||||
r'^%s/%s/\w+\.py$' % (request.controller, request.function)
|
||||
]
|
||||
|
||||
t = environment['T'] = translator(os.path.join(request.folder,'languages'),
|
||||
request.env.http_accept_language)
|
||||
@@ -452,12 +454,12 @@ def compile_views(folder):
|
||||
"""
|
||||
|
||||
path = pjoin(folder, 'views')
|
||||
for file in listdir(path, '^[\w/\-]+(\.\w+)*$'):
|
||||
for fname in listdir(path, '^[\w/\-]+(\.\w+)*$'):
|
||||
try:
|
||||
data = parse_template(file, path)
|
||||
data = parse_template(fname, path)
|
||||
except Exception, e:
|
||||
raise Exception("%s in %s" % (e, file))
|
||||
filename = ('views/%s.py' % file).replace('/', '_').replace('\\', '_')
|
||||
raise Exception("%s in %s" % (e, fname))
|
||||
filename = 'views.%s.py' % fname.replace(os.path.sep, '.')
|
||||
filename = pjoin(folder, 'compiled', filename)
|
||||
write_file(filename, data)
|
||||
save_pyc(filename)
|
||||
@@ -470,9 +472,10 @@ def compile_models(folder):
|
||||
"""
|
||||
|
||||
path = pjoin(folder, 'models')
|
||||
for file in listdir(path, '.+\.py$'):
|
||||
data = read_file(pjoin(path, file))
|
||||
filename = pjoin(folder, 'compiled', 'models', file)
|
||||
for fname in listdir(path, '.+\.py$'):
|
||||
data = read_file(pjoin(path, fname))
|
||||
modelfile = 'models.'+fname.replace(os.path.sep,'.')
|
||||
filename = pjoin(folder, 'compiled', modelfile)
|
||||
mktree(filename)
|
||||
write_file(filename, data)
|
||||
save_pyc(filename)
|
||||
@@ -485,20 +488,21 @@ def compile_controllers(folder):
|
||||
"""
|
||||
|
||||
path = pjoin(folder, 'controllers')
|
||||
for file in listdir(path, '.+\.py$'):
|
||||
for fname in listdir(path, '.+\.py$'):
|
||||
### why is this here? save_pyc(pjoin(path, file))
|
||||
data = read_file(pjoin(path, file))
|
||||
data = read_file(pjoin(path, fname))
|
||||
exposed = regex_expose.findall(data)
|
||||
for function in exposed:
|
||||
command = data + "\nresponse._vars=response._caller(%s)\n" % \
|
||||
function
|
||||
filename = pjoin(folder, 'compiled', ('controllers/'
|
||||
+ file[:-3]).replace('/', '_')
|
||||
+ '_' + function + '.py')
|
||||
filename = pjoin(folder, 'compiled',
|
||||
'controllers.%s.%s.py' % (fname[:-3],function))
|
||||
write_file(filename, command)
|
||||
save_pyc(filename)
|
||||
os.unlink(filename)
|
||||
|
||||
def model_cmp(a,b):
|
||||
return cmp(a.count('.'),b.count('.')) or cmp(a,b)
|
||||
|
||||
def run_models_in(environment):
|
||||
"""
|
||||
@@ -508,34 +512,39 @@ def run_models_in(environment):
|
||||
|
||||
folder = environment['request'].folder
|
||||
c = environment['request'].controller
|
||||
f = environment['request'].function
|
||||
f = environment['request'].function
|
||||
response = environment['response']
|
||||
|
||||
path = pjoin(folder, 'models')
|
||||
cpath = pjoin(folder, 'compiled')
|
||||
if os.path.exists(cpath):
|
||||
for model in listdir(cpath, '^models_\w+\.pyc$', 0):
|
||||
restricted(read_pyc(model), environment, layer=model)
|
||||
path = pjoin(cpath, 'models')
|
||||
models = listdir(path, '^\w+\.pyc$', 0, sort=True)
|
||||
compiled = True
|
||||
compiled = os.path.exists(cpath)
|
||||
if compiled:
|
||||
models = sorted(listdir(cpath, '^models[_.][\w.]+\.pyc$', 0),model_cmp)
|
||||
else:
|
||||
path = pjoin(folder, 'models')
|
||||
models = listdir(path, '^\w+\.py$', 0, sort=True)
|
||||
compiled = False
|
||||
n = len(path) + 1
|
||||
models = sorted(listdir(path, '^\w+\.py$', 0, sort=False),model_cmp)
|
||||
n = len(path)+1
|
||||
|
||||
models_to_run = None
|
||||
for model in models:
|
||||
regex = environment['response'].models_to_run
|
||||
if isinstance(regex, list):
|
||||
regex = re_compile('|'.join(regex))
|
||||
file = model[n:].replace(os.path.sep, '/').replace('.pyc', '.py')
|
||||
if not regex.search(file) and c != 'appadmin':
|
||||
continue
|
||||
elif compiled:
|
||||
code = read_pyc(model)
|
||||
elif is_gae:
|
||||
code = getcfs(model, model,
|
||||
lambda: compile2(read_file(model), model))
|
||||
else:
|
||||
code = getcfs(model, model, None)
|
||||
restricted(code, environment, layer=model)
|
||||
if response.models_to_run != models_to_run:
|
||||
regex = models_to_run = response.models_to_run
|
||||
if isinstance(regex, list):
|
||||
regex = re_compile('|'.join(regex))
|
||||
if models_to_run:
|
||||
if compiled:
|
||||
fname = model[n:-4].replace('.','/')+'.py'
|
||||
else:
|
||||
fname = model[n:].replace(os.path.sep,'/')
|
||||
if not regex.search(fname) and c != 'appadmin':
|
||||
continue
|
||||
elif compiled:
|
||||
code = read_pyc(model)
|
||||
elif is_gae:
|
||||
code = getcfs(model, model,
|
||||
lambda: compile2(read_file(model), model))
|
||||
else:
|
||||
code = getcfs(model, model, None)
|
||||
restricted(code, environment, layer=model)
|
||||
|
||||
|
||||
def run_controller_in(controller, function, environment):
|
||||
@@ -551,12 +560,17 @@ def run_controller_in(controller, function, environment):
|
||||
badc = 'invalid controller (%s/%s)' % (controller, function)
|
||||
badf = 'invalid function (%s/%s)' % (controller, function)
|
||||
if os.path.exists(path):
|
||||
filename = pjoin(path, 'controllers_%s_%s.pyc'
|
||||
filename = pjoin(path, 'controllers.%s.%s.pyc'
|
||||
% (controller, function))
|
||||
if not os.path.exists(filename):
|
||||
raise HTTP(404,
|
||||
rewrite.THREAD_LOCAL.routes.error_message % badf,
|
||||
web2py_error=badf)
|
||||
### for backward compatibility
|
||||
filename = pjoin(path, 'controllers_%s_%s.pyc'
|
||||
% (controller, function))
|
||||
### end for backward compatibility
|
||||
if not os.path.exists(filename):
|
||||
raise HTTP(404,
|
||||
rewrite.THREAD_LOCAL.routes.error_message % badf,
|
||||
web2py_error=badf)
|
||||
restricted(read_pyc(filename), environment, layer=filename)
|
||||
elif function == '_TEST':
|
||||
# TESTING: adjust the path to include site packages
|
||||
@@ -631,11 +645,15 @@ def run_view_in(environment):
|
||||
context=environment)
|
||||
restricted(ccode, environment, 'file stream')
|
||||
elif os.path.exists(path):
|
||||
x = view.replace('/', '.')
|
||||
files = ['views.%s.pyc' % x]
|
||||
if allow_generic:
|
||||
files.append('views.generic.%s.pyc' % request.extension)
|
||||
# for backward compatibility
|
||||
x = view.replace('/', '_')
|
||||
files = ['views_%s.pyc' % x]
|
||||
files.append('views_%s.pyc' % x)
|
||||
if allow_generic:
|
||||
files.append('views_generic.%s.pyc' % request.extension)
|
||||
# for backward compatibility
|
||||
if request.extension == 'html':
|
||||
files.append('views_%s.pyc' % x[:-5])
|
||||
if allow_generic:
|
||||
|
||||
@@ -37,7 +37,7 @@ class MemcacheClient(object):
|
||||
self.client.delete(key)
|
||||
else:
|
||||
value = f()
|
||||
self.client.set(key, (time.time(), value))
|
||||
self.client.set(key, (time.time(), value), time=time_expire)
|
||||
return value
|
||||
|
||||
def increment(self, key, value=1):
|
||||
|
||||
@@ -6926,7 +6926,7 @@ def sqlhtml_validators(field):
|
||||
elif field_type == 'double' or field_type == 'float':
|
||||
requires.append(validators.IS_FLOAT_IN_RANGE(-1e100, 1e100))
|
||||
elif field_type in ('integer','bigint'):
|
||||
requires.append(validators.IS_INT_IN_RANGE(-1e100, 1e100))
|
||||
requires.append(validators.IS_INT_IN_RANGE(-2**31, 2**31-1))
|
||||
elif field_type.startswith('decimal'):
|
||||
requires.append(validators.IS_DECIMAL_IN_RANGE(-10**10, 10**10))
|
||||
elif field_type == 'date':
|
||||
|
||||
@@ -1917,14 +1917,14 @@ class SQLFORM(FORM):
|
||||
else:
|
||||
fields = []
|
||||
columns = []
|
||||
filter1 = lambda f:isinstance(f,Field)
|
||||
filter2 = lambda f:isinstance(f,Field) and f.readable
|
||||
for table in tables:
|
||||
fields += filter(filter1, table)
|
||||
columns += filter(filter2, table)
|
||||
for k,f in table.iteritems():
|
||||
if not k.startswith('_'):
|
||||
if isinstance(f,Field):
|
||||
fields.append(f) # these are selected
|
||||
if f.readable:
|
||||
columns.append(f) # these are displayed
|
||||
elif isinstance(f,Field.Virtual) and f.readable:
|
||||
if isinstance(f,Field.Virtual) and f.readable:
|
||||
f.tablename = table._tablename
|
||||
columns.append(f)
|
||||
fields.append(f)
|
||||
@@ -2273,7 +2273,9 @@ class SQLFORM(FORM):
|
||||
limitby = None
|
||||
|
||||
try:
|
||||
table_fields = filter(lambda f: f.tablename in tablenames, fields)
|
||||
table_fields = filter(
|
||||
lambda f: (f.tablename in tablenames) and \
|
||||
(not(isinstance(f,Field.Virtual))),fields)
|
||||
if dbset._db._adapter.dbengine=='google:datastore':
|
||||
rows = dbset.select(left=left,orderby=orderby,
|
||||
groupby=groupby,limitby=limitby,
|
||||
@@ -2366,6 +2368,7 @@ class SQLFORM(FORM):
|
||||
continue
|
||||
if field.type == 'blob':
|
||||
continue
|
||||
print row
|
||||
value = row[str(field)]
|
||||
maxlength = maxtextlengths.get(str(field), maxtextlength)
|
||||
if field.represent:
|
||||
|
||||
@@ -22,6 +22,8 @@ from cStringIO import StringIO
|
||||
from gluon.utils import simple_hash, web2py_uuid, DIGEST_ALG_BY_SIZE
|
||||
from gluon.dal import FieldVirtual, FieldMethod
|
||||
|
||||
regex_isint = re.compile('^\-?\d+$')
|
||||
|
||||
JSONErrors = (NameError, TypeError, ValueError, AttributeError,
|
||||
KeyError)
|
||||
try:
|
||||
@@ -692,15 +694,15 @@ class IS_INT_IN_RANGE(Validator):
|
||||
>>> IS_INT_IN_RANGE(1,5)(5)
|
||||
(5, 'enter an integer between 1 and 4')
|
||||
>>> IS_INT_IN_RANGE(1,5)(3.5)
|
||||
(3, 'enter an integer between 1 and 4')
|
||||
(3.5, 'enter an integer between 1 and 4')
|
||||
>>> IS_INT_IN_RANGE(None,5)('4')
|
||||
(4, None)
|
||||
>>> IS_INT_IN_RANGE(None,5)('6')
|
||||
(6, 'enter an integer less than or equal to 4')
|
||||
('6', 'enter an integer less than or equal to 4')
|
||||
>>> IS_INT_IN_RANGE(1,None)('4')
|
||||
(4, None)
|
||||
>>> IS_INT_IN_RANGE(1,None)('0')
|
||||
(0, 'enter an integer greater than or equal to 1')
|
||||
('0', 'enter an integer greater than or equal to 1')
|
||||
>>> IS_INT_IN_RANGE()(6)
|
||||
(6, None)
|
||||
>>> IS_INT_IN_RANGE()('abc')
|
||||
@@ -741,24 +743,13 @@ class IS_INT_IN_RANGE(Validator):
|
||||
% dict(min=self.minimum, max=self.maximum - 1)
|
||||
|
||||
def __call__(self, value):
|
||||
try:
|
||||
fvalue = float(value)
|
||||
value = int(value)
|
||||
if value != fvalue:
|
||||
return (value, self.error_message)
|
||||
if self.minimum is None:
|
||||
if self.maximum is None or value < self.maximum:
|
||||
return (value, None)
|
||||
elif self.maximum is None:
|
||||
if value >= self.minimum:
|
||||
return (value, None)
|
||||
elif self.minimum <= value < self.maximum:
|
||||
return (value, None)
|
||||
except ValueError:
|
||||
pass
|
||||
if value and regex_isint.match(str(value)):
|
||||
v = int(value)
|
||||
if ((self.minimum is None or v >= self.minimum) and
|
||||
(self.maximum is None or v < self.maximum)):
|
||||
return (v, None)
|
||||
return (value, self.error_message)
|
||||
|
||||
|
||||
def str2dec(number):
|
||||
s = str(number)
|
||||
if not '.' in s:
|
||||
@@ -839,17 +830,12 @@ class IS_FLOAT_IN_RANGE(Validator):
|
||||
def __call__(self, value):
|
||||
try:
|
||||
if self.dot == '.':
|
||||
fvalue = float(value)
|
||||
v = float(value)
|
||||
else:
|
||||
fvalue = float(str(value).replace(self.dot, '.'))
|
||||
if self.minimum is None:
|
||||
if self.maximum is None or fvalue <= self.maximum:
|
||||
return (fvalue, None)
|
||||
elif self.maximum is None:
|
||||
if fvalue >= self.minimum:
|
||||
return (fvalue, None)
|
||||
elif self.minimum <= fvalue <= self.maximum:
|
||||
return (fvalue, None)
|
||||
v = float(str(value).replace(self.dot, '.'))
|
||||
if ((self.minimum is None or v >= self.minimum) and
|
||||
(self.maximum is None or v <= self.maximum)):
|
||||
return (v, None)
|
||||
except (ValueError, TypeError):
|
||||
pass
|
||||
return (value, self.error_message)
|
||||
@@ -948,14 +934,9 @@ class IS_DECIMAL_IN_RANGE(Validator):
|
||||
v = value
|
||||
else:
|
||||
v = decimal.Decimal(str(value).replace(self.dot, '.'))
|
||||
if self.minimum is None:
|
||||
if self.maximum is None or v <= self.maximum:
|
||||
return (v, None)
|
||||
elif self.maximum is None:
|
||||
if v >= self.minimum:
|
||||
return (v, None)
|
||||
elif self.minimum <= v <= self.maximum:
|
||||
return (v, None)
|
||||
if ((self.minimum is None or v >= self.minimum) and
|
||||
(self.maximum is None or v <= self.maximum)):
|
||||
return (v, None)
|
||||
except (ValueError, TypeError, decimal.InvalidOperation):
|
||||
pass
|
||||
return (value, self.error_message)
|
||||
|
||||
Reference in New Issue
Block a user