Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More
lino.utils.jsgen¶
A framework for generating Javascript from Python.
See also Utilities for generating JavaScript code.
Example in Lino utilities.
Functions
|
Yields the Javascript lines that declare the given |
|
|
|
|
|
|
|
|
|
Note that None values are rendered as |
|
Classes
|
A Component is a Variable whose value is a dict of options. |
|
|
|
|
|
A visible component |
|
A string that py2js will represent as is, not between quotes. |
- lino.utils.jsgen.obj2dict(o, attrs)¶
- Parameters:
o – object
attrs – space seperated string or list of strings of wanted attrs
kws – existing dict of values
- Returns:
dict with key:value pairs that match the object[arrts] if arrts exist in object
- class lino.utils.jsgen.js_code(s)¶
Bases:
object
A string that py2js will represent as is, not between quotes.
- class lino.utils.jsgen.Component(name=None, **options)¶
Bases:
Variable
A Component is a Variable whose value is a dict of options. Deserves more documentation.
- walk()¶
Walk over this component and its children.
- class lino.utils.jsgen.VisibleComponent(name, **kwargs)¶
Bases:
Component
,Permittable
A visible component
- install_permission_handler()¶
Define the allow_read handler used by
get_view_permission()
. This must be done only once, but after having configureddebug_permissions
andrequired_roles
.
- lino.utils.jsgen.declare_vars(v)¶
Yields the Javascript lines that declare the given
Variable
v. If v is aComponent
, list, tuple or dict which contains other variables, recursively yields also the lines to declare these.
- lino.utils.jsgen.py2js(v, compact=True)¶
Note that None values are rendered as
null
(notundefined
).