Package web2py :: Package gluon
[hide private]
[frames] | no frames]

Package gluon

source code

This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)

Web2Py framework modules



Submodules [hide private]
  • web2py.gluon.admin: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.cache: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.cfs: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.compileapp: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.contenttype: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.contrib
  • web2py.gluon.custom_import
  • web2py.gluon.dal: This file is part of the web2py Web Framework...
  • web2py.gluon.debug: This file is part of the web2py Web Framework Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu>, limodou <limodou@gmail.com> and srackham <srackham@gmail.com>.
  • web2py.gluon.decoder
  • web2py.gluon.fileutils: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.globals: This file is part of the web2py Web Framework...
  • web2py.gluon.highlight: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.html: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.http: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.import_all: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.languages: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.main: This file is part of the web2py Web Framework...
  • web2py.gluon.myregex: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.newcron: Created by Attila Csipa <web2py@csipa.in.rs> Modified by Massimo Di Pierro <mdipierro@cs.depaul.edu>
  • web2py.gluon.portalocker: Cross-platform (posix/nt) API for flock-style file locking.
  • web2py.gluon.reserved_sql_keywords
  • web2py.gluon.restricted: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.rewrite: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.rocket
  • web2py.gluon.sanitizer: :
  • web2py.gluon.serializers: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.settings: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.shell: This file is part of the web2py Web Framework Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu>, limodou <limodou@gmail.com> and srackham <srackham@gmail.com>.
  • web2py.gluon.sql
  • web2py.gluon.sqlhtml: This file is part of the web2py Web Framework...
  • web2py.gluon.storage: This file is part of the web2py Web Framework...
  • web2py.gluon.streamer: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.template: This file is part of the web2py Web Framework (Copyrighted, 2007-2011).
  • web2py.gluon.tools: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.utils: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.validators: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.widget: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
  • web2py.gluon.xmlrpc: This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)

Classes [hide private]
  HTTP
  DAL
an instance of this class represents a database connection
  Field
an instance of this class represents a database field
  SQLFORM
SQLFORM is used to map a table (and a current record) into an HTML form given a SQLTable stored in db.table generates an insert form:: SQLFORM(db.table) generates an update form:: record=db.table[some_id] SQLFORM(db.table, record) generates an update with a delete button:: SQLFORM(db.table, record, deletable=True) if record is an int:: record=db.table[record] optional arguments: :param fields: a list of fields that should be placed in the form, default is all.
  SQLTABLE
given a Rows object, as returned by a db().select(), generates an html table with the rows.
  A
  B
  BEAUTIFY
example:: >>> BEAUTIFY(['a', 'b', {'hello': 'world'}]).xml() '<div><table><tr><td><div>a</div></td></tr><tr><td><div>b</div></td></tr><tr><td><div><table><tr><td style="font-weight:bold;">hello</td><td valign="top">:</td><td><div>world</div></td></tr></table></div></td></tr></table></div>' turns any list, dictionary, etc into decent looking html.
  BODY
  BR
  CAT
  CENTER
  CLEANUP
example:
  CODE
displays code in HTML with syntax highlighting.
  CRYPT
example:
  DIV
HTML helper, for easy generating and manipulating a DOM structure.
  EM
  EMBED
  FIELDSET
  FORM
example:
  H1
  H2
  H3
  H4
  H5
  H6
  HEAD
  HR
  HTML
There are four predefined document type definitions.
  I
  IFRAME
  IMG
  INPUT
INPUT Component examples:: >>> INPUT(_type='text', _name='name', value='Max').xml() '<input name="name" type="text" value="Max" />' >>> INPUT(_type='checkbox', _name='checkbox', value='on').xml() '<input checked="checked" name="checkbox" type="checkbox" value="on" />' >>> INPUT(_type='radio', _name='radio', _value='yes', value='yes').xml() '<input checked="checked" name="radio" type="radio" value="yes" />' >>> INPUT(_type='radio', _name='radio', _value='no', value='yes').xml() '<input name="radio" type="radio" value="no" />' the input helper takes two special attributes value= and requires=.
  IS_ALPHANUMERIC
example:
  IS_DATE
example:
  IS_DATETIME
example:
  IS_DATETIME_IN_RANGE
example:
  IS_DATE_IN_RANGE
example:
  IS_DECIMAL_IN_RANGE
Determine that the argument is (or can be represented as) a Python Decimal, and that it falls within the specified inclusive range.
  IS_EMAIL
Checks if field's value is a valid email address.
  IS_EMPTY_OR
dummy class for testing IS_EMPTY_OR
  IS_EQUAL_TO
example:
  IS_EXPR
example:
  IS_FLOAT_IN_RANGE
Determine that the argument is (or can be represented as) a float, and that it falls within the specified inclusive range.
  IS_IMAGE
Checks if file uploaded through file input was saved in one of selected image formats and has dimensions (width and height) within given boundaries.
  IS_INT_IN_RANGE
Determine that the argument is (or can be represented as) an int, and that it falls within the specified range.
  IS_IN_DB
example:
  IS_IN_SET
example:
  IS_IPV4
Checks if field's value is an IP version 4 address in decimal form.
  IS_LENGTH
