stream allows for optional headers and fixed a formtyle bug, thanks Anthony

This commit is contained in:
mdipierro
2012-09-10 17:29:41 -05:00
parent 830b6f120d
commit 566f030902
3 changed files with 12 additions and 10 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.0.8 (2012-09-10 11:34:33) stable
Version 2.0.8 (2012-09-10 17:29:35) stable
+3 -2
View File
@@ -278,7 +278,8 @@ class Response(Storage):
chunk_size = DEFAULT_CHUNK_SIZE,
request=None,
attachment=False,
filename=None
filename=None,
headers=None
):
"""
if a controller function::
@@ -298,7 +299,7 @@ class Response(Storage):
default to the last request argument otherwise)
"""
headers = self.headers
headers = headers if headers is not None else self.headers
# for attachment settings and backward compatibility
keys = [item.lower() for item in headers]
if attachment:
+8 -7
View File
@@ -1105,20 +1105,21 @@ class SQLFORM(FORM):
self.components = [table]
def createform(self, xfields):
if isinstance(self.formstyle, basestring):
if self.formstyle in SQLFORM.formstyles:
self.formstyle = SQLFORM.formstyles[self.formstyle]
formstyle = self.formstyle
if isinstance(formstyle, basestring):
if formstyle in SQLFORM.formstyles:
formstyle = SQLFORM.formstyles[formstyle]
else:
raise RuntimeError, 'formstyle not found'
if callable(self.formstyle):
if callable(formstyle):
# backward compatibility, 4 argument function is the old style
args, varargs, keywords, defaults = inspect.getargspec(self.formstyle)
args, varargs, keywords, defaults = inspect.getargspec(formstyle)
if defaults and len(args) - len(defaults) == 4 or len(args) == 4:
table = TABLE()
for id,a,b,c in xfields:
raw_b = self.field_parent[id] = b
newrows = self.formstyle(id,a,raw_b,c)
newrows = formstyle(id,a,raw_b,c)
if type(newrows).__name__ != "tuple":
newrows = [newrows]
for newrow in newrows:
@@ -1126,7 +1127,7 @@ class SQLFORM(FORM):
else:
for id,a,b,c in xfields:
self.field_parent[id] = b
table = self.formstyle(self, xfields)
table = formstyle(self, xfields)
else:
raise RuntimeError, 'formstyle not supported'
return table