diff --git a/gluon/_compat.py b/gluon/_compat.py index bb85abb5..1641696f 100644 --- a/gluon/_compat.py +++ b/gluon/_compat.py @@ -4,4 +4,3 @@ if PY2: from gluon.contrib import ipaddress else: import ipaddress - diff --git a/gluon/compileapp.py b/gluon/compileapp.py index 87f2f6fa..14bc56f8 100644 --- a/gluon/compileapp.py +++ b/gluon/compileapp.py @@ -727,7 +727,7 @@ def run_view_in(environment): context=environment) # Compile template ccode = compile2(scode, filename) - layer = filename + layer = filename restricted(ccode, environment, layer=layer, scode=scode) # parse_template saves everything in response body return environment['response'].body.getvalue() diff --git a/gluon/dal.py b/gluon/dal.py index 471ed657..f8c2a764 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -99,7 +99,7 @@ def _default_validators(db, field): requires._and = validators.IS_NOT_IN_DB(db, field) if not field.notnull: requires = validators.IS_EMPTY_OR(requires) - return requires + return requires # does not get here for reference and list:reference if isinstance(requires, list): if field.unique: diff --git a/gluon/globals.py b/gluon/globals.py index 75a61236..0b8f203a 100644 --- a/gluon/globals.py +++ b/gluon/globals.py @@ -1078,7 +1078,7 @@ class Session(Storage): if self._same_site is None: # Using SameSite Lax Mode is the default # You actually have to call session.samesite(False) if you really - # dont want the extra protection provided by the SameSite header + # dont want the extra protection provided by the SameSite header self._same_site = 'Lax' if self._same_site: if 'samesite' not in Cookie.Morsel._reserved: diff --git a/gluon/packages/dal b/gluon/packages/dal index 5bacaf78..3c7a004c 160000 --- a/gluon/packages/dal +++ b/gluon/packages/dal @@ -1 +1 @@ -Subproject commit 5bacaf785ad14e4bfee86c1db3c7349537d5f2ea +Subproject commit 3c7a004cf0ec0de2f0b4c6e7a34ff859dbfcac6d diff --git a/gluon/scheduler.py b/gluon/scheduler.py index fa7cdc0a..da6cc7db 100644 --- a/gluon/scheduler.py +++ b/gluon/scheduler.py @@ -1367,7 +1367,7 @@ class Scheduler(MetaScheduler): ws = wkgroups.get(gname) if ws: if task.broadcast: - for worker in ws['workers']: + for worker in ws['workers']: new_task = db.scheduler_task.insert( application_name = task.application_name, task_name = task.task_name, @@ -1389,7 +1389,7 @@ class Scheduler(MetaScheduler): db(st.id == task.id).update(times_run=task.times_run+1, next_run_time=next_run_time, last_run_time=now) - db.commit() + db.commit() else: counter = 0 myw = 0 diff --git a/gluon/shell.py b/gluon/shell.py index c49e2cb4..bde0ea51 100644 --- a/gluon/shell.py +++ b/gluon/shell.py @@ -211,7 +211,7 @@ def run( - a/c : exec the controller c into the application environment """ - (a, c, f, args, vars) = parse_path_info(appname, av=True) + (a, c, f, args, vars) = parse_path_info(appname, av=True) errmsg = 'invalid application name: %s' % appname if not a: die(errmsg) diff --git a/gluon/sqlhtml.py b/gluon/sqlhtml.py index 57ce3764..dea739f6 100644 --- a/gluon/sqlhtml.py +++ b/gluon/sqlhtml.py @@ -3435,7 +3435,7 @@ class SQLTABLE(TABLE): else: columns = list(sqlrows.colnames) field_types = (Field, Field.Virtual, Field.Method) - + header_func = { 'fieldname:capitalize': lambda f: f.name.replace('_', ' ').title(), 'labels': lambda f: f.label diff --git a/gluon/template.py b/gluon/template.py index ccb6ab71..e19a8eac 100644 --- a/gluon/template.py +++ b/gluon/template.py @@ -43,7 +43,7 @@ DEFAULT_DELIMITERS = ('{{', '}}') def file_reader(filename, mode='rb'): - try: + try: with open(filename, mode) as fp: body = fp.read() return body @@ -287,7 +287,7 @@ class TemplateParser(object): # Raw text to start parsing. self.text = text # use the default reader - self.reader = reader or file_reader + self.reader = reader or file_reader # Writer to use (refer to the default for an example). # This will end up as # "%s(%s, escape=False)" % (self.writer, value) @@ -948,12 +948,12 @@ def render(content=None, content = '(no template found)' # Execute the template. - code = str(TemplateParser(text=content, - context=context, - path=path, - lexers=lexers, - delimiters=delimiters, - writer=writer, + code = str(TemplateParser(text=content, + context=context, + path=path, + lexers=lexers, + delimiters=delimiters, + writer=writer, reader=reader)) try: @@ -990,7 +990,7 @@ class template(object): body = self.reader(filename) return render( content=body, - path=self.path, + path=self.path, lexers=self.lexers, delimiters=self.delimiters, context=context, @@ -998,4 +998,3 @@ class template(object): else: return context return wrapper - diff --git a/gluon/tests/__init__.py b/gluon/tests/__init__.py index 83379804..2fd999ed 100644 --- a/gluon/tests/__init__.py +++ b/gluon/tests/__init__.py @@ -1,4 +1,3 @@ - from .test_http import * from .test_contenttype import * from .test_fileutils import * diff --git a/gluon/tests/test_appadmin.py b/gluon/tests/test_appadmin.py index 6cd0c017..c84732cd 100644 --- a/gluon/tests/test_appadmin.py +++ b/gluon/tests/test_appadmin.py @@ -196,4 +196,3 @@ class TestAppAdmin(unittest.TestCase): data['id'] = '1' request._vars = data self.assertRaises(HTTP, self.run_function) - diff --git a/gluon/tests/test_cache.py b/gluon/tests/test_cache.py index 4fcda0fb..b02bdaee 100644 --- a/gluon/tests/test_cache.py +++ b/gluon/tests/test_cache.py @@ -142,4 +142,3 @@ class TestCache(unittest.TestCase): self.assertEqual(a.as_csv(), h.as_csv()) db.t_a.drop() db.close() - diff --git a/gluon/tests/test_cron.py b/gluon/tests/test_cron.py index 47a30af7..eac3158b 100644 --- a/gluon/tests/test_cron.py +++ b/gluon/tests/test_cron.py @@ -16,9 +16,7 @@ class TestCron(unittest.TestCase): self.assertEqual(t.acquire(), None) self.assertTrue(t.release()) return - + def test_crondance(self): - #TODO update crondance to return something + #TODO update crondance to return something crondance(os.getcwd()) - - diff --git a/gluon/tests/test_fileutils.py b/gluon/tests/test_fileutils.py index a4a25ee0..64a96e76 100644 --- a/gluon/tests/test_fileutils.py +++ b/gluon/tests/test_fileutils.py @@ -23,6 +23,6 @@ class TestFileUtils(unittest.TestCase): # Semantic Beta 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))) - + def test_fix_newlines(self): fix_newlines(os.path.dirname(os.path.abspath(__file__))) diff --git a/gluon/tests/test_globals.py b/gluon/tests/test_globals.py index 3809a236..944dde96 100644 --- a/gluon/tests/test_globals.py +++ b/gluon/tests/test_globals.py @@ -259,4 +259,3 @@ class testResponse(unittest.TestCase): response.meta['meta_dict'] = {'tag_name':'tag_value'} response.include_meta() self.assertEqual(response.body.getvalue(), '\n\n') - diff --git a/gluon/tests/test_html.py b/gluon/tests/test_html.py index b2940698..7dfc8993 100644 --- a/gluon/tests/test_html.py +++ b/gluon/tests/test_html.py @@ -348,7 +348,7 @@ class TestBareHelpers(unittest.TestCase): <> //-->''') self.assertEqual(SCRIPT().xml(), b'') - self.assertEqual(SCRIPT(';').xml() + DIV().xml(), + self.assertEqual(SCRIPT(';').xml() + DIV().xml(), b'
') def test_STYLE(self): diff --git a/gluon/tests/test_languages.py b/gluon/tests/test_languages.py index cfa07cb8..e34fad9a 100644 --- a/gluon/tests/test_languages.py +++ b/gluon/tests/test_languages.py @@ -95,7 +95,7 @@ class TestTranslations(unittest.TestCase): 'Hello World') self.assertEqual(str(T.M('**Hello World**')), 'Hello World') - # sub_tuple testing + # sub_tuple testing self.assertEqual(str(T('%s %%{shop}', 1)), '1 shop') self.assertEqual(str(T('%s %%{shop}', 2)), @@ -192,7 +192,7 @@ class TestTranslations(unittest.TestCase): '2') self.assertEqual(str(T('%i%%{?st?[0]}', 0)), '0') - # sub_dict testing + # sub_dict testing self.assertEqual(str(T('%(key)s %%{is(key)}', dict(key=1))), '1 is') self.assertEqual(str(T('%(key)i %%{is(key)}', dict(key=2))), diff --git a/gluon/tests/test_recfile.py b/gluon/tests/test_recfile.py index 03e36382..ae05216f 100644 --- a/gluon/tests/test_recfile.py +++ b/gluon/tests/test_recfile.py @@ -71,4 +71,3 @@ class TestRecfile(unittest.TestCase): self.assertFalse(recfile.exists(filename)) self.assertRaises(IOError, recfile.remove, filename) self.assertRaises(IOError, recfile.open, filename, "r") - diff --git a/gluon/tests/test_rocket.py b/gluon/tests/test_rocket.py index a394e895..5519e96d 100644 --- a/gluon/tests/test_rocket.py +++ b/gluon/tests/test_rocket.py @@ -1,3 +1,3 @@ -# TODO : I think we should continue to use pathoc (http://pathod.net/docs/pathoc) for tests but integrate the call in +# TODO : I think we should continue to use pathoc (http://pathod.net/docs/pathoc) for tests but integrate the call in # gluon/tests so they run automatically. No need to make our own tests. # ref: https://groups.google.com/d/msg/web2py-developers/Cjye8_hXZk8/AXbftS3sCgAJ diff --git a/gluon/tests/test_router.py b/gluon/tests/test_router.py index 625673ad..d767602b 100644 --- a/gluon/tests/test_router.py +++ b/gluon/tests/test_router.py @@ -1555,4 +1555,3 @@ class TestRouter(unittest.TestCase): load(rdict=router_collide) self.assertEqual(filter_url('http://welcome.com/welcome/admin/index', domain='welcome', out=True), "/welcome/admin") - diff --git a/gluon/tests/test_sqlhtml.py b/gluon/tests/test_sqlhtml.py index 52a69530..e5cc4e09 100644 --- a/gluon/tests/test_sqlhtml.py +++ b/gluon/tests/test_sqlhtml.py @@ -277,7 +277,7 @@ class TestSQLFORM(unittest.TestCase): self.db.commit() - + def test_SQLFORM(self): form = SQLFORM(self.db.auth_user) self.assertEqual(form.xml()[:5], b'