Module xhtml
The XHTML renderer
This renderer is dedicated to the Nagare framework
- Imports:
- __future__, imghdr, lxml, nagare, nagare.namespaces, nagare.namespaces.xml, operator, peak.rules, types, webob
- Classes:
- A(_HTMLActionTag): <a> tags
- AsyncHeadRenderer(HeadRenderer):
- AsyncRenderer(Renderer): The XHTML asynchronous renderer
- CheckboxInput(_HTMLActionTag): <input> tags with type=checkbox attributes
- FileInput(_HTMLActionTag): <input> tags with type=file attributes
- Form(xhtml_base._HTMLTag): The <form> tag
- HeadRenderer(xhtml_base.HeadRenderer): The XHTML head Renderer
- HiddenInput(_HTMLActionTag): <input> tags with type=hidden attributes
- ImageInput(_HTMLActionTag): <input> tags with type=image attributes
- Img(_HTMLActionTag): <img> tags
- Label(xhtml_base._HTMLTag): <label> tags
- Option(xhtml_base._HTMLTag): <options> tags
- PasswordInput(_HTMLActionTag): <input> tags with type=password attributes
- RadioInput(_HTMLActionTag): <input> tags with type=radio attributes
- Renderer(xhtml_base.Renderer): The XHTML synchronous renderer
- Script(xhtml_base._HTMLTag):
- Select(_HTMLActionTag): <select> tags
- Style(xhtml_base._HTMLTag):
- SubmitInput(_HTMLActionTag): <input> tags with type=submit attributes
- TextArea(_HTMLActionTag): <textarea> tags
- TextInput(_HTMLActionTag): Dispatcher class for all the <input> tags
- _HTMLActionTag(xhtml_base._HTMLTag): Base class of all the tags with a .action() method
- Methods:
- absolute_url(url, static): Convert a relative URL of a static content to an absolute one
- add_attribute(self, name, value): Add an attribute with a ajax.Update value
- add_attribute(self, name, value): Add an attribute with a function value
- add_attribute(self, name, value): Add an attribute with a method value
- add_attribute(self, name, value): Add an attribute with a ajax.JS value
- add_attribute(next_method, self, name, value):
- add_child(next_method, self, script): Add a <script> to a tag
- add_child(next_method, self, style): Add a <style> to a tag
- render(self, h, *args): Generate the <head> tree
- render(self, h, *args): Generate a javascript view of the head
- Attributes:
- h = Renderer()
- t = ((1, 'a'), (2, 'b'), (3, 'c'))
Class xhtml.A
- Bases:
- _HTMLActionTag
<a> tags
- Methods:
- _async_action(self, renderer, action, with_request, permissions, subject): Register an asynchronous action
- sync_action(self, renderer, action, with_request, permissions, subject): Register a synchronous action
- Attributes:
- _actions = (41, None, 'onclick')
- async_action = _async_action
Method xhtml.A._async_action
- Arguments:
- self, renderer, action, with_request, permissions, subject
Register an asynchronous action
- In:
- renderer -- the current renderer
- action -- action
- with_request -- will the request and response objects be passed to the action ?
- permissions -- permissions needed to execute the action
- subject -- subject to test the permissions on
Method xhtml.A.sync_action
- Arguments:
- self, renderer, action, with_request, permissions, subject
Register a synchronous action
- In:
- renderer -- the current renderer
- action -- action
- with_request -- will the request and response objects be passed to the action ?
- permissions -- permissions needed to execute the action
- subject -- subject to test the permissions on
Class xhtml.AsyncHeadRenderer
- Bases:
- HeadRenderer
- Methods:
- __init__(self, static_url): Renderer initialisation
- _css(self, style): Memorize an in-line anonymous css style
- _get_anonymous_css(self): Return the list of the in-line anonymous css styles, sorted by order of insertion
- _get_anonymous_javascript(self): Return the list of anonymous javascript codes, sorted by order of insertion
- _javascript(self, script): Memorize an in-line anonymous javascript code
- _script(self, append, tag, script):
- _style(self, append, tag, style):
Method xhtml.AsyncHeadRenderer.__init__
Back to xhtml.AsyncHeadRenderer
- Arguments:
- self, static_url
Renderer initialisation
The HeadRenderer keeps track of the javascript and css used by every views, to be able to concatenate them into the <head> section.
Method xhtml.AsyncHeadRenderer._css
Back to xhtml.AsyncHeadRenderer
- Arguments:
- self, style
Memorize an in-line anonymous css style
- In:
- style -- the css style
Method xhtml.AsyncHeadRenderer._get_anonymous_css
Back to xhtml.AsyncHeadRenderer
- Arguments:
- self
Return the list of the in-line anonymous css styles, sorted by order of insertion
- Return:
- list of css styles
Method xhtml.AsyncHeadRenderer._get_anonymous_javascript
Back to xhtml.AsyncHeadRenderer
- Arguments:
- self
Return the list of anonymous javascript codes, sorted by order of insertion
- Return:
- list of javascript codes
Method xhtml.AsyncHeadRenderer._javascript
Back to xhtml.AsyncHeadRenderer
- Arguments:
- self, script
Memorize an in-line anonymous javascript code
- In:
- script -- the javascript code
Class xhtml.AsyncRenderer
- Bases:
- Renderer
The XHTML asynchronous renderer
- Methods:
- AsyncRenderer(self, *args, **kw): Create an associated asynchronous HTML renderer
- SyncRenderer(self, *args, **kw): Create an associated synchronous HTML renderer
- __init__(self, parent=None, session=None, request=None, response=None, callbacks=None, static_url='', static_path='', url='/', async_header=False): Renderer initialisation
- _css(self, style):
- _javascript(self, js):
- action(self, tag, action, with_request, permissions, subject): Register an asynchronous action on a tag
- end_rendering(self, output): Method called after a component is rendered
- get_async_root(self):
- javascript_url(self, url):
- start_rendering(self, component, model):
- Attributes:
- head_renderer_factory = AsyncHeadRenderer
Method xhtml.AsyncRenderer.AsyncRenderer
- Arguments:
- self, *args, **kw
Create an associated asynchronous HTML renderer
- Return:
- a new asynchronous renderer
Method xhtml.AsyncRenderer.SyncRenderer
- Arguments:
- self, *args, **kw
Create an associated synchronous HTML renderer
- Return:
- a new synchronous renderer
Method xhtml.AsyncRenderer.__init__
- Arguments:
- self, parent=None, session=None, request=None, response=None, callbacks=None, static_url='', static_path='', url='/', async_header=False
Renderer initialisation
- In:
- parent -- parent renderer
- session -- the session object
- request -- the request object
- response -- the response object
- callbacks -- the registered actions on the tags
- static_url -- url of the static contents of the application
- static_path -- path of the static contents of the application
- url -- url prefix of the application
- async_header -- is the head renderer to create a synchronous or an asynchronous one?
Method xhtml.AsyncRenderer.action
- Arguments:
- self, tag, action, with_request, permissions, subject
Register an asynchronous action on a tag
- In:
- tag -- the tag
- action -- action
- with_request -- will the request and response objects be passed to the action ?
- permissions -- permissions needed to execute the action
- subject -- subject to test the permissions on
Method xhtml.AsyncRenderer.end_rendering
- Arguments:
- self, output
Method called after a component is rendered
- In:
- output -- rendered tree
- Out:
- rendered tree
Class xhtml.CheckboxInput
- Bases:
- _HTMLActionTag
<input> tags with type=checkbox attributes
- Methods:
- selected(self, flag): (de)Select the tag
- Attributes:
- _actions = (1, 'name', 'onclick')
Method xhtml.CheckboxInput.selected
- Arguments:
- self, flag
(de)Select the tag
- In:
- flag -- boolean to deselect / select the tag
- Return:
- self
Class xhtml.FileInput
- Bases:
- _HTMLActionTag
<input> tags with type=file attributes
- Methods:
- init(self, renderer): Initialisation
- Attributes:
- _actions = (1, 'name', 'onchange')
Method xhtml.FileInput.init
- Arguments:
- self, renderer
Initialisation
- In:
- renderer -- the current renderer
- Return:
- self
Class xhtml.Form
- Bases:
- xhtml_base._HTMLTag
The <form> tag
- Methods:
- add_child(self, child): Add a child to this <form> tag
- init(self, renderer): Initialisation
- post_action(self, action, with_request=False, permissions=None, subject=None): Register an action that will be executed after the actions of the form elements
- pre_action(self, action, with_request=False, permissions=None, subject=None): Register an action that will be executed before the actions of the form elements
Method xhtml.Form.add_child
- Arguments:
- self, child
Add a child to this <form> tag
Delete the existing <form> tags in the child tree
Method xhtml.Form.init
- Arguments:
- self, renderer
Initialisation
- In:
- renderer -- the current renderer
- Return:
- self
Method xhtml.Form.post_action
- Arguments:
- self, action, with_request=False, permissions=None, subject=None
Register an action that will be executed after the actions of the form elements
- In:
- action -- action
- with_request -- will the request and response object be passed to the action ?
- permissions -- permissions needed to execute the action
- subject -- subject to test the permissions on
- Return:
- self
Method xhtml.Form.pre_action
- Arguments:
- self, action, with_request=False, permissions=None, subject=None
Register an action that will be executed before the actions of the form elements
- In:
- action -- action
- with_request -- will the request and response objects be passed to the action ?
- permissions -- permissions needed to execute the action
- subject -- subject to test the permissions on
- Return:
- self
Class xhtml.HeadRenderer
- Bases:
- xhtml_base.HeadRenderer
The XHTML head Renderer
This renderer knows about the static contents of the application
- Methods:
- __init__(self, static_url): Renderer initialisation
- _get_css_url(self): Return the list of css URLs, sorted by order of insertion
- _get_javascript_url(self): Return the list of javascript URLs, sorted by order of insertion
- _get_named_css(self): Return the list of the in-line named css styles, sorted by order of insertion
- _get_named_javascript(self): Return the list of named javascript codes, sorted by order of insertion
- _script(self, append, tag, script):
- _style(self, append, tag, style):
- css(self, name, style, **kw): Memorize an in-line named css style
- css_url(self, url, **kw): Memorize a css style URL
- javascript(self, name, script, **kw): Memorize an in-line named javascript code
- javascript_url(self, url, **kw): Memorize a javascript URL
Method xhtml.HeadRenderer.__init__
- Arguments:
- self, static_url
Renderer initialisation
The HeadRenderer keeps track of the javascript and css used by every views, to be able to concatenate them into the <head> section.
Method xhtml.HeadRenderer._get_css_url
- Arguments:
- self
Return the list of css URLs, sorted by order of insertion
- Return:
- list of css (URLs, attributes)
Method xhtml.HeadRenderer._get_javascript_url
- Arguments:
- self
Return the list of javascript URLs, sorted by order of insertion
- Return:
- list of javascript (URLs, attributes)
Method xhtml.HeadRenderer._get_named_css
- Arguments:
- self
Return the list of the in-line named css styles, sorted by order of insertion
- Return:
- list of (name, css style, attributes)
Method xhtml.HeadRenderer._get_named_javascript
- Arguments:
- self
Return the list of named javascript codes, sorted by order of insertion
- Return:
- list of (name, javascript code, attributes)
Method xhtml.HeadRenderer.css
- Arguments:
- self, name, style, **kw
Memorize an in-line named css style
- In:
- name -- unique name of this css style (to prevent double definition)
- style -- the css style
- kw -- attributes of the generated <style> tag
- Return:
- ()
Method xhtml.HeadRenderer.css_url
- Arguments:
- self, url, **kw
Memorize a css style URL
- In:
- url -- the css style URL
- kw -- attributes of the generated <link> tag
- Return:
- ()
Method xhtml.HeadRenderer.javascript
- Arguments:
- self, name, script, **kw
Memorize an in-line named javascript code
- In:
- name -- unique name of this javascript code (to prevent double definition)
- script -- the javascript code
- kw -- attributes of the generated <script> tag
- Return:
- ()
Method xhtml.HeadRenderer.javascript_url
- Arguments:
- self, url, **kw
Memorize a javascript URL
- In:
- url -- the javascript URL
- kw -- attributes of the the generated <script> tag
- Return:
- ()
Class xhtml.HiddenInput
- Bases:
- _HTMLActionTag
<input> tags with type=hidden attributes
- Attributes:
- _actions = (1, 'name', 'onchange')
Class xhtml.ImageInput
- Bases:
- _HTMLActionTag
<input> tags with type=image attributes
- Methods:
- add_child(self, child): Add attributes to the image input
- async_action(self, renderer, action, with_request, permissions, subject): Register an asynchronous action
- Attributes:
- _actions = (5, 'name', 'onclick')
Method xhtml.ImageInput.add_child
- Arguments:
- self, child
Add attributes to the image input
- In:
- child -- attributes dictionary
Method xhtml.ImageInput.async_action
- Arguments:
- self, renderer, action, with_request, permissions, subject
Register an asynchronous action
- In:
- renderer -- the current renderer
- action -- action
- with_request -- will the request and response objects be passed to the action ?
- permissions -- permissions needed to execute the action
- subject -- subject to test the permissions on
Class xhtml.Img
- Bases:
- _HTMLActionTag
<img> tags
- Methods:
- _set_content_type(self, request, action, with_request): Generate the image and guess its format
- add_child(self, child): Add attributes to the image
- sync_action(self, renderer, action, with_request, permissions, subject): Register a synchronous action
- Attributes:
- async_action = sync_action
Method xhtml.Img._set_content_type
- Arguments:
- self, request, action, with_request
Generate the image and guess its format
- In:
- request -- the web request object
- action -- function to call to generate the image data
- with_request -- will the request and response objects be passed to the action ?
- Return:
- new response object raised
Method xhtml.Img.add_child
- Arguments:
- self, child
Add attributes to the image
- In:
- child -- attributes dictionary
Method xhtml.Img.sync_action
- Arguments:
- self, renderer, action, with_request, permissions, subject
Register a synchronous action
The action will have to return the image data
- In:
- renderer -- the current renderer
- action -- action
- with_request -- will the request and response objects be passed to the action ?
- permissions -- permissions needed to execute the action
- subject -- subject to test the permissions on
Class xhtml.Label
- Bases:
- xhtml_base._HTMLTag
<label> tags
- Methods:
- init(self, renderer): Initialisation
Method xhtml.Label.init
- Arguments:
- self, renderer
Initialisation
- In:
- renderer -- the current renderer
- Return:
- self
Class xhtml.Option
- Bases:
- xhtml_base._HTMLTag
<options> tags
- Methods:
- selected(self, values): (de)Select the tags
Method xhtml.Option.selected
- Arguments:
- self, values
(de)Select the tags
- In:
- values -- name or list of names of the tags to select
- Return:
- self
Class xhtml.PasswordInput
- Bases:
- _HTMLActionTag
<input> tags with type=password attributes
- Attributes:
- _actions = (1, 'name', 'onchange')
Class xhtml.RadioInput
- Bases:
- _HTMLActionTag
<input> tags with type=radio attributes
- Methods:
- selected(self, flag): (de)Select the tag
- Attributes:
- _actions = (2, 'value', 'onclick')
Method xhtml.RadioInput.selected
- Arguments:
- self, flag
(de)Select the tag
- In:
- flag -- boolean to deselect / select the tag
- Return:
- self
Class xhtml.Renderer
- Bases:
- xhtml_base.Renderer
The XHTML synchronous renderer
- Methods:
- AsyncRenderer(self, *args, **kw): Create an associated asynchronous HTML renderer
- SyncRenderer(self, *args, **kw): Create an associated synchronous HTML renderer
- __init__(self, parent=None, session=None, request=None, response=None, callbacks=None, static_url='', static_path='', url='/'): Renderer initialisation
- action(self, tag, action, with_request, permissions, subject): Register a synchronous action on a tag
- add_sessionid_in_form(self, form): Add the session and continuation ids into a <form>
- add_sessionid_in_url(self, u='', params=None, sep='&'): Add the session and continuation ids into an url
- class_init(cls, specialTags): Class initialisation
- content_type(self): Generate the content type of the document
- decorate_error(self, element, error): During the rendering, highlight an element that has an error
- doctype(self): Generate the DOCTYPE of the document
- makeelement(self, tag): Make a tag
- parse_html(self, source, fragment=False, no_leading_text=False, xhtml=False, **kw): Parse a (X)HTML file
- parse_xml(self, source, fragment=False, no_leading_text=False, **kw): Parse a XML file
- register_callback(self, priority, f, with_request, render=None): Register an action
- start_rendering(self, component, model): Method called before to render a component
- Attributes:
- HTML_DOCTYPE = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'
- XML_DOCTYPE = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
- _specialTags = dict(text_input = TextInput, radio_input = RadioInput, checkbox_input = CheckboxInput, submit_input = SubmitInput, hidden_input = HiddenInput, file_input = FileInput, password_input = PasswordInput, image_input = ImageInput)
- a = TagProp('a', set(xhtml_base.allattrs + xhtml_base.focusattrs + ('charset', 'type', 'name', 'href', 'hreflang', 'rel', 'rev', 'shape', 'coords', 'target', 'oncontextmenu')), A)
- area = TagProp('area', set(xhtml_base.allattrs + xhtml_base.focusattrs + ('shape', 'coords', 'href', 'nohref', 'alt', 'target')), A)
- button = TagProp('button', set(xhtml_base.allattrs + xhtml_base.focusattrs + ('name', 'value', 'type', 'disabled')), SubmitInput)
- form = TagProp('form', set(xhtml_base.allattrs + ('action', 'method', 'name', 'enctype', 'onsubmit', 'onreset', 'accept_charset', 'target')), Form)
- head_renderer_factory = HeadRenderer
- img = TagProp('img', set(xhtml_base.allattrs + ('src', 'alt', 'name', 'longdesc', 'width', 'height', 'usemap', 'ismapalign', 'border', 'hspace', 'vspace', 'lowsrc')), Img)
- input = TagProp('input', set(xhtml_base.allattrs + xhtml_base.focusattrs + ('type', 'name', 'value', 'checked', 'disabled', 'readonly', 'size', 'maxlength', 'srcalt', 'usemap', 'onselect', 'onchange', 'accept', 'align', 'border')), TextInput)
- label = TagProp('label', set(xhtml_base.allattrs + ('for', 'accesskey', 'onfocus', 'onblur')), Label)
- option = TagProp('option', set(xhtml_base.allattrs + ('selected', 'disabled', 'label', 'value')), Option)
- script = TagProp('script', set(('id', 'charset', 'type', 'language', 'src', 'defer')), Script)
- select = TagProp('select', set(xhtml_base.allattrs + ('name', 'size', 'multiple', 'disabled', 'tabindex', 'onfocus', 'onblur', 'onchange', 'rows')), Select)
- style = TagProp('style', set(xhtml_base.i18nattrs + ('id', 'type', 'media', 'title')), Style)
- textarea = TagProp('textarea', set(xhtml_base.allattrs + xhtml_base.focusattrs + ('name', 'rows', 'cols', 'disabled', 'readonly', 'onselect', 'onchange', 'wrap')), TextArea)
Method xhtml.Renderer.AsyncRenderer
- Arguments:
- self, *args, **kw
Create an associated asynchronous HTML renderer
- Return:
- a new asynchronous renderer
Method xhtml.Renderer.SyncRenderer
- Arguments:
- self, *args, **kw
Create an associated synchronous HTML renderer
- Return:
- a new synchronous renderer
Method xhtml.Renderer.__init__
- Arguments:
- self, parent=None, session=None, request=None, response=None, callbacks=None, static_url='', static_path='', url='/'
Renderer initialisation
- In:
- parent -- parent renderer
- session -- the session object
- request -- the request object
- response -- the response object
- callbacks -- the registered actions on the tags
- static_url -- url of the static contents of the application
- static_path -- path of the static contents of the application
- url -- url prefix of the application
Method xhtml.Renderer.action
- Arguments:
- self, tag, action, with_request, permissions, subject
Register a synchronous action on a tag
- In:
- tag -- the tag
- action -- action
- with_request -- will the request and response objects be passed to the action ?
- permissions -- permissions needed to execute the action
- subject -- subject to test the permissions on
Method xhtml.Renderer.add_sessionid_in_form
- Arguments:
- self, form
Add the session and continuation ids into a <form>
Forward this call to the sessions manager
- In:
- form -- the form tag
Method xhtml.Renderer.add_sessionid_in_url
- Arguments:
- self, u='', params=None, sep='&'
Add the session and continuation ids into an url
Forward this call to the sessions manager
- In:
- u -- the url
- params -- query string of the url
- Return:
- the completed url
Method xhtml.Renderer.class_init
- Arguments:
- cls, specialTags
Class initialisation
- In:
- -- special_tags -- tags that have a special factory
- Decorators:
- @classmethod
Class xhtml.Renderer.class_init.CustomLookup
Back to xhtml.Renderer.class_init
- Bases:
- ET.CustomElementClassLookup
- Methods:
- __init__(self, specialTags, defaultLookup):
- lookup(self, node_type, document, namespace, name):
Method xhtml.Renderer.content_type
- Arguments:
- self
Generate the content type of the document
If a content type was set on the response object, use it Else, use the HTML ou XHTML content type of this renderer
- Return:
- the content type
- Decorators:
- @property
Method xhtml.Renderer.decorate_error
- Arguments:
- self, element, error
During the rendering, highlight an element that has an error
- In:
- element -- the element in error
- error -- the error text
Method xhtml.Renderer.doctype
- Arguments:
- self
Generate the DOCTYPE of the document
If a doctype was set on the response object, use it Else, use the HTML ou XHTML doctypes of this renderer
- Return:
- the doctype
- Decorators:
- @property
Method xhtml.Renderer.makeelement
- Arguments:
- self, tag
Make a tag
- In:
- tag -- name of the tag to create
- Return:
- the new tag
Method xhtml.Renderer.parse_html
- Arguments:
- self, source, fragment=False, no_leading_text=False, xhtml=False, **kw
Parse a (X)HTML file
- In:
- source -- can be a filename or a file object
- fragment -- if True, can parse a HTML fragment i.e a HTML without a unique root
- no_leading_text -- if fragment is True, no_leading_text is False and the HTML to parsed begins by a text, this text is keeped
- xhtml -- is the HTML to parse a valid XHTML ?
- kw -- keywords parameters are passed to the HTML parser
- Return:
- the root element of the parsed HTML, if fragment is False
- a list of HTML elements, if fragment is True
Method xhtml.Renderer.parse_xml
- Arguments:
- self, source, fragment=False, no_leading_text=False, **kw
Parse a XML file
- In:
- source -- can be a filename or a file object
- fragment -- if True, can parse a XML fragment i.e a XML without a unique root
- no_leading_text -- if fragment is True, no_leading_text is False and the XML to parsed begins by a text, this text is keeped
- kw -- keywords parameters are passed to the XML parser
- Return:
- the root element of the parsed XML, if fragment is False
- a list of XML elements, if fragment is True
Method xhtml.Renderer.register_callback
- Arguments:
- self, priority, f, with_request, render=None
Register an action
Forward the call to the callbacks object
- In:
- priority - -priority of the action
- f -- the action
- with_request -- will the request and response objects be passed to the action ?
- render -- render method to generate the view after the f action will be called
Method xhtml.Renderer.start_rendering
- Arguments:
- self, component, model
Method called before to render a component
- In:
- component -- component to render
- model -- name of the view to use
Class xhtml.Select
- Bases:
- _HTMLActionTag
<select> tags
- Methods:
- action(self, action, with_request=False, permissions=None, subject=None): Register an action
- Attributes:
- _actions = (1, 'name', 'onchange')
Method xhtml.Select.action
- Arguments:
- self, action, with_request=False, permissions=None, subject=None
Register an action
- In:
- action -- action
- with_request -- will the request and response objects be passed to the action ?
- permissions -- permissions needed to execute the action
- subject -- subject to test the permissions on
- Return:
- self
Class xhtml.SubmitInput
- Bases:
- _HTMLActionTag
<input> tags with type=submit attributes
- Methods:
- async_action(self, renderer, action, with_request, permissions, subject): Register an asynchronous action
- Attributes:
- _actions = (4, 'name', 'onclick')
Method xhtml.SubmitInput.async_action
- Arguments:
- self, renderer, action, with_request, permissions, subject
Register an asynchronous action
- In:
- renderer -- the current renderer
- action -- action
- with_request -- will the request and response objects be passed to the action ?
- permissions -- permissions needed to execute the action
- subject -- subject to test the permissions on
Class xhtml.TextArea
- Bases:
- _HTMLActionTag
<textarea> tags
- Methods:
- action(self, action, with_request=False, permissions=None, subject=None): Register an action
- Attributes:
- _actions = (1, 'name', 'onchange')
Method xhtml.TextArea.action
- Arguments:
- self, action, with_request=False, permissions=None, subject=None
Register an action
- In:
- action -- action
- with_request -- will the request and response objects be passed to the action ?
- permissions -- permissions needed to execute the action
- subject -- subject to test the permissions on
- Return:
- self
Class xhtml.TextInput
- Bases:
- _HTMLActionTag
Dispatcher class for all the <input> tags
- Methods:
- __call__(self, *children, **attrib):
- Attributes:
- _actions = (1, 'name', 'onchange')
Class xhtml._HTMLActionTag
- Bases:
- xhtml_base._HTMLTag
Base class of all the tags with a .action() method
- Methods:
- _async_action(self, renderer, action, with_request, permissions, subject): Register an asynchronous action
- action(self, action, with_request=False, permissions=None, subject=None): Register an action
- sync_action(self, renderer, action, with_request, permissions, subject): Register a synchronous action
- Attributes:
- async_action = sync_action
Method xhtml._HTMLActionTag._async_action
- Arguments:
- self, renderer, action, with_request, permissions, subject
Register an asynchronous action
- In:
- renderer -- the current renderer
- action -- action
- with_request -- will the request and response objects be passed to the action ?
- permissions -- permissions needed to execute the action
- subject -- subject to test the permissions on
Method xhtml._HTMLActionTag.action
- Arguments:
- self, action, with_request=False, permissions=None, subject=None
Register an action
- In:
- action -- action
- with_request -- will the request and response objects be passed to the action ?
- permissions -- permissions needed to execute the action
- subject -- subject to test the permissions on
- Return:
- self
Method xhtml._HTMLActionTag.sync_action
- Arguments:
- self, renderer, action, with_request, permissions, subject
Register a synchronous action
- In:
- renderer -- the current renderer
- action -- action
- with_request -- will the request and response objects be passed to the action ?
- permissions -- permissions needed to execute the action
- subject -- subject to test the permissions on
Method xhtml.absolute_url
- Arguments:
- url, static
Convert a relative URL of a static content to an absolute one
- In:
- url -- url to convert
- static -- URL prefix of the static contents
- Return:
- an absolute URL
Method xhtml.add_attribute
- Arguments:
- self, name, value
Add an attribute with a ajax.Update value
- In:
- self -- the tag
- name -- name of the attribute
- value -- ajax.Update value
- Decorators:
- @peak.rules.when(xml.add_attribute, (xml._Tag, basestring, ajax.Update))
Method xhtml.add_attribute
- Arguments:
- self, name, value
Add an attribute with a function value
- In:
- self -- the tag
- name -- name of the attribute
- value -- function value
- Decorators:
- @peak.rules.when(xml.add_attribute, (xml._Tag, basestring, types.FunctionType))
Method xhtml.add_attribute
- Arguments:
- self, name, value
Add an attribute with a method value
- In:
- self -- the tag
- name -- name of the attribute
- value -- method value
- Decorators:
- @peak.rules.when(xml.add_attribute, (xml._Tag, basestring, types.MethodType))
Method xhtml.add_attribute
- Arguments:
- self, name, value
Add an attribute with a ajax.JS value
- In:
- self -- the tag
- name -- name of the attribute
- value -- ajax.JS value
- Decorators:
- @peak.rules.when(xml.add_attribute, (xml._Tag, basestring, ajax.JS))
Method xhtml.add_child
- Arguments:
- next_method, self, script
Add a <script> to a tag
- In:
- self -- the tag
- script -- the script to add
- Decorators:
- @peak.rules.when(xml.add_child, (xhtml_base._HTMLTag, Script))
Method xhtml.add_child
- Arguments:
- next_method, self, style
Add a <style> to a tag
- In:
- self -- the tag
- style -- the style to add
- Decorators:
- @peak.rules.when(xml.add_child, (xhtml_base._HTMLTag, Style))
Method xhtml.render
- Arguments:
- self, h, *args
Generate the <head> tree
- In:
- h -- not used
- Return:
- the <head> tree
- Decorators:
- @presentation.render_for(HeadRenderer)
Method xhtml.render
- Arguments:
- self, h, *args
Generate a javascript view of the head
- In:
- h -- the current renderer
- Return:
- a javascript string
- Decorators:
- @presentation.render_for(AsyncHeadRenderer)