Merge branch 'master' of github.com:web2py/web2py
This commit is contained in:
@@ -317,6 +317,7 @@
|
||||
'beforeSend': function (xhr, settings) {
|
||||
xhr.setRequestHeader('web2py-component-location', document.location);
|
||||
xhr.setRequestHeader('web2py-component-element', target);
|
||||
web2py.fire(element, 'w2p:componentBegin', [xhr, settings], target);
|
||||
return web2py.fire(element, 'ajax:beforeSend', [xhr, settings], target); //test a usecase, should stop here if returns false
|
||||
},
|
||||
'success': function (data, status, xhr) {
|
||||
|
||||
@@ -317,6 +317,7 @@
|
||||
'beforeSend': function (xhr, settings) {
|
||||
xhr.setRequestHeader('web2py-component-location', document.location);
|
||||
xhr.setRequestHeader('web2py-component-element', target);
|
||||
web2py.fire(element, 'w2p:componentBegin', [xhr, settings], target);
|
||||
return web2py.fire(element, 'ajax:beforeSend', [xhr, settings], target); //test a usecase, should stop here if returns false
|
||||
},
|
||||
'success': function (data, status, xhr) {
|
||||
|
||||
@@ -317,6 +317,7 @@
|
||||
'beforeSend': function (xhr, settings) {
|
||||
xhr.setRequestHeader('web2py-component-location', document.location);
|
||||
xhr.setRequestHeader('web2py-component-element', target);
|
||||
web2py.fire(element, 'w2p:componentBegin', [xhr, settings], target);
|
||||
return web2py.fire(element, 'ajax:beforeSend', [xhr, settings], target); //test a usecase, should stop here if returns false
|
||||
},
|
||||
'success': function (data, status, xhr) {
|
||||
|
||||
+5
-1
@@ -438,7 +438,11 @@ def add_path_first(path):
|
||||
def try_mkdir(path):
|
||||
if not os.path.exists(path):
|
||||
try:
|
||||
os.mkdir(path)
|
||||
if os.path.islink(path):
|
||||
# path is a broken link, try to mkdir the target of the link instead of the link itself.
|
||||
os.mkdir(os.path.realpath(path))
|
||||
else:
|
||||
os.mkdir(path)
|
||||
except OSError as e:
|
||||
if e.strerror == 'File exists': # In case of race condition.
|
||||
pass
|
||||
|
||||
+15
-9
@@ -951,12 +951,23 @@ def findT(path, language=DEFAULT_LANGUAGE):
|
||||
Note:
|
||||
Must be run by the admin app
|
||||
"""
|
||||
from gluon.tools import Auth, Crud
|
||||
lang_file = pjoin(path, 'languages', language + '.py')
|
||||
sentences = read_dict(lang_file)
|
||||
mp = pjoin(path, 'models')
|
||||
cp = pjoin(path, 'controllers')
|
||||
vp = pjoin(path, 'views')
|
||||
mop = pjoin(path, 'modules')
|
||||
def add_message(message):
|
||||
if not message.startswith('#') and not '\n' in message:
|
||||
tokens = message.rsplit('##', 1)
|
||||
else:
|
||||
# this allows markmin syntax in translations
|
||||
tokens = [message]
|
||||
if len(tokens) == 2:
|
||||
message = tokens[0].strip() + '##' + tokens[1].strip()
|
||||
if message and not message in sentences:
|
||||
sentences[message] = message.replace("@markmin\x01", "")
|
||||
for filename in \
|
||||
listdir(mp, '^.+\.py$', 0) + listdir(cp, '^.+\.py$', 0)\
|
||||
+ listdir(vp, '^.+\.html$', 0) + listdir(mop, '^.+\.py$', 0):
|
||||
@@ -970,15 +981,10 @@ def findT(path, language=DEFAULT_LANGUAGE):
|
||||
message = safe_eval(item)
|
||||
except:
|
||||
continue # silently ignore inproperly formatted strings
|
||||
if not message.startswith('#') and not '\n' in message:
|
||||
tokens = message.rsplit('##', 1)
|
||||
else:
|
||||
# this allows markmin syntax in translations
|
||||
tokens = [message]
|
||||
if len(tokens) == 2:
|
||||
message = tokens[0].strip() + '##' + tokens[1].strip()
|
||||
if message and not message in sentences:
|
||||
sentences[message] = message.replace("@markmin\x01", "")
|
||||
add_message(message)
|
||||
gluon_msg = [Auth.default_messages, Crud.default_messages]
|
||||
for item in [x for m in gluon_msg for x in m.values() if x is not None]:
|
||||
add_message(item)
|
||||
if not '!langcode!' in sentences:
|
||||
sentences['!langcode!'] = (
|
||||
DEFAULT_LANGUAGE if language in ('default', DEFAULT_LANGUAGE) else language)
|
||||
|
||||
+13
-11
@@ -4798,6 +4798,18 @@ class Auth(object):
|
||||
|
||||
class Crud(object): # pragma: no cover
|
||||
|
||||
default_messages = dict(
|
||||
submit_button = 'Submit',
|
||||
delete_label = 'Check to delete',
|
||||
record_created = 'Record Created',
|
||||
record_updated = 'Record Updated',
|
||||
record_deleted = 'Record Deleted',
|
||||
update_log = 'Record %(id)s updated',
|
||||
create_log = 'Record %(id)s created',
|
||||
read_log = 'Record %(id)s read',
|
||||
delete_log = 'Record %(id)s deleted',
|
||||
)
|
||||
|
||||
def url(self, f=None, args=None, vars=None):
|
||||
"""
|
||||
This should point to the controller that exposes
|
||||
@@ -4846,17 +4858,7 @@ class Crud(object): # pragma: no cover
|
||||
settings.lock_keys = True
|
||||
|
||||
messages = self.messages = Messages(current.T)
|
||||
messages.submit_button = 'Submit'
|
||||
messages.delete_label = 'Check to delete'
|
||||
messages.record_created = 'Record Created'
|
||||
messages.record_updated = 'Record Updated'
|
||||
messages.record_deleted = 'Record Deleted'
|
||||
|
||||
messages.update_log = 'Record %(id)s updated'
|
||||
messages.create_log = 'Record %(id)s created'
|
||||
messages.read_log = 'Record %(id)s read'
|
||||
messages.delete_log = 'Record %(id)s deleted'
|
||||
|
||||
messages.update(Crud.default_messages)
|
||||
messages.lock_keys = True
|
||||
|
||||
def __call__(self):
|
||||
|
||||
@@ -216,6 +216,7 @@ fi
|
||||
|
||||
/etc/init.d/nginx start
|
||||
systemctl start emperor.uwsgi.service
|
||||
systemctl enable emperor.uwsgi.service
|
||||
|
||||
echo <<EOF
|
||||
you can stop uwsgi and nginx with
|
||||
|
||||
Reference in New Issue
Block a user