Checks if length of field's value fits between given boundaries.
  IS_LIST_OF
  IS_LOWER
convert to lower case
  IS_MATCH
example:
  IS_NOT_EMPTY
example:
  IS_NOT_IN_DB
example:
  IS_NULL_OR
dummy class for testing IS_EMPTY_OR
  IS_SLUG
convert arbitrary text string to a slug
  IS_STRONG
example:
  IS_TIME
example:
  IS_UPLOAD_FILENAME
Checks if name and extension of file uploaded through file input matches given criteria.
  IS_UPPER
convert to upper case
  IS_URL
Rejects a URL string if any of the following is true: * The string is empty or None * The string uses characters that are not allowed in a URL * The string breaks any of the HTTP syntactic rules * The URL scheme specified (if one is specified) is not 'http' or 'https' * The top-level domain (if a host name is specified) does not exist (These rules are based on RFC 2616: http://www.faqs.org/rfcs/rfc2616.html) This function only checks the URL's syntax.
  LABEL
  LEGEND
  LI
  LINK
  MARKMIN
For documentation: http://web2py.com/examples/static/markmin.html
  MENU
Used to build menus...
  META
  OBJECT
  OL
  OPTGROUP
  OPTION
  P
Will replace ``\n`` by ``<br />`` if the `cr2br` attribute is provided.
  PRE
  SCRIPT
  SELECT
example:
  SPAN
  STYLE
  TABLE
TABLE Component.
  TBODY
  TD
  TEXTAREA
example:
  TFOOT
  TH
  THEAD
  TITLE
  TR
TR Component.
  TT
  UL
UL Component.
  XHTML
This is XHTML version of the HTML helper.
  XML
use it to wrap a string that contains XML/HTML so that it will not be escaped by the template
Functions [hide private]
 
redirect(location, how=303) source code
 
URL(a=1, c=1, f=1, r=1, args=[], vars={}, anchor='', extension=1, env=1, hmac_key=1, hash_vars=True, salt=1, user_signature=1, scheme=1, host=1, port=1)
generate a URL example:: >>> str(URL(a='a', c='c', f='f', args=['x', 'y', 'z'], ...
source code
 
embed64(filename=1, file=1, data=1, extension='image/gif')
helper to encode the provided (binary) data into base64.
source code
Variables [hide private]
  current = threading.local()
  ON = True
  TAG = __TAG__()
Function Details [hide private]

URL(a=1, c=1, f=1, r=1, args=[], vars={}, anchor='', extension=1, env=1, hmac_key=1, hash_vars=True, salt=1, user_signature=1, scheme=1, host=1, port=1)

source code 

generate a URL

example::

    >>> str(URL(a='a', c='c', f='f', args=['x', 'y', 'z'],
    ...     vars={'p':1, 'q':2}, anchor='1'))
    '/a/c/f/x/y/z?p=1&q=2#1'

    >>> str(URL(a='a', c='c', f='f', args=['x', 'y', 'z'],
    ...     vars={'p':(1,3), 'q':2}, anchor='1'))
    '/a/c/f/x/y/z?p=1&p=3&q=2#1'

    >>> str(URL(a='a', c='c', f='f', args=['x', 'y', 'z'],
    ...     vars={'p':(3,1), 'q':2}, anchor='1'))
    '/a/c/f/x/y/z?p=3&p=1&q=2#1'

    >>> str(URL(a='a', c='c', f='f', anchor='1+2'))
    '/a/c/f#1%2B2'

    >>> str(URL(a='a', c='c', f='f', args=['x', 'y', 'z'],
    ...     vars={'p':(1,3), 'q':2}, anchor='1', hmac_key='key'))
    '/a/c/f/x/y/z?p=1&p=3&q=2&_signature=5d06bb8a4a6093dd325da2ee591c35c61afbd3c6#1'

generates a url '/a/c/f' corresponding to application a, controller c
and function f. If r=request is passed, a, c, f are set, respectively,
to r.application, r.controller, r.function.

The more typical usage is:

URL(r=request, f='index') that generates a url for the index function
within the present application and controller.

:param a: application (default to current if r is given)
:param c: controller (default to current if r is given)
:param f: function (default to current if r is given)
:param r: request (optional)
:param args: any arguments (optional)
:param vars: any variables (optional)
:param anchor: anchorname, without # (optional)
:param hmac_key: key to use when generating hmac signature (optional)
:param hash_vars: which of the vars to include in our hmac signature
    True (default) - hash all vars, False - hash none of the vars,
    iterable - hash only the included vars ['key1','key2']
:param scheme: URI scheme (True, 'http' or 'https', etc); forces absolute URL (optional)
:param host: string to force absolute URL with host (True means http_host)
:param port: optional port number (forces absolute URL)

:raises SyntaxError: when no application, controller or function is
    available
:raises SyntaxError: when a CRLF is found in the generated url

embed64(filename=1, file=1, data=1, extension='image/gif')

source code 

helper to encode the provided (binary) data into base64.

:param filename: if provided, opens and reads this file in 'rb' mode :param file: if provided, reads this file :param data: if provided, uses the provided data