Merge remote-tracking branch 'web2py/master'

This commit is contained in:
Vinyl Darkscratch committed 2016-11-29 13:57:46 -08:00
commit 3d2834c81a
5 files changed
+43 -13

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
language: python language: python
sudo: false sudo: required
cache: pip cache: pip
+2 -2
View File
@@ -352,9 +352,9 @@
'modules': 'modules', 'modules': 'modules',
'Multi User Mode': 'Multi User Mode', 'Multi User Mode': 'Multi User Mode',
'Must include at least %s %s': 'Moet ten minste bevatten %s %s', 'Must include at least %s %s': 'Moet ten minste bevatten %s %s',
'Must include at least %s lower case': 'Moet ten minste bevatten %s lower case', 'Must include at least %s lowercase': 'Moet ten minste bevatten %s kleine letter',
'Must include at least %s of the following : %s': 'Moet ten minste bevatten %s van het volgende : %s', 'Must include at least %s of the following : %s': 'Moet ten minste bevatten %s van het volgende : %s',
'Must include at least %s upper case': 'Moet ten minste bevatten %s upper case', 'Must include at least %s uppercase': 'Moet ten minste bevatten %s hoofdletter',
'new application "%s" created': 'nieuwe applicatie "%s" gemaakt', 'new application "%s" created': 'nieuwe applicatie "%s" gemaakt',
'new application "%s" imported': 'new application "%s" imported', 'new application "%s" imported': 'new application "%s" imported',
'New Application Wizard': 'Nieuwe Applicatie Wizard', 'New Application Wizard': 'Nieuwe Applicatie Wizard',
+3 -1
View File
@@ -962,7 +962,9 @@ def findT(path, language=DEFAULT_LANGUAGE):
+ listdir(vp, '^.+\.html$', 0) + listdir(mop, '^.+\.py$', 0): + listdir(vp, '^.+\.html$', 0) + listdir(mop, '^.+\.py$', 0):
data = to_native(read_locked(filename)) data = to_native(read_locked(filename))
items = regex_translate.findall(data) items = regex_translate.findall(data)
items += ["@markmin\x01%s" %x for x in regex_translate_m.findall(data)] for x in regex_translate_m.findall(data):
if x[0:3] in ["'''", '"""']: items.append("%s@markmin\x01%s" %(x[0:3], x[3:]))
else: items.append("%s@markmin\x01%s" %(x[0], x[1:]))
for item in items: for item in items:
try: try:
message = safe_eval(item) message = safe_eval(item)
+24 -2
View File
@@ -2005,6 +2005,12 @@ class Auth(object):
return self.cas_validate(version=2, proxy=False) return self.cas_validate(version=2, proxy=False)
elif args(1) == self.settings.cas_actions['proxyvalidate']: elif args(1) == self.settings.cas_actions['proxyvalidate']:
return self.cas_validate(version=2, proxy=True) return self.cas_validate(version=2, proxy=True)
elif (args(1) == 'p3'
and args(2) == self.settings.cas_actions['servicevalidate']):
return self.cas_validate(version=3, proxy=False)
elif (args(1) == 'p3'
and args(2) == self.settings.cas_actions['proxyvalidate']):
return self.cas_validate(version=3, proxy=True)
elif args(1) == self.settings.cas_actions['logout']: elif args(1) == self.settings.cas_actions['logout']:
return self.logout(next=request.vars.service or DEFAULT) return self.logout(next=request.vars.service or DEFAULT)
else: else:
@@ -2830,6 +2836,15 @@ class Auth(object):
if success: if success:
if version == 1: if version == 1:
message = 'yes\n%s' % user[userfield] message = 'yes\n%s' % user[userfield]
elif version == 3:
username = user.get('username', user[userfield])
message = build_response(
TAG['cas:authenticationSuccess'](
TAG['cas:user'](username),
TAG['cas:attributes'](
*[TAG['cas:' + field.name](user[field.name])
for field in self.table_user()
if field.readable])))
else: # assume version 2 else: # assume version 2
username = user.get('username', user[userfield]) username = user.get('username', user[userfield])
message = build_response( message = build_response(
@@ -3417,7 +3432,9 @@ class Auth(object):
link = self.url( link = self.url(
self.settings.function, args=('verify_email', key), scheme=True) self.settings.function, args=('verify_email', key), scheme=True)
d = dict(form.vars) d = dict(form.vars)
d.update(dict(key=key, link=link, username=form.vars[username])) d.update(dict(key=key, link=link, username=form.vars[username],
firstname=form.vars['firstname'],
lastname=form.vars['lastname']))
if not (self.settings.mailer and self.settings.mailer.send( if not (self.settings.mailer and self.settings.mailer.send(
to=form.vars.email, to=form.vars.email,
subject=self.messages.verify_email_subject, subject=self.messages.verify_email_subject,
@@ -3670,7 +3687,12 @@ class Auth(object):
key = request.args[-1] key = request.args[-1]
if key: if key:
session._reset_password_key = key session._reset_password_key = key
redirect(self.url(args='confirm_registration')) if next:
redirect_vars = {'_next': next}
else:
redirect_vars = {}
redirect(self.url(args='confirm_registration',
vars=redirect_vars))
else: else:
key = session._reset_password_key key = session._reset_password_key
else: else:
+13 -7
View File
@@ -18,7 +18,7 @@ legacy_db(legacy_db.mytable.id>0).select()
If the script crashes this is might be due to that fact that the data_type_map dictionary below is incomplete. If the script crashes this is might be due to that fact that the data_type_map dictionary below is incomplete.
Please complete it, improve it and continue. Please complete it, improve it and continue.
Created by Falko Krause, minor modifications by Massimo Di Pierro and Ron McOuat Created by Falko Krause, minor modifications by Massimo Di Pierro, Ron McOuat and Marvi Benedet
''' '''
import subprocess import subprocess
import re import re
@@ -52,10 +52,11 @@ data_type_map = dict(
) )
def mysql(database_name, username, password): def mysql(database_name, username, password, host):
p = subprocess.Popen(['mysql', p = subprocess.Popen(['mysql',
'--user=%s' % username, '--user=%s' % username,
'--password=%s' % password, '--password=%s' % password,
'--host=%s' % host,
'--execute=show tables;', '--execute=show tables;',
database_name], database_name],
stdin=subprocess.PIPE, stdin=subprocess.PIPE,
@@ -64,14 +65,15 @@ def mysql(database_name, username, password):
sql_showtables, stderr = p.communicate() sql_showtables, stderr = p.communicate()
tables = [re.sub( tables = [re.sub(
'\|\s+([^\|*])\s+.*', '\1', x) for x in sql_showtables.split()[1:]] '\|\s+([^\|*])\s+.*', '\1', x) for x in sql_showtables.split()[1:]]
connection_string = "legacy_db = DAL('mysql://%s:%s@localhost/%s')" % ( connection_string = "legacy_db = DAL('mysql://%s:%s@%s/%s')" % (
username, password, database_name) username, password, host, database_name)
legacy_db_table_web2py_code = [] legacy_db_table_web2py_code = []
for table_name in tables: for table_name in tables:
#get the sql create statement #get the sql create statement
p = subprocess.Popen(['mysqldump', p = subprocess.Popen(['mysqldump',
'--user=%s' % username, '--user=%s' % username,
'--password=%s' % password, '--password=%s' % password,
'--host=%s' % host,
'--skip-add-drop-table', '--skip-add-drop-table',
'--no-data', database_name, '--no-data', database_name,
table_name], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) table_name], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -106,9 +108,13 @@ def mysql(database_name, username, password):
legacy_db_table_web2py_code) legacy_db_table_web2py_code)
return legacy_db_web2py_code return legacy_db_web2py_code
regex = re.compile('(.*?):(.*?)@(.*)') regex = re.compile('(.*):(.*)@((.*)/)?(.*)')
if len(sys.argv) < 2 or not regex.match(sys.argv[1]): if len(sys.argv) < 2 or not regex.match(sys.argv[1]):
print 'USAGE:\n\n extract_mysql_models.py username:password@data_basename\n\n' print 'USAGE:\n\n extract_mysql_models.py username:password@[host/]data_basename\n\n'
else: else:
m = regex.match(sys.argv[1]) m = regex.match(sys.argv[1])
print mysql(m.group(3), m.group(1), m.group(2)) username = m.group(1)
password = m.group(2)
host = m.group(4) or 'localhost'
db_name = m.group(5)
print mysql(database_name = db_name, username = username, password = password, host = host)