space cleanup

This commit is contained in:
mdipierro
2019-02-17 17:20:38 -08:00
parent bf23e7bb0e
commit f06c60b963
23 changed files with 27 additions and 38 deletions
-1
View File
@@ -4,4 +4,3 @@ if PY2:
from gluon.contrib import ipaddress
else:
import ipaddress
+1 -1
View File
@@ -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()
+1 -1
View File
@@ -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:
+1 -1
View File
@@ -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:
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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
+9 -10
View File
@@ -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
-1
View File
@@ -1,4 +1,3 @@
from .test_http import *
from .test_contenttype import *
from .test_fileutils import *
-1
View File
@@ -196,4 +196,3 @@ class TestAppAdmin(unittest.TestCase):
data['id'] = '1'
request._vars = data
self.assertRaises(HTTP, self.run_function)
-1
View File
@@ -142,4 +142,3 @@ class TestCache(unittest.TestCase):
self.assertEqual(a.as_csv(), h.as_csv())
db.t_a.drop()
db.close()
+2 -4
View File
@@ -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())
+1 -1
View File
@@ -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__)))
-1
View File
@@ -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<meta tag_name="tag_value" />\n')
+1 -1
View File
@@ -348,7 +348,7 @@ class TestBareHelpers(unittest.TestCase):
<>
//--></script>''')
self.assertEqual(SCRIPT().xml(), b'<script></script>')
self.assertEqual(SCRIPT(';').xml() + DIV().xml(),
self.assertEqual(SCRIPT(';').xml() + DIV().xml(),
b'<script><!--\n;\n//--></script><div></div>')
def test_STYLE(self):
+2 -2
View File
@@ -95,7 +95,7 @@ class TestTranslations(unittest.TestCase):
'Hello World')
self.assertEqual(str(T.M('**Hello World**')),
'<strong>Hello World</strong>')
# 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))),
-1
View File
@@ -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")
+1 -1
View File
@@ -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
-1
View File
@@ -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")
+2 -2
View File
@@ -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'<form')
@@ -337,7 +337,7 @@ class TestSQLFORM(unittest.TestCase):
# def test_search_menu(self):
# pass
def test_grid(self):
grid_form = SQLFORM.grid(self.db.auth_user)
self.assertEqual(grid_form.xml()[:4], b'<div')
-1
View File
@@ -1380,4 +1380,3 @@ class TestExpose(unittest.TestCase):
def test_not_authorized(self):
with self.assertRaises(HTTP):
self.make_expose(base='inside', show='link_to_file3')
+1 -1
View File
@@ -2567,7 +2567,7 @@ class IS_DATETIME_IN_RANGE(IS_DATETIME):
class IS_LIST_OF(Validator):
def __init__(self, other=None, minimum=None, maximum=None, error_message=None):
def __init__(self, other=None, minimum=None, maximum=None, error_message=None):
self.other = other
self.minimum = minimum
self.maximum = maximum