Docs for SQLFORM.__nonzero__.im_class
Description
<type 'type'> extends (<class 'gluon.html.FORM'>,)
|
Attributes
SQLFORM.__nonzero__.im_class.AUTOTYPES |
<type 'dict'>
belongs to class <type 'dict'>
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2) |
SQLFORM.__nonzero__.im_class.FIELDKEY_DELETE_RECORD |
<type 'str'>
belongs to class <type 'str'>
str(object='') -> string Return a nice string representation of the object. If the argument is a string, the return value is the same object. |
SQLFORM.__nonzero__.im_class.FIELDNAME_REQUEST_DELETE |
<type 'str'>
belongs to class <type 'str'>
str(object='') -> string Return a nice string representation of the object. If the argument is a string, the return value is the same object. |
SQLFORM.__nonzero__.im_class.ID_LABEL_SUFFIX |
<type 'str'>
belongs to class <type 'str'>
str(object='') -> string Return a nice string representation of the object. If the argument is a string, the return value is the same object. |
SQLFORM.__nonzero__.im_class.ID_ROW_SUFFIX |
<type 'str'>
belongs to class <type 'str'>
str(object='') -> string Return a nice string representation of the object. If the argument is a string, the return value is the same object. |
SQLFORM.__nonzero__.im_class.REDIRECT_JS |
<type 'str'>
belongs to class <type 'str'>
str(object='') -> string Return a nice string representation of the object. If the argument is a string, the return value is the same object. |
SQLFORM.__nonzero__.im_class.__add__ |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
SQLFORM.__nonzero__.im_class.__class__ |
<type 'type'> extends (<type 'object'>,)
belongs to class <type 'type'>
type(object) -> the object's type type(name, bases, dict) -> a new type |
SQLFORM.__nonzero__.im_class.__delattr__ |
<type 'wrapper_descriptor'>
belongs to class <type 'wrapper_descriptor'>
x.__delattr__('name') <==> del x.name |
SQLFORM.__nonzero__.im_class.__delitem__ |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
Deletes attribute with name 'i' or component #i. Args: i: index. If i is a string: the name of the attribute otherwise references to number of the component |
SQLFORM.__nonzero__.im_class.__dict__ |
<type 'dictproxy'>
belongs to class <type 'dictproxy'>
|
SQLFORM.__nonzero__.im_class.__doc__ |
<type 'str'>
belongs to class <type 'str'>
str(object='') -> string Return a nice string representation of the object. If the argument is a string, the return value is the same object. |
SQLFORM.__nonzero__.im_class.__format__ |
<type 'method_descriptor'>
belongs to class <type 'method_descriptor'>
default object formatter |
SQLFORM.__nonzero__.im_class.__getattribute__ |
<type 'wrapper_descriptor'>
belongs to class <type 'wrapper_descriptor'>
x.__getattribute__('name') <==> x.name |
SQLFORM.__nonzero__.im_class.__getitem__ |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
Gets attribute with name 'i' or component #i. If attribute 'i' is not found returns None Args: i: index. If i is a string: the name of the attribute otherwise references to number of the component |
SQLFORM.__nonzero__.im_class.__hash__ |
<type 'wrapper_descriptor'>
belongs to class <type 'wrapper_descriptor'>
x.__hash__() <==> hash(x) |
SQLFORM.__nonzero__.im_class.__init__ |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
SQLFORM.__nonzero__.im_class.__len__ |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
Returns the number of included components |
SQLFORM.__nonzero__.im_class.__module__ |
<type 'str'>
belongs to class <type 'str'>
str(object='') -> string Return a nice string representation of the object. If the argument is a string, the return value is the same object. |
SQLFORM.__nonzero__.im_class.__mul__ |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
SQLFORM.__nonzero__.im_class.__new__ |
<type 'builtin_function_or_method'>
belongs to class <type 'builtin_function_or_method'>
T.__new__(S, ...) -> a new object with type S, a subtype of T |
SQLFORM.__nonzero__.im_class.__nonzero__ |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
Always returns True |
SQLFORM.__nonzero__.im_class.__reduce__ |
<type 'method_descriptor'>
belongs to class <type 'method_descriptor'>
helper for pickle |
SQLFORM.__nonzero__.im_class.__reduce_ex__ |
<type 'method_descriptor'>
belongs to class <type 'method_descriptor'>
helper for pickle |
SQLFORM.__nonzero__.im_class.__repr__ |
<type 'wrapper_descriptor'>
belongs to class <type 'wrapper_descriptor'>
x.__repr__() <==> repr(x) |
SQLFORM.__nonzero__.im_class.__setattr__ |
<type 'wrapper_descriptor'>
belongs to class <type 'wrapper_descriptor'>
x.__setattr__('name', value) <==> x.name = value |
SQLFORM.__nonzero__.im_class.__setitem__ |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
Sets attribute with name 'i' or component #i. Args: i: index. If i is a string: the name of the attribute otherwise references to number of the component value: the new value |
SQLFORM.__nonzero__.im_class.__sizeof__ |
<type 'method_descriptor'>
belongs to class <type 'method_descriptor'>
__sizeof__() -> int size of object in memory, in bytes |
SQLFORM.__nonzero__.im_class.__str__ |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
str(COMPONENT) returns COMPONENT.xml() |
SQLFORM.__nonzero__.im_class.__subclasshook__ |
<type 'builtin_function_or_method'>
belongs to class <type 'builtin_function_or_method'>
Abstract classes can override this to customize issubclass(). This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached). |
SQLFORM.__nonzero__.im_class.__weakref__ |
<type 'getset_descriptor'>
belongs to class <type 'getset_descriptor'>
list of weak references to the object (if defined) |
SQLFORM.__nonzero__.im_class._fixup |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
Handling of provided components. Nothing to fixup yet. May be overridden by subclasses, eg for wrapping some components in another component or blocking them. |
SQLFORM.__nonzero__.im_class._postprocessing |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
SQLFORM.__nonzero__.im_class._setnode |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
SQLFORM.__nonzero__.im_class._traverse |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
SQLFORM.__nonzero__.im_class._validate |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
nothing to validate yet. May be overridden by subclasses |
SQLFORM.__nonzero__.im_class._wrap_components |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
helper for _fixup. Checks if a component is in allowed_parents, otherwise wraps it in wrap_parent Args: allowed_parents: (tuple) classes that the component should be an instance of wrap_parent: the class to wrap the component in, if needed wrap_lambda: lambda to use for wrapping, if needed |
SQLFORM.__nonzero__.im_class._xml |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
Helper for xml generation. Returns separately: - the component attributes - the generated xml of the inner components Component attributes start with an underscore ('_') and do not have a False or None value. The underscore is removed. A value of True is replaced with the attribute name. Returns: tuple: (attributes, components) |
SQLFORM.__nonzero__.im_class.accepts |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
Similar to `FORM.accepts` but also does insert, update or delete in DAL. If detect_record_change is `True` than: - `form.record_changed = False` (record is properly validated/submitted) - `form.record_changed = True` (record cannot be submitted because changed) If detect_record_change == False than: - `form.record_changed = None` |
SQLFORM.__nonzero__.im_class.add_button |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
SQLFORM.__nonzero__.im_class.add_class |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
add a class to _class attribute |
SQLFORM.__nonzero__.im_class.append |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
list style appending of components Examples: >>> a=DIV() >>> a.append(SPAN('x')) >>> print a <div><span>x</span></div> |
SQLFORM.__nonzero__.im_class.as_dict |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
EXPERIMENTAL Sanitize is naive. It should catch any unsafe value for client retrieval. |
SQLFORM.__nonzero__.im_class.as_json |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
SQLFORM.__nonzero__.im_class.as_xml |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
SQLFORM.__nonzero__.im_class.as_yaml |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
SQLFORM.__nonzero__.im_class.assert_status |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
SQLFORM.__nonzero__.im_class.build_query |
<type 'function'>
belongs to class <type 'function'>
|
SQLFORM.__nonzero__.im_class.confirm |
<type 'function'>
belongs to class <type 'function'>
|
SQLFORM.__nonzero__.im_class.createform |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
SQLFORM.__nonzero__.im_class.dictform |
<type 'function'>
belongs to class <type 'function'>
|
SQLFORM.__nonzero__.im_class.element |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
Finds the first component that matches the supplied attribute dictionary, or None if nothing could be found Also the components of the components are searched. |
SQLFORM.__nonzero__.im_class.elements |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
Find all components that match the supplied attribute dictionary, or None if nothing could be found All components of the components are searched. Examples: >>> a = DIV(DIV(SPAN('x'),3,DIV(SPAN('y')))) >>> for c in a.elements('span',first_only=True): c[0]='z' >>> print a <div><div><span>z</span>3<div><span>y</span></div></div></div> >>> for c in a.elements('span'): c[0]='z' >>> print a <div><div><span>z</span>3<div><span>z</span></div></div></div> It also supports a syntax compatible with jQuery Examples: >>> a=TAG('<div><span><a id="1-1" u:v=$>hello</a></span><p class="this is a test">world</p></div>') >>> for e in a.elements('div a#1-1, p.is'): print e.flatten() hello world >>> for e in a.elements('#1-1'): print e.flatten() hello >>> a.elements('a[u:v=$]')[0].xml() '<a id="1-1" u:v="$">hello</a>' >>> a=FORM( INPUT(_type='text'), SELECT(range(1)), TEXTAREA() ) >>> for c in a.elements('input, select, textarea'): c['_disabled'] = 'disabled' >>> a.xml() '<form action="#" enctype="multipart/form-data" method="post"><input disabled="disabled" type="text" /><select disabled="disabled"><option value="0">0</option></select><textarea cols="40" disabled="disabled" rows="10"></textarea></form>' Elements that are matched can also be replaced or removed by specifying a "replace" argument (note, a list of the original matching elements is still returned as usual). Examples: >>> a = DIV(DIV(SPAN('x', _class='abc'), DIV(SPAN('y', _class='abc'), SPAN('z', _class='abc')))) >>> b = a.elements('span.abc', replace=P('x', _class='xyz')) >>> print a <div><div><p class="xyz">x</p><div><p class="xyz">x</p><p class="xyz">x</p></div></div></div> "replace" can be a callable, which will be passed the original element and should return a new element to replace it. Examples: >>> a = DIV(DIV(SPAN('x', _class='abc'), DIV(SPAN('y', _class='abc'), SPAN('z', _class='abc')))) >>> b = a.elements('span.abc', replace=lambda el: P(el[0], _class='xyz')) >>> print a <div><div><p class="xyz">x</p><div><p class="xyz">y</p><p class="xyz">z</p></div></div></div> If replace=None, matching elements will be removed completely. Examples: >>> a = DIV(DIV(SPAN('x', _class='abc'), DIV(SPAN('y', _class='abc'), SPAN('z', _class='abc')))) >>> b = a.elements('span', find='y', replace=None) >>> print a <div><div><span class="abc">x</span><div><span class="abc">z</span></div></div></div> If a "find_text" argument is specified, elements will be searched for text components that match find_text, and any matching text components will be replaced (find_text is ignored if "replace" is not also specified). Like the "find" argument, "find_text" can be a string or a compiled regex. Examples: >>> a = DIV(DIV(SPAN('x', _class='abc'), DIV(SPAN('y', _class='abc'), SPAN('z', _class='abc')))) >>> b = a.elements(find_text=re.compile('x|y|z'), replace='hello') >>> print a <div><div><span class="abc">hello</span><div><span class="abc">hello</span><span class="abc">hello</span></div></div></div> If other attributes are specified along with find_text, then only components that match the specified attributes will be searched for find_text. Examples: >>> a = DIV(DIV(SPAN('x', _class='abc'), DIV(SPAN('y', _class='efg'), SPAN('z', _class='abc')))) >>> b = a.elements('span.efg', find_text=re.compile('x|y|z'), replace='hello') >>> print a <div><div><span class="abc">x</span><div><span class="efg">hello</span><span class="abc">z</span></div></div></div> |
SQLFORM.__nonzero__.im_class.factory |
<type 'function'>
belongs to class <type 'function'>
Generates a SQLFORM for the given fields. Internally will build a non-database based data model to hold the fields. |
SQLFORM.__nonzero__.im_class.flatten |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
Returns the text stored by the DIV object rendered by the render function the render function must take text, tagname, and attributes `render=None` is equivalent to `render=lambda text, tag, attr: text` Examples: >>> markdown = lambda text,tag=None,attributes={}: {None: re.sub('\s+',' ',text), 'h1':'#'+text+'\n\n', 'p':text+'\n'}.get(tag,text) >>> a=TAG('<h1>Header</h1><p>this is a test</p>') >>> a.flatten(markdown) '#Header\n\nthis is a test\n' |
SQLFORM.__nonzero__.im_class.formstyles |
<class 'gluon.storage.Storage'>
belongs to class <class 'gluon.storage.Storage'>
A Storage object is like a dictionary except `obj.foo` can be used in addition to `obj['foo']`, and setting obj.foo = None deletes item foo. Example:: >>> o = Storage(a=1) >>> print o.a 1 >>> o['a'] 1 >>> o.a = 2 >>> print o['a'] 2 >>> del o.a >>> print o.a None |
SQLFORM.__nonzero__.im_class.grid |
<type 'function'>
belongs to class <type 'function'>
|
SQLFORM.__nonzero__.im_class.hidden_fields |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|
SQLFORM.__nonzero__.im_class.insert |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
List-style inserting of components Examples: >>> a=DIV() >>> a.insert(0,SPAN('x')) >>> print a <div><span>x</span></div> |
SQLFORM.__nonzero__.im_class.process |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
Perform the .validate() method but returns the form Usage in controllers:: # directly on return def action(): #some code here return dict(form=FORM(...).process(...)) You can use it with FORM, SQLFORM or FORM based plugins:: # response.flash messages def action(): form = SQLFORM(db.table).process(message_onsuccess='Sucess!') return dict(form=form) # callback function # callback receives True or False as first arg, and a list of args. def my_callback(status, msg): response.flash = "Success! "+msg if status else "Errors occured" # after argument can be 'flash' to response.flash messages # or a function name to use as callback or None to do nothing. def action(): return dict(form=SQLFORM(db.table).process(onsuccess=my_callback) |
SQLFORM.__nonzero__.im_class.regex_attr |
<type '_sre.SRE_Pattern'>
belongs to class <type '_sre.SRE_Pattern'>
Compiled regular expression objects |
SQLFORM.__nonzero__.im_class.regex_class |
<type '_sre.SRE_Pattern'>
belongs to class <type '_sre.SRE_Pattern'>
Compiled regular expression objects |
SQLFORM.__nonzero__.im_class.regex_id |
<type '_sre.SRE_Pattern'>
belongs to class <type '_sre.SRE_Pattern'>
Compiled regular expression objects |
SQLFORM.__nonzero__.im_class.regex_tag |
<type '_sre.SRE_Pattern'>
belongs to class <type '_sre.SRE_Pattern'>
Compiled regular expression objects |
SQLFORM.__nonzero__.im_class.remove_class |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
remove a class from _class attribute |
SQLFORM.__nonzero__.im_class.search_menu |
<type 'function'>
belongs to class <type 'function'>
|
SQLFORM.__nonzero__.im_class.sibling |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
Finds the first sibling component that match the supplied argument list and attribute dictionary, or None if nothing could be found |
SQLFORM.__nonzero__.im_class.siblings |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
Finds all sibling components that match the supplied argument list and attribute dictionary, or None if nothing could be found |
SQLFORM.__nonzero__.im_class.smartdictform |
<type 'function'>
belongs to class <type 'function'>
|
SQLFORM.__nonzero__.im_class.smartgrid |
<type 'function'>
belongs to class <type 'function'>
Builds a system of SQLFORM.grid(s) between any referenced tables Args: table: main table constraints(dict): `{'table':query}` that limits which records can be accessible links(dict): like `{'tablename':[lambda row: A(....), ...]}` that will add buttons when table tablename is displayed linked_tables(list): list of tables to be linked Example: given you defined a model as:: db.define_table('person', Field('name'), format='%(name)s') db.define_table('dog', Field('name'), Field('owner', db.person), format='%(name)s') db.define_table('comment', Field('body'), Field('dog', db.dog)) if db(db.person).isempty(): from gluon.contrib.populate import populate populate(db.person, 300) populate(db.dog, 300) populate(db.comment, 1000) in a controller, you can do:: @auth.requires_login() def index(): form=SQLFORM.smartgrid(db[request.args(0) or 'person']) return dict(form=form) |
SQLFORM.__nonzero__.im_class.tag |
<type 'str'>
belongs to class <type 'str'>
str(object='') -> string Return a nice string representation of the object. If the argument is a string, the return value is the same object. |
SQLFORM.__nonzero__.im_class.update |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
dictionary like updating of the tag attributes |
SQLFORM.__nonzero__.im_class.validate |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
This function validates the form, you can use it instead of directly form.accepts. Usage: In controller:: def action(): form=FORM(INPUT(_name="test", requires=IS_NOT_EMPTY())) form.validate() #you can pass some args here - see below return dict(form=form) This can receive a bunch of arguments onsuccess = 'flash' - will show message_onsuccess in response.flash None - will do nothing can be a function (lambda form: pass) onfailure = 'flash' - will show message_onfailure in response.flash None - will do nothing can be a function (lambda form: pass) onchange = 'flash' - will show message_onchange in response.flash None - will do nothing can be a function (lambda form: pass) message_onsuccess message_onfailure message_onchange next = where to redirect in case of success any other kwargs will be passed for form.accepts(...) |
SQLFORM.__nonzero__.im_class.widgets |
<class 'gluon.storage.Storage'>
belongs to class <class 'gluon.storage.Storage'>
A Storage object is like a dictionary except `obj.foo` can be used in addition to `obj['foo']`, and setting obj.foo = None deletes item foo. Example:: >>> o = Storage(a=1) >>> print o.a 1 >>> o['a'] 1 >>> o.a = 2 >>> print o['a'] 2 >>> del o.a >>> print o.a None |
SQLFORM.__nonzero__.im_class.xml |
<type 'instancemethod'>
belongs to class <type 'instancemethod'>
|