Merge github.com:web2py/web2py
This commit is contained in:
@@ -95,8 +95,9 @@ class SessionSetDb(SessionSet):
|
||||
"""Return list of SessionDb instances for existing sessions."""
|
||||
sessions = []
|
||||
table = current.response.session_db_table
|
||||
for row in table._db(table.id > 0).select():
|
||||
sessions.append(SessionDb(row))
|
||||
if table:
|
||||
for row in table._db(table.id > 0).select():
|
||||
sessions.append(SessionDb(row))
|
||||
return sessions
|
||||
|
||||
|
||||
|
||||
+39
-32
@@ -7,14 +7,10 @@ import sys
|
||||
import shutil
|
||||
import os
|
||||
|
||||
from gluon.languages import findT, utf8_repr
|
||||
from gluon.languages import findT
|
||||
|
||||
sys.path.insert(0, '.')
|
||||
|
||||
file = sys.argv[1]
|
||||
apps = sys.argv[2:]
|
||||
|
||||
|
||||
def sync_language(d, data):
|
||||
''' this function makes sure a translated string will be prefered over an untranslated
|
||||
string when syncing languages between apps. when both are translated, it prefers the
|
||||
@@ -37,35 +33,46 @@ def sync_language(d, data):
|
||||
|
||||
return d
|
||||
|
||||
d = {}
|
||||
for app in apps:
|
||||
path = 'applications/%s/' % app
|
||||
findT(path, file)
|
||||
langfile = open(os.path.join(path, 'languages', '%s.py' % file))
|
||||
def sync_main(file, apps):
|
||||
d = {}
|
||||
for app in apps:
|
||||
path = 'applications/%s/' % app
|
||||
findT(path, file)
|
||||
langfile = open(os.path.join(path, 'languages', '%s.py' % file))
|
||||
try:
|
||||
data = eval(langfile.read())
|
||||
finally:
|
||||
langfile.close()
|
||||
|
||||
d = sync_language(d, data)
|
||||
|
||||
|
||||
path = 'applications/%s/' % apps[-1]
|
||||
file1 = os.path.join(path, 'languages', '%s.py' % file)
|
||||
|
||||
f = open(file1, 'w')
|
||||
try:
|
||||
data = eval(langfile.read())
|
||||
f.write('# coding: utf8\n')
|
||||
f.write('{\n')
|
||||
keys = d.keys()
|
||||
keys.sort()
|
||||
for key in keys:
|
||||
f.write("'''%s''':'''%s''',\n" % (key.replace("'", "\\'"), str(d[key].replace("'", "\\'"))))
|
||||
f.write('}\n')
|
||||
finally:
|
||||
langfile.close()
|
||||
f.close()
|
||||
|
||||
oapps = reversed(apps[:-1])
|
||||
for app in oapps:
|
||||
path2 = 'applications/%s/' % app
|
||||
file2 = os.path.join(path2, 'languages', '%s.py' % file)
|
||||
if file1 != file2:
|
||||
shutil.copyfile(file1, file2)
|
||||
|
||||
d = sync_language(d, data)
|
||||
if __name__ == "__main__":
|
||||
|
||||
path = 'applications/%s/' % apps[-1]
|
||||
file1 = os.path.join(path, 'languages', '%s.py' % file)
|
||||
file = sys.argv[1]
|
||||
apps = sys.argv[2:]
|
||||
|
||||
f = open(file1, 'w')
|
||||
try:
|
||||
f.write('# coding: utf8\n')
|
||||
f.write('{\n')
|
||||
keys = d.keys()
|
||||
keys.sort()
|
||||
for key in keys:
|
||||
f.write('%s:%s,\n' % (utf8_repr(key), utf8_repr(str(d[key]))))
|
||||
f.write('}\n')
|
||||
finally:
|
||||
f.close()
|
||||
|
||||
oapps = reversed(apps[:-1])
|
||||
for app in oapps:
|
||||
path2 = 'applications/%s/' % app
|
||||
file2 = os.path.join(path2, 'languages', '%s.py' % file)
|
||||
shutil.copyfile(file1, file2)
|
||||
sync_main(file, apps)
|
||||
|
||||
Reference in New Issue
Block a user