stream allows for optional headers and fixed a formtyle bug, thanks Anthony
This commit is contained in:
@@ -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
@@ -278,7 +278,8 @@ class Response(Storage):
|
|||||||
chunk_size = DEFAULT_CHUNK_SIZE,
|
chunk_size = DEFAULT_CHUNK_SIZE,
|
||||||
request=None,
|
request=None,
|
||||||
attachment=False,
|
attachment=False,
|
||||||
filename=None
|
filename=None,
|
||||||
|
headers=None
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
if a controller function::
|
if a controller function::
|
||||||
@@ -298,7 +299,7 @@ class Response(Storage):
|
|||||||
default to the last request argument otherwise)
|
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
|
# for attachment settings and backward compatibility
|
||||||
keys = [item.lower() for item in headers]
|
keys = [item.lower() for item in headers]
|
||||||
if attachment:
|
if attachment:
|
||||||
|
|||||||
+8
-7
@@ -1105,20 +1105,21 @@ class SQLFORM(FORM):
|
|||||||
self.components = [table]
|
self.components = [table]
|
||||||
|
|
||||||
def createform(self, xfields):
|
def createform(self, xfields):
|
||||||
if isinstance(self.formstyle, basestring):
|
formstyle = self.formstyle
|
||||||
if self.formstyle in SQLFORM.formstyles:
|
if isinstance(formstyle, basestring):
|
||||||
self.formstyle = SQLFORM.formstyles[self.formstyle]
|
if formstyle in SQLFORM.formstyles:
|
||||||
|
formstyle = SQLFORM.formstyles[formstyle]
|
||||||
else:
|
else:
|
||||||
raise RuntimeError, 'formstyle not found'
|
raise RuntimeError, 'formstyle not found'
|
||||||
|
|
||||||
if callable(self.formstyle):
|
if callable(formstyle):
|
||||||
# backward compatibility, 4 argument function is the old style
|
# 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:
|
if defaults and len(args) - len(defaults) == 4 or len(args) == 4:
|
||||||
table = TABLE()
|
table = TABLE()
|
||||||
for id,a,b,c in xfields:
|
for id,a,b,c in xfields:
|
||||||
raw_b = self.field_parent[id] = b
|
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":
|
if type(newrows).__name__ != "tuple":
|
||||||
newrows = [newrows]
|
newrows = [newrows]
|
||||||
for newrow in newrows:
|
for newrow in newrows:
|
||||||
@@ -1126,7 +1127,7 @@ class SQLFORM(FORM):
|
|||||||
else:
|
else:
|
||||||
for id,a,b,c in xfields:
|
for id,a,b,c in xfields:
|
||||||
self.field_parent[id] = b
|
self.field_parent[id] = b
|
||||||
table = self.formstyle(self, xfields)
|
table = formstyle(self, xfields)
|
||||||
else:
|
else:
|
||||||
raise RuntimeError, 'formstyle not supported'
|
raise RuntimeError, 'formstyle not supported'
|
||||||
return table
|
return table
|
||||||
|
|||||||
Reference in New Issue
Block a user