Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a013e3edc | ||
|
|
fb4c114d85 | ||
|
|
b47e1334d5 | ||
|
|
ce0b255747 | ||
|
|
05d2ced779 | ||
|
|
d144ff7d65 | ||
|
|
780510dc32 | ||
|
|
7a5f611e76 | ||
|
|
b7b8a009f2 | ||
|
|
113df51ef9 | ||
|
|
b3a7c20f3f | ||
|
|
2fc4115718 |
@@ -32,7 +32,7 @@ update:
|
|||||||
echo "remember that pymysql was tweaked"
|
echo "remember that pymysql was tweaked"
|
||||||
src:
|
src:
|
||||||
### Use semantic versioning
|
### Use semantic versioning
|
||||||
echo 'Version 2.15.1-stable+timestamp.'`date +%Y.%m.%d.%H.%M.%S` > VERSION
|
echo 'Version 2.15.2-stable+timestamp.'`date +%Y.%m.%d.%H.%M.%S` > VERSION
|
||||||
### rm -f all junk files
|
### rm -f all junk files
|
||||||
make clean
|
make clean
|
||||||
### clean up baisc apps
|
### clean up baisc apps
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
Version 2.15.1-stable+timestamp.2017.07.10.16.17.24
|
Version 2.15.2-stable+timestamp.2017.07.19.01.21.31
|
||||||
|
|||||||
+1
-1
@@ -115,7 +115,7 @@ class AuthAPI(object):
|
|||||||
if auth.last_visit and auth.last_visit + delta > now:
|
if auth.last_visit and auth.last_visit + delta > now:
|
||||||
self.user = auth.user
|
self.user = auth.user
|
||||||
# this is a trick to speed up sessions to avoid many writes
|
# this is a trick to speed up sessions to avoid many writes
|
||||||
if (now - auth.last_visit).seconds > (auth.expiration / 10):
|
if (now - auth.last_visit).seconds > (auth.expiration // 10):
|
||||||
auth.last_visit = now
|
auth.last_visit = now
|
||||||
else:
|
else:
|
||||||
self.user = None
|
self.user = None
|
||||||
|
|||||||
@@ -7,15 +7,13 @@ db = get_db()
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
from gluon import *
|
from gluon import *
|
||||||
from pydal.adapters import ADAPTERS, PostgreSQLAdapter
|
from pydal.adapters import adapters, PostgrePsyco
|
||||||
from pydal.helpers.classes import UseDatabaseStoredFile
|
from pydal.helpers.classes import DatabaseStoredFile
|
||||||
|
|
||||||
class HerokuPostgresAdapter(UseDatabaseStoredFile,PostgreSQLAdapter):
|
@adapters.register_for('postgres')
|
||||||
drivers = ('psycopg2',)
|
class HerokuPostgresAdapter(DatabaseStoredFile, PostgrePsyco):
|
||||||
uploads_in_blob = True
|
uploads_in_blob = True
|
||||||
|
|
||||||
ADAPTERS['postgres'] = HerokuPostgresAdapter
|
|
||||||
|
|
||||||
def get_db(name = None, pool_size=10):
|
def get_db(name = None, pool_size=10):
|
||||||
if not name:
|
if not name:
|
||||||
names = [n for n in os.environ.keys()
|
names = [n for n in os.environ.keys()
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class RESIZE(object):
|
|||||||
background = Image.new('RGBA', (self.nx, self.ny), (255, 255, 255, 0))
|
background = Image.new('RGBA', (self.nx, self.ny), (255, 255, 255, 0))
|
||||||
background.paste(
|
background.paste(
|
||||||
img,
|
img,
|
||||||
((self.nx - img.size[0]) / 2, (self.ny - img.size[1]) / 2))
|
((self.nx - img.size[0]) // 2, (self.ny - img.size[1]) // 2))
|
||||||
background.save(s, 'JPEG', quality=self.quality)
|
background.save(s, 'JPEG', quality=self.quality)
|
||||||
else:
|
else:
|
||||||
img.save(s, 'JPEG', quality=self.quality)
|
img.save(s, 'JPEG', quality=self.quality)
|
||||||
|
|||||||
+2
-2
@@ -415,10 +415,10 @@ def fix_newlines(path):
|
|||||||
|\r|
|
|\r|
|
||||||
)''')
|
)''')
|
||||||
for filename in listdir(path, '.*\.(py|html)$', drop=False):
|
for filename in listdir(path, '.*\.(py|html)$', drop=False):
|
||||||
rdata = read_file(filename, 'rb')
|
rdata = read_file(filename, 'r')
|
||||||
wdata = regex.sub('\n', rdata)
|
wdata = regex.sub('\n', rdata)
|
||||||
if wdata != rdata:
|
if wdata != rdata:
|
||||||
write_file(filename, wdata, 'wb')
|
write_file(filename, wdata, 'w')
|
||||||
|
|
||||||
|
|
||||||
def copystream(
|
def copystream(
|
||||||
|
|||||||
+3
-1
@@ -11,7 +11,7 @@ HTTP statuses helpers
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from gluon._compat import iteritems
|
from gluon._compat import iteritems, unicodeT
|
||||||
|
|
||||||
__all__ = ['HTTP', 'redirect']
|
__all__ = ['HTTP', 'redirect']
|
||||||
|
|
||||||
@@ -122,6 +122,8 @@ class HTTP(Exception):
|
|||||||
if env.get('request_method', '') == 'HEAD':
|
if env.get('request_method', '') == 'HEAD':
|
||||||
return ['']
|
return ['']
|
||||||
elif isinstance(body, (str, bytes, bytearray)):
|
elif isinstance(body, (str, bytes, bytearray)):
|
||||||
|
if isinstance(body, unicodeT):
|
||||||
|
body = body.encode('utf-8')
|
||||||
return [body]
|
return [body]
|
||||||
elif hasattr(body, '__iter__'):
|
elif hasattr(body, '__iter__'):
|
||||||
return body
|
return body
|
||||||
|
|||||||
+1
-1
Submodule gluon/packages/dal updated: d75d5cf5f3...3e0fd7c01c
+7
-4
@@ -405,7 +405,7 @@ class RadioWidget(OptionsWidget):
|
|||||||
cols = attributes.get('cols', 1)
|
cols = attributes.get('cols', 1)
|
||||||
totals = len(options)
|
totals = len(options)
|
||||||
mods = totals % cols
|
mods = totals % cols
|
||||||
rows = totals / cols
|
rows = totals // cols
|
||||||
if mods:
|
if mods:
|
||||||
rows += 1
|
rows += 1
|
||||||
|
|
||||||
@@ -471,7 +471,7 @@ class CheckboxesWidget(OptionsWidget):
|
|||||||
cols = attributes.get('cols', 1)
|
cols = attributes.get('cols', 1)
|
||||||
totals = len(options)
|
totals = len(options)
|
||||||
mods = totals % cols
|
mods = totals % cols
|
||||||
rows = totals / cols
|
rows = totals // cols
|
||||||
if mods:
|
if mods:
|
||||||
rows += 1
|
rows += 1
|
||||||
|
|
||||||
@@ -684,9 +684,10 @@ class AutocompleteWidget(object):
|
|||||||
urlvars = request.vars
|
urlvars = request.vars
|
||||||
urlvars[default_var] = 1
|
urlvars[default_var] = 1
|
||||||
self.url = URL(args=request.args, vars=urlvars)
|
self.url = URL(args=request.args, vars=urlvars)
|
||||||
self.callback()
|
self.run_callback = True
|
||||||
else:
|
else:
|
||||||
self.url = request
|
self.url = request
|
||||||
|
self.run_callback = False
|
||||||
|
|
||||||
def callback(self):
|
def callback(self):
|
||||||
if self.keyword in self.request.vars:
|
if self.keyword in self.request.vars:
|
||||||
@@ -759,6 +760,8 @@ class AutocompleteWidget(object):
|
|||||||
raise HTTP(200, '')
|
raise HTTP(200, '')
|
||||||
|
|
||||||
def __call__(self, field, value, **attributes):
|
def __call__(self, field, value, **attributes):
|
||||||
|
if self.run_callback:
|
||||||
|
self.callback()
|
||||||
default = dict(
|
default = dict(
|
||||||
_type='text',
|
_type='text',
|
||||||
value=(value is not None and str(value)) or '',
|
value=(value is not None and str(value)) or '',
|
||||||
@@ -1916,7 +1919,7 @@ class SQLFORM(FORM):
|
|||||||
if 'table_name' in attributes:
|
if 'table_name' in attributes:
|
||||||
del attributes['table_name']
|
del attributes['table_name']
|
||||||
|
|
||||||
return SQLFORM(DAL(None).define_table(table_name, *fields),
|
return SQLFORM(DAL(None).define_table(table_name, *[field.clone() for field in fields]),
|
||||||
**attributes)
|
**attributes)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from gluon.fileutils import parse_version
|
from gluon.fileutils import parse_version, fix_newlines
|
||||||
|
|
||||||
|
|
||||||
class TestFileUtils(unittest.TestCase):
|
class TestFileUtils(unittest.TestCase):
|
||||||
@@ -22,3 +23,6 @@ class TestFileUtils(unittest.TestCase):
|
|||||||
# Semantic Beta
|
# Semantic Beta
|
||||||
rtn = parse_version('Version 2.14.1-beta+timestamp.2016.03.21.22.35.26')
|
rtn = parse_version('Version 2.14.1-beta+timestamp.2016.03.21.22.35.26')
|
||||||
self.assertEqual(rtn, (2, 14, 1, 'beta', datetime.datetime(2016, 3, 21, 22, 35, 26)))
|
self.assertEqual(rtn, (2, 14, 1, 'beta', datetime.datetime(2016, 3, 21, 22, 35, 26)))
|
||||||
|
|
||||||
|
def test_fix_newlines(self):
|
||||||
|
fix_newlines(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|||||||
+6
-6
@@ -1762,7 +1762,7 @@ class Auth(AuthAPI):
|
|||||||
if auth.last_visit and auth.last_visit + delta > now:
|
if auth.last_visit and auth.last_visit + delta > now:
|
||||||
self.user = auth.user
|
self.user = auth.user
|
||||||
# this is a trick to speed up sessions to avoid many writes
|
# this is a trick to speed up sessions to avoid many writes
|
||||||
if (now - auth.last_visit).seconds > (auth.expiration / 10):
|
if (now - auth.last_visit).seconds > (auth.expiration // 10):
|
||||||
auth.last_visit = now
|
auth.last_visit = now
|
||||||
else:
|
else:
|
||||||
self.user = None
|
self.user = None
|
||||||
@@ -5531,15 +5531,15 @@ def prettydate(d, T=lambda x: x, utc=False):
|
|||||||
else:
|
else:
|
||||||
suffix = ' ago'
|
suffix = ' ago'
|
||||||
if dt.days >= 2 * 365:
|
if dt.days >= 2 * 365:
|
||||||
return T('%d years' + suffix) % int(dt.days / 365)
|
return T('%d years' + suffix) % int(dt.days // 365)
|
||||||
elif dt.days >= 365:
|
elif dt.days >= 365:
|
||||||
return T('1 year' + suffix)
|
return T('1 year' + suffix)
|
||||||
elif dt.days >= 60:
|
elif dt.days >= 60:
|
||||||
return T('%d months' + suffix) % int(dt.days / 30)
|
return T('%d months' + suffix) % int(dt.days // 30)
|
||||||
elif dt.days >= 27: # 4 weeks ugly
|
elif dt.days >= 27: # 4 weeks ugly
|
||||||
return T('1 month' + suffix)
|
return T('1 month' + suffix)
|
||||||
elif dt.days >= 14:
|
elif dt.days >= 14:
|
||||||
return T('%d weeks' + suffix) % int(dt.days / 7)
|
return T('%d weeks' + suffix) % int(dt.days // 7)
|
||||||
elif dt.days >= 7:
|
elif dt.days >= 7:
|
||||||
return T('1 week' + suffix)
|
return T('1 week' + suffix)
|
||||||
elif dt.days > 1:
|
elif dt.days > 1:
|
||||||
@@ -5547,11 +5547,11 @@ def prettydate(d, T=lambda x: x, utc=False):
|
|||||||
elif dt.days == 1:
|
elif dt.days == 1:
|
||||||
return T('1 day' + suffix)
|
return T('1 day' + suffix)
|
||||||
elif dt.seconds >= 2 * 60 * 60:
|
elif dt.seconds >= 2 * 60 * 60:
|
||||||
return T('%d hours' + suffix) % int(dt.seconds / 3600)
|
return T('%d hours' + suffix) % int(dt.seconds // 3600)
|
||||||
elif dt.seconds >= 60 * 60:
|
elif dt.seconds >= 60 * 60:
|
||||||
return T('1 hour' + suffix)
|
return T('1 hour' + suffix)
|
||||||
elif dt.seconds >= 2 * 60:
|
elif dt.seconds >= 2 * 60:
|
||||||
return T('%d minutes' + suffix) % int(dt.seconds / 60)
|
return T('%d minutes' + suffix) % int(dt.seconds // 60)
|
||||||
elif dt.seconds >= 60:
|
elif dt.seconds >= 60:
|
||||||
return T('1 minute' + suffix)
|
return T('1 minute' + suffix)
|
||||||
elif dt.seconds > 1:
|
elif dt.seconds > 1:
|
||||||
|
|||||||
+6
-6
@@ -156,12 +156,12 @@ def get_digest(value):
|
|||||||
raise ValueError("Invalid digest algorithm: %s" % value)
|
raise ValueError("Invalid digest algorithm: %s" % value)
|
||||||
|
|
||||||
DIGEST_ALG_BY_SIZE = {
|
DIGEST_ALG_BY_SIZE = {
|
||||||
128 / 4: 'md5',
|
128 // 4: 'md5',
|
||||||
160 / 4: 'sha1',
|
160 // 4: 'sha1',
|
||||||
224 / 4: 'sha224',
|
224 // 4: 'sha224',
|
||||||
256 / 4: 'sha256',
|
256 // 4: 'sha256',
|
||||||
384 / 4: 'sha384',
|
384 // 4: 'sha384',
|
||||||
512 / 4: 'sha512',
|
512 // 4: 'sha512',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2767,7 +2767,7 @@ class LazyCrypt(object):
|
|||||||
else:
|
else:
|
||||||
digest_alg, key = self.crypt.digest_alg, ''
|
digest_alg, key = self.crypt.digest_alg, ''
|
||||||
if self.crypt.salt:
|
if self.crypt.salt:
|
||||||
if self.crypt.salt:
|
if self.crypt.salt is True:
|
||||||
salt = str(web2py_uuid()).replace('-', '')[-16:]
|
salt = str(web2py_uuid()).replace('-', '')[-16:]
|
||||||
else:
|
else:
|
||||||
salt = self.crypt.salt
|
salt = self.crypt.salt
|
||||||
|
|||||||
Reference in New Issue
Block a user