FeretUI client internals¶
feretui module¶
Feretui.
Small web client to build an admin user interface without any link with a framework.
This project is not a nodejs project. The client is generated with static templates. The javascrip library Htmx to improve the capability to manipulate the DOM and to add HTTP verb (DELETE, PUT, PATCH).
The client is not a Framework, and don’t use any web-server, orm, connector Frameworks. The goal is to separate the concept between both.
In a classical project the database, the ORM model’s and the user interface is declared on the same place. They are both the same configuration. But It is a mistake, because that limit the possibility and force to have only entry point by the user interface. The rules as required, readonly, … should be depending only on the user-interface. It is possible to define an interface based on more than one Model, or with another constraints.
To isolate it about the web-server projects, This project add objects to do absctract with web server:
feretui.request.Request
: It is the class object used by FeretUI to represent web-server request.feretui.response.Response
: It is the class object used by FeretUI to respond at the client query.feretui.session.Session
: It is the class object used by FeretUI to define to represent an user session, it is not the Session of the web-server.
FeretUI include to mecanism of templating:
feretui.template.Template
: Import template by addons, the template can be modified by another template file. They are compiled by id and language. The compiled template are stored.
The both are used in the same time, the internal allow the modularity, and jinja allow the loop and setter the variable inside the template
[my/template.tmpl]
<template id="my-template">
<ul>
{% for tag in tags %}
<li>{{ tag }}</li>
{% endfor %}
</ul>
</template>
import of the template file
myferet.register_template_file('my/template.tmpl')
render the template
template_str = myferet.render_template(
session, 'my-template', tags=['foo', 'bar'])
If the template need a static file (js, css, image), it is possible to add this static in existing client
myferet.register_js('my-lib.js', 'path in the filesystem')
myferet.register_css('my-lib.css', 'path in the filesystem')
myferet.register_image('my-picture.png', 'path in the filesystem')
Note
Python os lib give helper to find the path where the module is installed.
Note
An existing entrypoint is called at during the initialisation of the
instance. In this entrypoint you may declare any static you need
feretui.feretui.FeretUI.register_addons_from_entrypoint()
.
FeretUI include theme mecanism base on
Bulma watch. It is easier to add your
new theme file with feretui.feretui.FeretUI.register_theme()
.
myferet.register_theme('my-theme', 'path in the filesystem')
FeretUI add Action mechanism. The actions are callbacks and take as arguments the request and the argument of the action.
feretui.FeretUI.register_action
: Decorator to register the callback as an action.feretui.FeretUI.execute_action
: Method to execute an action.
FeretUI allow to add page mecanisme. The page are function and take as arguments the session and the querystring or the body.
feretui.FeretUI.register_page
: Decorator to register the pageferetui.FeretUI.register_static_page
: Declare a static pageferetui.FeretUI.get_page
: Method to return the page function.
@myferet.register_page(
name='my-page',
template='''
<template id="my-page">
<div>My page</div>
</template>
'''
)
def my_page(feretui, session, option):
return feretui.render_template(session, 'my-page')
In the case of the fully static page.
myferet.register_static_page(
'my-static-page',
'''
<div>...</div>
'''
)
or
from feretui.pages import static_page
myferet.register_page(name='my-page')(static_page('my-page-id))
To display the page a menu mecanism exist to call the render method of the page.
myferet.register_toolbar_right_menus([
ToolBarMenu(
'My static page',
page='my-static-page',
description="Go to my static page"
),
])
They are two main type of menu:
Toolbar: Renderer in the toolbar
feretui.menus.ToolBarMenu
: Simple menuferetui.menus.ToolBarDropDownMenu
: Dropdown menuferetui.menus.ToolBarDividerMenu
: Séparator in dropdown menuferetui.menus.ToolBarUrlMenu
: Link to another url.feretui.menus.ToolBarButtonMenu
: Simple button menuferetui.menus.ToolBarButtonsMenu
: Define a group of buttonsferetui.menus.ToolBarButtonUrlMenu
: Link to another url. in a button
Aside: rendere in the aside-menu page
feretui.menus.AsideMenu
: Simple menuferetui.menus.AsideHeaderMenu
: Display a title and take sub menu.feretui.menus.AsideUrlMenu
: Link to another url.
The helpers to register or get them are:
The client FeretUI add WTForm mecanism. The goal is to display easily formulaire in the pages and validate the entry in the actions.
To link the form with the translation and the bulma renderer you must inherit
feretui.form.FeretUIForm
.
If you need to register a password you must use the validator
feretui.form.Password
The resource is a set of page and form to represent a data and tools to manipulate this data.
feretui.resources.list.RResource
The client FeretUI add translation mechanism. This mecanism can be declared with addon’s name attribute. This attribute is used to extract the translation of FeretUI or an additionnal project. The translated object are:
To export the translation, the console script export-feretui-catalog extract all the translation messages in pot file.
from feretui import FeretUI, Session
myferet = FeretUI()
session = Session()
@route('an/url')
def do_something(request):
frequest = Request(
session=session,
method=Request.POST,
body=request.body.read(),
headers=dict(request.headers),
)
response = myferet.execute_action(frequest, 'action-arg1-arg2')
return response.body
feretui.feretui module¶
Module feretui.feretui.
A FeretUI instance represent one client. Each instance is a specific clent. Each client are isolated.
from feretui import FeretUI, Session, Request
myferet = FeretUI()
session = Session()
request = Request(session=session)
response = myferet.render(request)
The static files, themes and templates can be added:
directly in the client with
FeretUI.register_js()
,FeretUI.register_css()
,FeretUI.register_font()
,FeretUI.register_image()
,FeretUI.register_theme()
andFeretUI.register_template_file()
with the entry point.
The declaration of the entryt point is done in the pyproject.toml of your project
[project.entry-points."feretui.addons"] feretui = "feretui.feretui:import_feretui_addons"
the method call is
import_feretui_addons()
.
- class feretui.feretui.FeretUI(base_url: str = '/feretui', title: str = 'FeretUI')[source]¶
Feretui class.
Attributes¶
base_url[str] : The url for this client
title[str] : The title of the html head
jinja_env[Environment] : The environnement of jinja
template[:class: feretui.template.Template]: Templates load
statics[dict[str, str]]: The static filepath on server stored by name
css_import[list[str]] : List of the urls of the css to load
js_import[list[str]] : List of the urls of the script javascript to load
images[dict[str, str]] : List of the image and their url
themes[dict[str, str]] : List of the theme and their url
fonts[dict[str, str]] : List of the font and their url
actions[dict[str, Callable]] : List of the action callables
pages[dict[str, Callable]] : List of the pages
menus[dict[str,
feretui.menus.ToolBarMenu
]] : the key are left or right the value are instances of the menu.asides[dict[str,
feretui.menus.AsideMenu
]] : The key is the code for the aside-menu page, the values are the instance of the menu.resources[dict[str, :class:`feretui.resource.Resource]] : The key is the code of the resource and value the class.
The instance provide methodes to use
- TemplatingImport and get the template, need for display the client.
- Static filesDeclare static file to import in the client.
- ActionDeclare action called by the web server api.
- PageDeclare page called to render inside html body main
- MenuDeclare the menus registered in the feretui instance
Form : Declare the WTForm class in the feretui instance, need for the translation
- Resource: Declare the resource to CRUD
- TranslationsImport and export the catalog
- execute_action(request: Request, action_name: str) Response [source]¶
Execute a stored action.
Get and execute the action stored in the client. The parameters need for the good working of the action must be passed by the body or the querystring from the request.
request = Request(...) myferet.execute_action(request, 'my_action')
- Parameters:
request (
feretui.request.Request
) – The feretui request from api.action_name (str) – The name of the action
- Returns:
The result of the action
- Return type:
- export_catalog(output_path: str, version: str, addons: str | None = None) None [source]¶
Export the catalog at the POT format.
FeretUI.export_catalog( 'feretui/locale/feretui.pot', addons='feretui')
- Parameters:
output_path (str) – The path where write the catalog
version (str) – The version of the catalog
addons (str) – The addons where the message come from
Return the aside menus link with the code.
- Parameters:
code (str) – The code of the aside
- Returns:
The menus to render
- Return type:
- get_image_url(name: str) str [source]¶
Get the url for a picture.
- Parameters:
name (str) – The name of the picture
- Returns:
The url to get it
- Return type:
str
- get_page(pagename: str) Callable[[FeretUI, Session, dict], str] [source]¶
Return the page callable.
myferet.get_page('my-page')
- Parameters:
pagename (str) – The name of the page
- Returns:
the callable
- Return type:
Callable[ [
FeretUI
,feretui.session.Session
, dict], str]
- get_resource(code: str) Resource [source]¶
Return the resource instance.
- Parameters:
code (
feretui.resource.Resource
) – The code of the instance- Returns:
The instance of the resource
- Return type:
feretui.resource.Resource
- Exception:
- get_static_file_path(filename: str) str [source]¶
Get the path in the filesystem for static file name.
- Parameters:
name (str) – The name of the static
- Returns:
The filesystem path
- Return type:
str
- get_theme_url(session: Session) str [source]¶
Return the theme url in function of the session.
- Parameters:
feretui (
FeretUI
) – The instance of the clientsession (
feretui.session.Session
) – The session of the user.
- Returns:
the url to import stylesheep
- Return type:
str
- load_catalog(catalog_path: str, lang: str) None [source]¶
Load a specific catalog for a language.
- ::
FeretUI.load_catalog(‘feretui/locale/fr.po’, ‘fr’)
- Parameters:
catalog_path (str) – Path of the catalog
lang (str) – Language code
- load_internal_catalog(lang: str) None [source]¶
Load a specific catalog for a language defined by feretui.
- ::
FeretUI.load_internal_catalog(‘fr’)
- Parameters:
lang (str) – Language code
- register_action(function: Callable[[FeretUI, Request], Response]) Callable[[FeretUI, Request], Response] [source]¶
Register an action.
It is a Decorator to register an action need by the client or the final project.
The action is a callable with two params:
feretui [
FeretUI
] : The client instance.request [
feretui.request.Request
] : The request
@myferet.register_action def my_action(feretui, request): return Response(...)
- Parameters:
function (Callable[[
FeretUI
,feretui.request.Request
],feretui.response.Response
]) – The action callable to store- Returns:
The stored action callable
- Return type:
Callable[[
FeretUI
,feretui.request.Request
],feretui.response.Response
]
- register_addons_from_entrypoint() None [source]¶
Get the static from the entrypoints.
The declaration of the entryt point is done in the pyproject.toml of your project
[project.entry-points."feretui.addons"] feretui = "feretui.feretui:import_feretui_addons"
Here the method call is
import_feretui_addons()
.
Register a menu in an aside page.
myferet.register_aside_menus( 'my-aside', [ AsideMenu(...), ], )
- Parameters:
code (str) – The code of the aside
menus (list[
feretui.menus.AsideMenu
]) – The menus to registeraddons (str) – The addons where the message come from
- Exception:
Register the auth menus.
myferet.register_auth_menus([ ToolBarButtonMenu(...), ])
- Parameters:
menus (list[
feretui.menus.ToolBarButtonMenu
]) – The menus to registeraddons (str) – The addons where the message come from
- Exception:
- register_css(name: str, filepath: str, compress: bool = True) None [source]¶
Register a stylesheet file to import in the client.
- Parameters:
name (str) – name of the file see in the html url
filepath (str) – Path in server file system
compress (bool) – if True compress the csv
- register_font(name: str, filepath: str) None [source]¶
Register a theme file to use it in the client.
- Parameters:
name (str) – name of the font see in the html url
filepath (str) – Path in server file system
- register_form(addons: str | None = None) Callable [source]¶
Register a WTForm.
This a decorator.
@myferet.register_form() class MyForm(FeretUIForm): foo = StringField()
- Parameters:
addons (str) – The addons where the message come from
- register_image(name: str, filepath: str) None [source]¶
Register an image file to use it in the client.
- Parameters:
name (str) – name of the image see in the html url
filepath (str) – Path in server file system
- register_js(name: str, filepath: str) None [source]¶
Register a javascript file to import in the client.
- Parameters:
name (str) – name of the file see in the html url
filepath (str) – Path in server file system
- register_page(name: str | None = None, templates: Iterable[str] | None = None, forms: Iterable[FeretUIForm] | None = None, addons: str | None = None) Callable [source]¶
Register a page.
This is a decorator to register a page.
A page is a function :
Params
FeretUI
Session
dict
return the strof the html page
@myferet.register_page() def my_page(feretui, session, options): return ...
By default the name is the name of the decorated callable. but this nae can be overritting
@myferet.register_page(name='my_page') def _my_page(feretui, session, options): return ...
If need, the templates can be passed in the decorator and are added in the templates librairy
@myferet.register_page(template=[ ''' <template id="..."> ... </template> ''' ]) def my_page(feretui, session, options): return ...
You can register a WTForm
class MyForm(FeretUIForm): ... @myferet.register_page(forms=[MyForm]) def my_page(feretui, session, options): return ...
- Parameters:
name (str) – The name of the pages stored in FeretUI.pages
templates (list[str]) – The str of the template to load
forms – The WTForm to register at the same time
addons (str) – The addons where the message come from
- Returns:
Return a decorator
- Return type:
Callable
- register_resource(addons: str | None = None) None [source]¶
Register and build the resource instance.
myferet.register_resource( 'code of the resource', 'label', ) class MyResource(Resource): pass
- Parameters:
addons (str) – The addons where the message come from
- register_static_page(name: str, template: str, templates: Iterable[str] | None = None, addons: str | None = None) None [source]¶
Register a page.
This method register the page template and the callable to serve it without additionnal callable.
myferet.register_static_page('my-page', '<div>My Page</div>')
If need, the templates can be passed in the decorator and are added in the templates librairy
myferet.register_static_page( 'my-page', '<div>My Page</div>', template=[ ''' <template id="..."> ... </template> ''' ] )
- Parameters:
name (str) – The name of the pages stored in FeretUI.pages
templates (Iterable[str]) – The str of the additionnal templates to load
addons (str) – The addons where the message come from
- register_template_file(template_path: str, addons: str | None = None) None [source]¶
Import a template file in FeretUI.
The template file is imported in
feretui.template.Template
, and it is declared in theferetui.translation.Translation
.It is possible to load more than one template file.
myferet.register_template_file('path/of/template.tmpl')
- Parameters:
template_path (str) – The template file path to import the instance of FeretUI
addons (str) – The addons where the message come from
- register_template_from_str(template: str, addons: str | None = None) None [source]¶
Import a template string in FeretUI.
The template string is imported in
feretui.template.Template
, and it is declared in theferetui.translation.Translation
.It is possible to load more than one template string.
myferet.register_template_from_str(''' <template id="my-template"> ... </template> ''')
- Parameters:
template (str) – The template to import the instance of FeretUI
addons (str) – The addons where the message come from
- register_theme(name: str, filepath: str) None [source]¶
Register a theme file to use it in the client.
- Parameters:
name (str) – name of the theme see in the html url
filepath (str) – Path in server file system
Register a menu in the left part of the toolbar.
myferet.register_toolbar_left_menus([ ToolBarMenu(...), ])
- Parameters:
menus (list[
feretui.menus.ToolBarMenu
]) – The menus to registeraddons (str) – The addons where the message come from
- Exception:
Register a menu in the right part of the toolbar.
myferet.register_toolbar_right_menus([ ToolBarMenu(...), ])
- Parameters:
menus (list[
feretui.menus.ToolBarMenu
]) – The menus to registeraddons (str) – The addons where the message come from
- Exception:
Register a menu in the dropdown in the user menu.
myferet.register_user_menus([ ToolBarMenu(...), ])
- Parameters:
menus (list[
feretui.menus.ToolBarMenu
]) – The menus to registeraddons (str) – The addons where the message come from
- Exception:
- render(request: Request) Response [source]¶
Return the render of the main page.
- Parameters:
request – The feretui request
- Returns:
Return the html page athrough a feretui Response
- Return type:
- class:
feretui.response.Response
- render_template(session: Session, template_id: str, **kwargs) str [source]¶
Get a compiled template.
The compiled template from
feretui.template.Template
, This template is translated in function of the lang attribute of the session. All the named arguments is used by jinja librairy to improve the render.myferet.render_template(session, 'my-template')
The jinja render is done after the compilation of the template. Because the template is stored in function of the declared templates and the language. The jinja depend of the execution in function of the parameter and can be saved but recomputed at each call.
- Parameters:
session (
feretui.session.Session
) – The user feretui’s sessiontemplate_id (str) – The identify of the template
- Returns:
The compiled templated through
feretui.template.Template
and jinja- Return type:
str
feretui.request module¶
Module feretui.request.
It is the request object used by feretui. FeretUI can’t decode any request from any web-server.
The adapter to connect the web-server with this request must be write by another libray or by the developper.
Example with bottle:
from bottle import request, route
from feretui import FeretUI, Request, Session
myferet = FeretUI()
session = Session()
@route('/feretui/action/<action>', method=['GET', 'POST'])
def call_action(action):
frequest = Request(
method=getattr(Request, request.method),
querystring=request.query_string,
form=MultiDict(request.forms),
params=request.params.dict,
headers=dict(request.headers),
session=session,
)
res = myferet.do_action(frequest, action)
...
- class feretui.request.Request(session: Session | None = None, method: RequestMethod = POST, form: MultiDict | None = None, params: MultiDict | None = None, querystring: str | None = None, headers: dict[str, str] | None = None)[source]¶
Description of the request.
This object is just a description of the web-server request.
- Parameters:
session (Session) – User session
method (RequestMethod) – [Request.POST], the request method
form (MultiDict) – [None]
querystring (str) – [None]
params (dict) – [None]
headers (dict[str, str]) – [None]
- Exception:
- Exception:
- Exception:
- DELETE = DELETE¶
DELETE request method
- GET = GET¶
GET request method
- PATCH = PATCH¶
PATCH request method
- POST = POST¶
Post request method
- PUT = PUT¶
PUT request method
- get_base_url_from_current_url() dict[str, list[str]] [source]¶
Get the querystring from the current client URL.
- Returns:
The converted querystring.
- Return type:
dict[str, list[str]]
- get_query_string_from_current_url() dict[str, list[str]] [source]¶
Get the querystring from the current client URL.
- Returns:
The converted querystring.
- Return type:
dict[str, list[str]]
- get_url_from_dict(base_url: str = '/', querystring: dict[str, Any] | None = None) str [source]¶
Return an url.
The url is built in function the ain_url and the querystring.
- Parameters:
base_url (str) – [/], the base url before the querystring.
querystring (dict[str, Any]) – [None], the querystring.
- Returns:
Return the URL.
- Return type:
str
feretui.response module¶
Module feretui.response.
It is the response object used by feretui to return any result quering by the client.
This reponse can not be used directly by web serving. The adapter to connect the web-serving with this response must be write by another libray or by the developper.
Example with bottle:
from bottle import response, route
from feretui import FeretUI
myferet = FeretUI()
@route('/feretui/action/<action>', method=['GET', 'POST'])
def post_action(action):
...
res = myferet.do_action(frequest, action)
for k, v in res.headers.items():
response.set_header(k, v)
return res.body,
- class feretui.response.Response(body: str | None = '', status_code: int = 200, headers: dict[str, str] | None = None)[source]¶
Description of the response.
This object is just a description to inform the web-server library the return of FeretUI
from feretui import Response response = Response('<div>This is a template</div>')
- Parameters:
body (Any) – [‘’], response return to the web-serving.
status_code (int) – [200], the status code of the response.
headers (dict[str, str]) – Optionnal, additionnal headers.
feretui.session module¶
Module feretui.session.
This is a internal session, it represent the session of the web-server but with only the entry need by the client
The session can be overwritting by the developper:
from feretui import Session
session = Session()
- class feretui.session.Session(user: str | None = None, lang: str = 'en', theme: str = 'default', **kwargs: dict)[source]¶
Description of the session.
The session can be overwritting by the developper:
from feretui import Session class MySession(Session): pass
You should overwrite the methods to link the session with your user model.
Attributes¶
[user: str = None] : User name of the session
[lang: str = ‘en’] : The language use by the user session
[theme: str = ‘default’] : The ui theme use by the user session
- class LoginForm(*args, **kwargs)¶
WTform for the login.
- class SignUpForm(*args, **kwargs)¶
WTform for sign up.
- login(form: FeretUIForm) None [source]¶
Login.
- Parameters:
form – the WTForm object
- signup(form: FeretUIForm) bool [source]¶
Signup.
- Parameters:
form – the WTForm object
feretui.template module¶
Template behaviours.
The goal of this Templating is to give the templating modulare, overwritable, translable and cachable without complex behaviours.
The complex behaviours is given by jinja.
Each FeretUI instance have his own instance of Template class. The stored templates could be deferents.
The templates are declared in file and imported with
Template.load_file()
.
<templates>
<template id="my-template-1">
<div>My template</div>
</template>
<template id="my-template-2">
<div>My other template</div>
</template>
</templates>
It is possible to extend an existing template.
<template extend="my-template>
<!-- ... -->
</template>
It is possible to create a new template from an existing template.
<template id="my-new-template" extend="my-template>
<!-- ... -->
</template>
To modify a template with extend, use the tags include and xpath.
include : Include another template at this location
<template id="tmpl-a"> <!-- ... --> <include template="tmpl-b"></include> <!-- ... --> </template>
xpath insert: Insert in a tag path
<template extend="my-template"> <xpath expression=".//my-tag" type="insert"> <!-- ... --> </xpath> </template>
xpath insertBefore: Insert before the tag path
<template extend="my-template"> <xpath expression=".//my-tag" type="insertBefore"> <!-- ... --> </xpath> </template>
xpath insertAfter: Insert after the tag path
<template extend="my-template"> <xpath expression=".//my-tag" type="insertAfter"> <!-- ... --> </xpath> </template>
xpath replace: Replace the tag path
<template extend="my-template"> <xpath expression=".//my-tag" type="replace"> <!-- ... --> </xpath> </template>
xpath remove: Remove the tag path
<template extend="my-template"> <xpath expression=".//my-tag" type="remove"> </xpath> </template>
For the xpath the expression attribute use xpath of lxml.
Warning
The parser used to manipulate the html is lxml, the html must be parsed. So the jinja command must not break the parser.
- feretui.template.JINJA_REGEXES = ['\\{\\{ .* \\}\\}', '\\{% .* %\\}']¶
Regex to indicate if the text is a command jinja
- class feretui.template.Template(translation: Translation)[source]¶
html templating framework, the need is to manipulate web template.
tmpl = Template() tmpl.load_file(file_pointer_1) tmpl.load_file(file_pointer_2) tmpl.load_file(file_pointer_3) tmpl.load_file(file_pointer_N) tmpl.compîle()
Attributes¶
- known [dict]:
internal store of the raw templates and inherits.
- compiled [dict[lang: dict[id: HtmlElement]]]:
The compiled template, ready to use and store by lang.
- compiled_str [dict[lang: dict[encoding: dict[id: HtmlElement]]]]:
The compiled encoded template, ready to use and store by lang.
- translation [
feretui.translation.Translation
]: instance of the translation for this instance of Template
- translation [
- apply_xpath(description: XPathDescription, lang: str, name: str) None [source]¶
Apply the xpath from XPathDescription.
- Parameters:
description (
XPathDescription
) – The xpath descriptionlang (str) – The langage use for the include.
name (str) – The id of the template.
- Exception:
- compile(lang: str = 'en') None [source]¶
Compile all the templates for a specific lang.
- Parameters:
lang (str) – [en], The langage use for the include.
- compile_template(lang: str, name: str) HtmlElement [source]¶
Compile a specific template in function of the lang.
The compiled template is stored to get it quuickly at the next call.
- Parameters:
lang (str) – The langage use for the include.
name (str) – The id of the template.
- Returns:
The compiled template
- Return type:
- compile_template_i18n(tmpl: HtmlElement, action_callback: Callable[[str, str], None]) None [source]¶
Compile the translation for a node.
- Parameters:
tmpl (HtmlElement) – The node to translate.
action_callback (Callback[[str, str], None]) – The callback use to translate or to store in the catalog
- export_catalog(po: POFile) None [source]¶
Export the template translation in the catalog.
- Parameters:
po (PoFile) – The catalog from the
feretui.translation.Translation
.
- get_elements(lang: str, name: str) list[HtmlElement] [source]¶
Return the store templates for one id, and apply include on them.
- Parameters:
lang (str) – The langage use for the include.
name (str) – The id of the template.
- Returns:
The list of the templates
- Return type:
list[HtmlElement]
- get_template(name: str, lang: str = 'en', tostring: bool = True, encoding: str = 'unicode') HtmlElement | str [source]¶
Return a specific template.
- Parameters:
name (str) – name of the template to export
lang – [en] The template lang
tostring (bool) – [True] If True the template will be returned as a string.
encoding (str) – [unicode] The default encoding of the template when tostring is True
- Returns:
The compiled template in the defined lang.
- Return type:
HtmlElement or str
- get_translation(lang: str, name: str, text: str, suffix: str) str [source]¶
Get the translation.
- Parameters:
lang (str) – The langage use for the include.
name (str) – The id of the template.
text (str) – The default text to translate.
suffix (str) – suffix to put in the context
- Returns:
The translated message
- Return type:
str
- get_xpath(element: HtmlElement) list[XPathDescription] [source]¶
Find and return the xpath found in the template.
- Parameters:
element (HtmlElement) – The root node of the template
- Returns:
The xpath nodes description
- Return type:
list[XPathDescription]
- get_xpath_attributes(elements: list[HtmlElement]) list[dict[str, str]] [source]¶
Find and return the attibutes in the xpath.
- Parameters:
elements (list[HtmlElement]) – The node where are the attribute node
- Returns:
The list of the attibutes.
- Return type:
list[dict[str, str]]
- Exception:
- has_template(template_id: str) bool [source]¶
Return True if the template exist in the view.
- Parameters:
template_id (str) – the template id
- Returns:
bool.
- load_file(openedfile: IO, ignore_missing_extend: bool = False) None [source]¶
Load a file from the file descriptor.
File format
<templates> <template id="..."> ... </template> </templates>
- Parameters:
openedfile (IO) – file descriptor
ignore_missing_extend (bool) – [False] use in the case of the export the catalog. If True the missing extends are ignored.
- Exception:
- load_template(element: HtmlElement, ignore_missing_extend: bool = False) None [source]¶
Load one specific template.
- Parameters:
element (HtmlElement) – The element node to load.
ignore_missing_extend (bool) – [False] use in the case of the export the catalog. If True the missing extends are ignored.
- Exception:
- load_template_from_str(template: str) None [source]¶
Load a template from string.
- Parameters:
template (str) – The template to load.
- tostring(template: HtmlElement, encoding: str) str | bytes [source]¶
Return the template as a string.
- Parameters:
template (HtmlElement) – The template to convert to string
encoding (str) – The encoding use for the string
- Returns:
the template in string mode
- Return type:
bytes or str
- xpath(lang: str, name: str, expression: str, mult: bool) list[HtmlElement] [source]¶
Apply the xpath on template id and get nodes.
- Parameters:
lang (str) – lang for the translation
name (str) – The id of the template
expression (str) – xpath regex to find the good node
mult (bool) – if True the return will take only the first element in the list.
- Returns:
the nodes from xpath expression
- Return type:
list[HtmlElement]
- xpath_attributes(lang: str, name: str, expression: str, mult: bool, attributes: dict[str, str]) None [source]¶
Apply a xpath with action=”attributes”.
<template id="..." extend="other template"> <xpath expression="..." action="attributes"> <attribute key="value"/> <attribute foo="bar"/> </xpath> </template>
- Parameters:
lang (str) – lang for the translation
name (str) – The id of the template
expression (str) – xpath regex to find the good node
mult (bool) – If true, xpath can apply on all the element found
attributes (dict[str, str]) – attributes to apply
- xpath_insert_after(lang: str, name: str, expression: str, mult: bool, elements: list[HtmlElement]) None [source]¶
Apply a xpath with action=”insertAfter”.
<template id="..." extend="other template"> <xpath expression="..." action="insertAfter"> ... </xpath> </template>
- Parameters:
lang (str) – lang for the translation
name (str) – The id of the template
expression (str) – xpath regex to find the good node
mult (bool) – If true, xpath can apply on all the element found
elements (list[HtmlElement]) – children of the xpath to insert
- xpath_insert_before(lang: str, name: str, expression: str, mult: bool, elements: list[HtmlElement]) None [source]¶
Apply a xpath with action=”insertBefore”.
<template id="..." extend="other template"> <xpath expression="..." action="insertBefore"> ... </xpath> </template>
- Parameters:
lang (str) – lang for the translation
name (str) – The id of the template
expression (str) – xpath regex to find the good node
mult (bool) – If true, xpath can apply on all the element found
elements (list[HtmlElement]) – children of the xpath to insert
- xpath_insert_inside(lang: str, name: str, expression: str, mult: bool, elements: list[HtmlElement]) None [source]¶
Apply a xpath with action=”insertInside”.
<template id="..." extend="other template"> <xpath expression="..." action="insert"> ... </xpath> </template>
- Parameters:
lang (str) – lang for the translation
name (str) – The id of the template
expression (str) – xpath regex to find the good node
mult (bool) – If true, xpath can apply on all the element found
elements (list[HtmlElement]) – children of the xpath to insert
- xpath_remove(lang: str, name: str, expression: str, mult: bool) None [source]¶
Apply a xpath with action=”remove”.
<template id="..." extend="other template"> <xpath expression="..." action="remove"/> </template>
- Parameters:
lang (str) – lang for the translation
name (str) – The id of the template
expression (str) – xpath regex to find the good node
mult (bool) – If true, xpath can apply on all the element found
- xpath_replace(lang: str, name: str, expression: str, mult: bool, elements: list[HtmlElement]) None [source]¶
Apply a xpath with action=”replace”.
<template id="..." extend="other template"> <xpath expression="..." action="replace"> ... </xpath> </template>
- Parameters:
lang (str) – lang for the translation
name (str) – The id of the template
expression (str) – xpath regex to find the good node
mult (bool) – If true, xpath can apply on all the element found
elements (list[HtmlElement]) – children of the xpath to insert
- class feretui.template.XPathDescription(expression: str | None = None, mult: bool | None = None, action: str | None = None, elements: list[HtmlElement] | None = None)[source]¶
Xpath description object.
Attributes¶
expression: str, the xpath expression
mult: bool, If False, take only the first
action: str, The action to do in the xpath
elements: list[HtmlElement], the node in the xpath
- param expression:
the xpath expression
- type expression:
str
- param mult:
If False, take only the first
- type mult:
bool
- param action:
The action to do in the xpath
- type action:
str
- param elements:
the list of the node from the xpath
- type elements:
list[HtmlElement]
- feretui.template._minify_text_and_tail(el: Element) None [source]¶
Minimify the text and the tail of an etree.Element.
_minify_text_and_tail( etree.fromstring(''' <div> Minimify <strong> Me </strong> ! </div> ) ''') == Etree.fromstring( '<div>Minimify<strong>Me</strong>!</div>' )
- Parameters:
el (etree.Element) – The node to minimify.
feretui.actions module¶
Module feretui.actions.
The actions is called by the feretui.feretui.FeretUI.execute_action()
.
The availlable actions are:
- feretui.actions.goto(feretui: FeretUI, request: Request) str [source]¶
Render the page and change the url in the browser.
the page is an entry in the query string of the request.
If in-aside is in the querystring, It is mean that the page is rendering inside the page aside-menu and the url to push have to keep this information.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientrequest (
feretui.request.Request
) – The request
- Returns:
The page to display
- Return type:
- feretui.actions.login_password(feretui: FeretUI, request: Request) str [source]¶
Login the user.
Used the LoginForm passed in the request.session.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientrequest (
feretui.request.Request
) – The request
- Returns:
The page to display
- Return type:
- feretui.actions.login_signup(feretui: FeretUI, request: Request) str [source]¶
Signup actions.
Used the SignUpForm passed in the request.session.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientrequest (
feretui.request.Request
) – The request
- Returns:
The page to display
- Return type:
- feretui.actions.logout(feretui: FeretUI, request: Request) str [source]¶
Logout actions.
Used the SignUpForm passed in the request.session.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientrequest (
feretui.request.Request
) – The request
- Returns:
The page to display
- Return type:
- feretui.actions.resource(feretui: FeretUI, request: Request) str [source]¶
Resource entry point actions.
Used the SignUpForm passed in the request.session.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientrequest (
feretui.request.Request
) – The request
- Returns:
The page to display
- Return type:
feretui.pages module¶
Module feretui.pages.
The page is the html inside the main in the html body.
def my_page(feretui, session, options):
vals = {
...
}
return feretui.render_template(session, 'my-page', **vals)
The availlable pages are:
To protect them in function of the user see:
- func:
feretui.helper.page_for_authenticated_user_or_goto
- func:
feretui.helper.page_for_unauthenticated_user_or_goto
Return the aside_page in the aside_page.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The html page in
- Return type:
str
- Exception:
- feretui.pages.homepage(feretui: FeretUI, session: Session, options: dict) str [source]¶
Return the homepage.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The html page in
- Return type:
str
- feretui.pages.login(feretui: FeretUI, session: Session, options: dict) str [source]¶
Return the login form page.
If the user is already authenticated, the page will be mark as forbidden.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The html page in
- Return type:
str
- feretui.pages.page_404(feretui: FeretUI, session: Session, options: dict) str [source]¶
Return the page 404.
The page name is passed on the dict to display the good name to display.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The html page
- Return type:
str
- feretui.pages.page_forbidden(feretui: FeretUI, session: Session, options: dict) str [source]¶
Return the page forbidden.
The page name is passed on the dict to display the good name to display.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The html page
- Return type:
str
- feretui.pages.resource_page(feretui: FeretUI, session: Session, options: dict) str [source]¶
Return the resource page.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The html page in
- Return type:
str
- Exception:
- feretui.pages.signup(feretui: FeretUI, session: Session, options: dict) str [source]¶
Return the signup form page.
If the user is already authenticated, the page will be mark as forbidden.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The html page in
- Return type:
str
feretui.form module¶
Module feretui.form.
Addons for WTForms. The form is usefull to create a formular in a page.
The class FeretUIForm
are behaviour like:
the link with the feretui translation.
widget wrapper for renderer it with bulma class, with label in a field div.
The wrappers, excepted _no wrap()
, added behaviours in kwargs of
the __call__ method of the field:
readonly : Put the field in a readonly mode
no-label : Donc display the label but keep the bulma class in th field div
Added the also the validators
- class feretui.form.FeretUIForm(*args, **kwargs)[source]¶
Form base class.
The goal is to give at the Form used by FeretUI the behaviour like:
translation
bulma renderer
It is not required to used it. If the translation or the renderer is not automaticly done by FeretUI.
class MyForm(FeretUIForm): name = StringField()
- DEFAULT_WRAPPER(session: Session, field: Field, **kwargs: dict) Markup ¶
Render input field.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionfield (Field) – The field to validate
- Returns:
The renderer of the widget as html.
- Return type:
- class Meta[source]¶
Meta class.
Added * Translation * Bulma render
- bind_field(form: Form, unbound_field: UnboundField, options: dict) Field [source]¶
Bind the field to the form.
Added translation for the field
- get_translations(form: FeretUIForm) FormTranslations [source]¶
Return Translation class.
- Parameters:
form (
FeretUIForm
) – The form instance- Returns:
The translation class to link feretui translation.
- Return type:
- classmethod export_catalog(translation: Translation, po: POFile) None [source]¶
Export the Form translation in the catalog.
- Parameters:
translation (
Translation
) – The translation instance to add also inside it.po (PoFile) – The catalog instance
- class feretui.form.FormTranslations(form: FeretUIForm)[source]¶
Class who did the link between Form and FeretUI translations.
- class feretui.form.Password(min_size: int = 12, max_size: int | None = None, has_lowercase: bool = True, has_uppercase: bool = True, has_letters: bool = True, has_digits: bool = True, has_symbols: bool = True, has_spaces: bool = False)[source]¶
Password validator.
It is a generic validator for WTForms. It is based on the library password-validator.
class MyForm(Form): password = PasswordField(validators=[Password()])
- Parameters:
min_size (int) – The minimal size of the password. If None then no minimal size.
max_size (int) – The maximal size. If None then no maximal size.
has_lowercase (bool) – If True the password must have one or more lowercase. If False the password must not have any lowercase If None no rule on the lowercase
has_uppercase (bool) – If True the password must have one or more uppercase. If False the password must not have any uppercase If None no rule on the uppercase
has_letters (bool) – If True the password must have one or more letters. If False the password must not have any letters If None no rule on the letters
has_digits (bool) – If True the password must have one or more digits. If False the password must not have any digits If None no rule on the digits
has_symbols (bool) – If True the password must have one or more symbols. If False the password must not have any symbols If None no rule on the symbols
has_spaces (bool) – If True the password must have one or more spaces. If False the password must not have any spaces If None no rule on the spaces
- feretui.form.get_field_translations(form_cls: Form, unbound_field: UnboundField, options: dict, callback: Callable) tuple[tuple, dict] [source]¶
Find the attribute to translate and apply the callback.
- feretui.form.gettext(form: Form, string: str, context_suffix: str = '') str [source]¶
Translate the string.
- feretui.form.no_wrap(feretui: FeretUI, session: Session, field: Field, **kwargs: dict) Markup [source]¶
Render the field widget.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionfield (Field) – The field to validate
- Returns:
The renderer of the widget as html.
- Return type:
- feretui.form.wrap_bool(feretui: FeretUI, session: Session, field: Field, **kwargs: dict) Markup [source]¶
Render boolean field.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionfield (Field) – The field to validate
- Returns:
The renderer of the widget as html.
- Return type:
- feretui.form.wrap_input(feretui: FeretUI, session: Session, field: Field, **kwargs: dict) Markup [source]¶
Render input field.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionfield (Field) – The field to validate
- Returns:
The renderer of the widget as html.
- Return type:
- feretui.form.wrap_radio(feretui: FeretUI, session: Session, field: Field, **kwargs: dict) Markup [source]¶
Render radio field.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionfield (Field) – The field to validate
- Returns:
The renderer of the widget as html.
- Return type:
feretui.resources modules¶
Resource modules.
The resource is generally a set of views (page and form). This view construct the page and define the render and the action for the resource.
To help the contruction of the view some mixins exist:
The decorator feretui.feretui.FeretUI.register_resource()
call the
feretui.resources.resource.Resource.build()
method and register
the resource in feretui.
@myferet.register_resource()
class MyResource(LResource, Resource):
code = 'the identifier of the resource'
label = 'The label'
To add the resource in the toolbar menu, an attribute exist in the Resource class (only if build).
myferet.register_toolbar_left_menus([
MyResource.menu,
])
- class feretui.resources.LCRUDResource[source]¶
LCRUDResource class.
This class is a mixin, it inherit the mixins:
Module feretui.resource.
The main class to create a resource.
- class feretui.resources.resource.Resource[source]¶
Resource class.
- static action_security(func: Callable) Callable ¶
Raise an exception if the user is not authenticated.
It is a decorator
@myferet.register_action @action_for_authenticated_user def my_action(feretui, request): return Response(...)
- Returns:
a wrapper function:
- Return type:
Callable
- Exception:
ActionUserIsNotAuthenticatedError
- build_view(view_cls_name: str) View [source]¶
Return the view instance in fonction of the MetaView attributes.
- Parameters:
view_cls_name (str) – name of the meta attribute
- Returns:
An instance of the view
- Return type:
- export_catalog(translation: Translation, po: POFile) None [source]¶
Export the translations in the catalog.
- Parameters:
translation (
Translation
) – The translation instance to add also inside it.po (PoFile) – The catalog instance
- get_label(feretui: FeretUI, session: Session) str [source]¶
Return the translated label.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Session
- Return type:
str.
- get_meta_view_class(view_cls_name: str) list [source]¶
Return all the meta view class.
- Parameters:
view_cls_name (Class) – The name of the meta class
- Returns:
list of the class
- Return type:
list
- render(feretui: FeretUI, session: Session, options: dict) str [source]¶
Render the resource.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The html page in
- Return type:
str.
- router(feretui: FeretUI, request: Request) Response [source]¶
Resource entry point actions.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientrequest (
feretui.request.Request
) – The request
- Returns:
The page to display
- Return type:
Module feretui.responses.view.
The main class to construct a view
- class feretui.resources.view.View(resource: Resource)[source]¶
View class.
- export_catalog(translation: Translation, po: POFile) None [source]¶
Export the translations in the catalog.
- Parameters:
translation (
Translation
) – The translation instance to add also inside it.po (PoFile) – The catalog instance
- get_form_cls() FeretUIForm [source]¶
Return the Form for the view.
- get_label(feretui: FeretUI, session: Session) str [source]¶
Return the translated label.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Session
- Return type:
str.
- get_transition_url(feretui: FeretUI, options: dict, **kwargs: dict[str, str]) str [source]¶
Return the query string of a transition.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientoptions (dict) – the main query string
kwargs (dict) – the new entries
- Returns:
The querystring
- Return type:
str.
- goto(feretui: FeretUI, request: Request) Response [source]¶
Change the view type and renderer it.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientrequest (
feretui.request.Request
) – The request
- Returns:
The page to display
- Return type:
- render(feretui: FeretUI, session: Session, options: dict) str [source]¶
Render the view.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The html page in
- Return type:
str.
- feretui.resources.view.view_action_validator(methods: list[RequestMethod] | None = None) Callable [source]¶
Validate the action callback.
class MyView: @view_action_validator(methods=[RequestMethod.POST]) def my_action(self, feretui, request): return Response(...)
Note
The response of the callback must be a
feretui.response.Response
- Parameters:
methods (list[
feretui.request.RequestMethod
]) – The request methods of the action, if None the action can be called with any request method, else allow only the defined request methods.- Returns:
a wrapper function:
- Return type:
Callable
feretui.resources.common’s module.
- class feretui.resources.common.ActionsMixinForView(*args: tuple, **kwargs: dict)[source]¶
ActionsMixinForView class.
Render the actions buttons aside
- call(feretui: FeretUI, request: Request) Response [source]¶
Call a method on the resource.
Note
If the method called return None then the view is rerendering
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientrequest (
feretui.request.Request
) – The request
- Returns:
The page to display
- Return type:
- Exception:
ViewActionError
- export_catalog(translation: Translation, po: POFile) None [source]¶
Export the translations in the catalog.
- Parameters:
translation (
Translation
) – The translation instance to add also inside it.po (PoFile) – The catalog instance
- get_actions(feretui: FeretUI, session: Session, options: dict) list[Markup] [source]¶
Return the actionset list renderer.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The querystring
- Returns:
The html pages
- Return type:
list[str]
- get_call_kwargs(request: Request) dict [source]¶
Return the kwargs for the call with this view.
- Parameters:
request (
feretui.request.Request
) – request params- Returns:
the kwargs from params
- Return type:
dict
- class feretui.resources.common.LabelMixinForView[source]¶
LabelMixinForView class.
- export_catalog(translation: Translation, po: POFile) None [source]¶
Export the translations in the catalog.
- Parameters:
translation (
Translation
) – The translation instance to add also inside it.po (PoFile) – The catalog instance
- get_label(feretui: FeretUI, session: Session) str [source]¶
Return the translated label.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Session
- Return type:
str.
- class feretui.resources.common.MultiView(*args: tuple, **kwargs: dict)[source]¶
MultiView class.
Render the buttons for view multi.
- export_catalog(translation: Translation, po: POFile) None [source]¶
Export the translations in the catalog.
- Parameters:
translation (
Translation
) – The translation instance to add also inside it.po (PoFile) – The catalog instance
- filters(feretui: FeretUI, request: Request) Response [source]¶
Change the filters and rerender.
The type of modification of the filter depend of the request method:
POST : add a filter
DELETE : remove a filter
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientrequest (
feretui.request.Request
) – The request
- Returns:
The page to display
- Return type:
- get_actions(feretui: FeretUI, session: Session, options: dict) list[Markup] [source]¶
Return the actionset list renderer.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The querystring
- Returns:
The html pages
- Return type:
list[str]
- get_filter_cls() FeretUIForm [source]¶
Return the Filter Form for the view.
- get_header_buttons(feretui: FeretUI, session: Session, options: dict) list[Markup] [source]¶
Return the buttons for the multi view.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The html pages
- Return type:
list[Markup]
- goto_delete(feretui: FeretUI, request: Request) Response [source]¶
Goto the delete page.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientrequest (
feretui.request.Request
) – The request
- Returns:
The page to display
- Return type:
- pagination(feretui: FeretUI, request: Request) Response [source]¶
Change the pagination call by the resource router.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientrequest (
feretui.request.Request
) – The request
- Returns:
The page to display
- Return type:
- render_kwargs(feretui: FeretUI, session: Session, options: dict) dict [source]¶
Return the dict of parameter need for the muti view.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
the named attributes
- Return type:
dict
- class feretui.resources.common.TemplateMixinForView[source]¶
TemplateMixinForView class.
- compile(node: Element) Element [source]¶
Transform the template to add some javascript behaviours.
- Parameters:
node (HtmlElement) – The main node to transform
- Returns:
new node
- Return type:
- export_catalog(translation: Translation, po: POFile) None [source]¶
Export the translations in the catalog.
- Parameters:
translation (
Translation
) – The translation instance to add also inside it.po (PoFile) – The catalog instance
- get_compiled_template(feretui: FeretUI, session: Session, template_id: str) str [source]¶
Get the template for this view.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The feretui sessiontemplate_id (str) – The id of the template
- get_header_buttons(feretui: FeretUI, session: Session, options: dict) list[Markup] [source]¶
Return the buttons for the multi view.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The html pages
- Return type:
list[Markup].
- render(feretui: FeretUI, session: Session, options: dict) str [source]¶
Render the view.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The html page in
- Return type:
str.
- render_kwargs(feretui: FeretUI, session: Session, options: dict) dict [source]¶
Get kwarg of the view for render.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The kwargs
- Return type:
dict.
- set_body_template(feretui: FeretUI, session: Session, parent: Element) Element [source]¶
Add the body template.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The feretui sessionparent (HtmlElement) – The parent node
Add the footer template.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The feretui sessionparent (HtmlElement) – The parent node
- set_form_template(feretui: FeretUI, session: Session, parent: Element) Element [source]¶
Add the form node in the template.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The feretui sessionparent (HtmlElement) – The parent node
- set_header_template(feretui: FeretUI, session: Session, parent: Element) None [source]¶
Add the header template.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The feretui sessionparent (HtmlElement) – The parent node
feretui.resources.actions’s module.
Declare the actions.
- class feretui.resources.actions.Action(label: str, method: str, icon: str | None = None, description: str | None = None, visible_callback: Callable | None = None)[source]¶
Action class.
Define an action in actionset in the view meta.
- get_url(feretui: FeretUI, session: Session, options: dict) str [source]¶
Return the hx-post url.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui client instance.session (
feretui.session.Session
) – The session of the useroptions (dict) – The querystring
- Returns:
The html
- Return type:
Markup
- is_visible(session: Session) bool [source]¶
Return True is the action should be displayed.
- Parameters:
session (
feretui.session.Session
) – The session of the user- Return type:
bool
- render(feretui: FeretUI, session: Session, options: dict, resource_code: str, view_code: str) Markup [source]¶
Return the html of the action.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui client instance.session (
feretui.session.Session
) – The session of the useroptions (dict) – The querystring
- Returns:
The html
- Return type:
Markup
- class feretui.resources.actions.ActionI18nMixin[source]¶
Mixin to declare and get the translation.
- export_catalog(translation: Translation, po: POFile) None [source]¶
Export the menu translation in the catalog.
- Parameters:
translation (
Translation
) – The translation instance to add also inside it.po (PoFile) – The catalog instance
- class feretui.resources.actions.Actionset(label: str, actions: list[Action], icon: str | None = None, description: str | None = None)[source]¶
Actionset class.
The Actionset is a set of action with a label.
This need to group the action in the same place
- export_catalog(translation: Translation, po: POFile) None [source]¶
Export the translations in the catalog.
- Parameters:
translation (
Translation
) – The translation instance to add also inside it.po (PoFile) – The catalog instance
- is_visible(session: Session) bool [source]¶
Return True is the action should be displayed.
- Parameters:
session (
feretui.session.Session
) – The session of the user- Return type:
bool
- render(feretui: FeretUI, session: Session, options: dict, resource_code: str, view_code: str) Markup [source]¶
Return the html of the action.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui client instance.session (
feretui.session.Session
) – The session of the useroptions (dict) – The querystring
resource_code (str) – the code of the resource
view_code (str) – the code of the view
- Returns:
The html
- Return type:
Markup
- class feretui.resources.actions.GotoViewAction(label: str, view: str, icon: str | None = None, description: str | None = None, visible_callback: Callable | None = None)[source]¶
Action class.
Define an action in actionset in the view meta.
- get_url(feretui: FeretUI, session: Session, options: dict) str [source]¶
Return the hx-post url.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui client instance.session (
feretui.session.Session
) – The session of the useroptions (dict) – The querystring
- Returns:
The html
- Return type:
Markup
- class feretui.resources.actions.SelectedRowsAction(label: str, method: str, icon: str | None = None, description: str | None = None, visible_callback: Callable | None = None)[source]¶
SelectedRowsAction class.
This action is not disabled when an entry is selected.
Module feretui.resources.list.
The List resource represent data under html table.
myferet.register_resource(
)
class MyResource(LResource, Resource):
code = 'code of the resource',
label = 'label',
class MetaViewList:
pass
- class feretui.resources.list.LResource[source]¶
LResource class.
- MetaViewList¶
alias of
DefaultViewList
- build_view(view_cls_name: str) Resource [source]¶
Return the view instance in fonction of the MetaView attributes.
- Parameters:
view_cls_name (str) – name of the meta attribute
- Returns:
An instance of the view
- Return type:
- filtered_reads(form_cls: FeretUIForm, filters: list[tuple[str, list[str]]], offset: int, limit: int) dict [source]¶
Return the dataset of the list.
should return a dict with 2 key * forms: list of instance of form_cls * total: number of the exisinting entries without offset and limit
Warning
must be overwriting
- Parameters:
form_cls (
feretui.form.FeretUIForm
) – Form of the list viewfilters (list[tuple[str, list[str]]]) – The filters choosen in the list
offset (int) – The start of the plage of the dataset
limit (int) – The size of the plage of the dataset
- Returns:
the dataset
- Return type:
dict
- class feretui.resources.list.ListView(*args: tuple, **kwargs: dict)[source]¶
List view.
- render(feretui: FeretUI, session: Session, options: dict) str [source]¶
Render the view.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The html page in
- Return type:
str.
Module feretui.resources.list.
The List resource represent data under html table.
myferet.register_resource()
class MyResource(CResource, Resource):
code = 'code of the resource',
label = 'label',
class MetaViewCreate:
pass
- class feretui.resources.create.CResource[source]¶
CResource class.
- MetaViewCreate¶
alias of
DefaultViewCreate
- build_view(view_cls_name: str) Resource [source]¶
Return the view instance in fonction of the MetaView attributes.
- Parameters:
view_cls_name (str) – name of the meta attribute
- Returns:
An instance of the view
- Return type:
- create(form: FeretUIForm) str [source]¶
Create an object from the form and return the primary key.
Warning
must be overwriting
- Parameters:
form (
feretui.form.FeretUIForm
) – The instance of Form- Returns:
The primary key
- Return type:
str
- class feretui.resources.create.CreateView(resource: Resource)[source]¶
Create view.
- get_header_buttons(feretui: FeretUI, session: Session, options: dict) list[Markup] [source]¶
Return the buttons for the multi view.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The html pages
- Return type:
list[Markup]
- render_kwargs(feretui: FeretUI, session: Session, options: dict) dict [source]¶
Get kwarg of the view for render.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The kwargs
- Return type:
dict.
- save(feretui: FeretUI, request: Request) Response [source]¶
Change the pagination call by the resource router.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientrequest (
feretui.request.Request
) – The request
- Returns:
The page to display
- Return type:
- set_form_template(feretui: FeretUI, session: Session, parent: Element) Element [source]¶
Add the form node in the template.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionparent (HtmlElement) – The parent node
Module feretui.resources.list.
The List resource represent data under html table.
myferet.register_resource()
class MyResource(RResource, Resource):
code = 'code of the resource',
label = 'label',
class MetaViewRead:
pass
- class feretui.resources.read.RResource[source]¶
RResource class.
- MetaViewRead¶
alias of
DefaultViewRead
- build_view(view_cls_name: str) Resource [source]¶
Return the view instance in fonction of the MetaView attributes.
- Parameters:
view_cls_name (str) – name of the meta attribute
- Returns:
An instance of the view
- Return type:
- read(form_cls: FeretUIForm, pk: str) FeretUIForm [source]¶
Return an intance of the form.
Warning
must be overwriting
- Parameters:
form_cls (
feretui.form.FeretUIForm
) – Form of the list viewpk (str) – The primary key
- Returns:
the form instance
- class feretui.resources.read.ReadView(*args: tuple, **kwargs: dict)[source]¶
Read view.
- get_header_buttons(feretui: FeretUI, session: Session, options: dict) list[Markup] [source]¶
Return the buttons for the multi view.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The html pages
- Return type:
list[Markup]
- render_kwargs(feretui: FeretUI, session: Session, options: dict) dict [source]¶
Get kwarg of the view for render.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The kwargs
- Return type:
dict.
- set_body_template(feretui: FeretUI, session: Session, form: Element) None [source]¶
Add the body template.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionparent (HtmlElement) – The parent node
Module feretui.resources.list.
The List resource represent data under html table.
myferet.register_resource()
class MyResource(CResource, Resource):
code = 'code of the resource',
label = 'label',
class MetaViewCreate:
pass
- class feretui.resources.update.EditView(resource: Resource)[source]¶
Create view.
- get_header_buttons(feretui: FeretUI, session: Session, options: dict) list[Markup] [source]¶
Return the buttons for the multi view.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The html pages
- Return type:
list[Markup]
- render_kwargs(feretui: FeretUI, session: Session, options: dict) dict [source]¶
Get kwarg of the view for render.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The kwargs
- Return type:
dict.
- save(feretui: FeretUI, request: Request) Response [source]¶
Change the pagination call by the resource router.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientrequest (
feretui.request.Request
) – The request
- Returns:
The page to display
- Return type:
- set_form_template(feretui: FeretUI, session: Session, parent: Element) Element [source]¶
Add the form node in the template.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionparent (HtmlElement) – The parent node
- class feretui.resources.update.UResource[source]¶
UResource class.
- MetaViewUpdate¶
alias of
DefaultViewUpdate
- build_view(view_cls_name: str) Resource [source]¶
Return the view instance in fonction of the MetaView attributes.
- Parameters:
view_cls_name (str) – name of the meta attribute
- Returns:
An instance of the view
- Return type:
- read(form_cls: FeretUIForm, pk: str) FeretUIForm [source]¶
Return an intance of the form.
Warning
must be overwriting
- Parameters:
form_cls (
feretui.form.FeretUIForm
) – Form of the list viewpk (str) – The primary key
- Returns:
the form instance
- update(forms: list[FeretUIForm]) None [source]¶
Update an object from the form.
Warning
must be overwriting
- Parameters:
form (
feretui.form.FeretUIForm
) – The instance of Form
Module feretui.resources.list.
The List resource represent data under html table.
DreateView
myferet.register_resource()
class MyResource(DResource, Resource):
code = 'code of the resource',
label = 'label',
class MetaViewDelete:
pass
- class feretui.resources.delete.DResource[source]¶
DResource class.
- MetaViewDelete¶
alias of
DefaultViewDelete
- class feretui.resources.delete.DeleteView(resource: Resource)[source]¶
Delete view.
- delete(feretui: FeretUI, request: Request) Response [source]¶
Change the pagination call by the resource router.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientrequest (
feretui.request.Request
) – The request
- Returns:
The page to display
- Return type:
- get_header_buttons(feretui: FeretUI, session: Session, options: dict) list[Markup] [source]¶
Return the buttons for the multi view.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The html pages
- Return type:
list[Markup]
- render_kwargs(feretui: FeretUI, session: Session, options: dict) dict [source]¶
Get kwarg of the view for render.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionoptions (dict) – The options come from the body or the query string
- Returns:
The kwargs
- Return type:
dict.
- set_form_template(feretui: FeretUI, session: Session, parent: Element) Element [source]¶
Add the form node in the template.
- Parameters:
feretui (
feretui.feretui.FeretUI
) – The feretui clientsession (
feretui.session.Session
) – The Sessionparent (HtmlElement) – The parent node
feretui.helper module¶
Module feretui.helper.
The helper is function to help the integration of the client in an another project.
action_validator()
: Decorator to validate the call of the action callbackaction_for_authenticated_user()
: The action can be call only by the authenticated useraction_for_unauthenticated_user()
: The action can be call only by the unauthenticated userpage_for_authenticated_user_or_goto()
: Decorator to protect the accebility of one page, and allow this page only for a user.page_for_unauthenticated_user_or_goto()
: Decorator to protect the accebility of one page, and allow this page only if the user is not authenticated.menu_for_authenticated_user()
: Callback to return if the user is authenticated.menu_for_unauthenticated_user()
: Callback to return if the user is authenticated.
- feretui.helper.action_for_authenticated_user(func: Callable) Callable [source]¶
Raise an exception if the user is not authenticated.
It is a decorator
@myferet.register_action @action_for_authenticated_user def my_action(feretui, request): return Response(...)
- Returns:
a wrapper function:
- Return type:
Callable
- Exception:
ActionUserIsNotAuthenticatedError
- feretui.helper.action_for_unauthenticated_user(func: Callable) Callable [source]¶
Raise an exception if the user is authenticated.
It is a decorator
@myferet.register_action @action_for_unauthenticated_user def my_action(feretui, request): return Response(...)
- Returns:
a wrapper function:
- Return type:
Callable
- Exception:
ActionUserIsAuthenticatedError
- feretui.helper.action_validator(methods: list[RequestMethod] | None = None) Callable [source]¶
Validate the action callback.
@myferet.register_action @action_validator(methods=[RequestMethod.POST]) def my_action(feretui, request): return Response(...)
Note
The response of the callback must be a
feretui.response.Response
- Parameters:
methods (list[
feretui.request.RequestMethod
]) – The request methods of the action, if None the action can be called with any request method, else allow only the defined request methods.- Returns:
a wrapper function:
- Return type:
Callable
Return True if the user is authenticated.
See the
feretui.menus.Menu
- Parameters:
session (
feretui.session.Session
) – The user session- Returns:
True if the user is authenticated
- Return type:
bool
Return True if the user is not authenticated.
See the
feretui.menus.Menu
- Parameters:
session (
feretui.session.Session
) – The user session- Returns:
True if the user is not authenticated
- Return type:
bool
- feretui.helper.page_for_authenticated_user_or_goto(fallback_page: str | Callable) Callable [source]¶
Display the decorated page if the user is authenticated.
In the case or the user is not autenticated. The returned page is the fallback page.
@page_for_authenticated_user_or_goto('404') def my_page(myferet, session, options): ...
- Parameters:
fallback_page (str or the callable page) – The page if the user is not authenticated
- Returns:
a decorator
- Return type:
Callable
- feretui.helper.page_for_unauthenticated_user_or_goto(fallback_page: str | Callable) Callable [source]¶
Display the decorated page if the user is not authenticated.
In the case or the user is autenticated. The returned page is the fallback page.
@page_for_unauthenticated_user_or_goto('forbidden') def my_page(myferet, session, options): ...
- Parameters:
fallback_page (str or the callable page) – The page if the user is authenticated
- Returns:
a decorator
- Return type:
Callable
feretui.thread module¶
feretui.translation module¶
Module feretui.translation.
The translation mechanism is used to translate the user interface.
The translation files is store in po file. To translate the pot in each language with PoEdit.
The translated object are:
The Translation class have two methods to manipulate the catalogs:
Translation.export_catalog()
: Export the catalog at a path for a specific addonsTranslation.load_catalog()
: Load catalog for a specific lang
- class feretui.translation.TranslatedFileTemplate(template_path: str, addons: str = 'feretui')[source]¶
TranslatedFileTemplate class.
Declare a template file as translatable. The instance is used to defined the template files where take the entries to export in the catalog
mytranslation = TranslatedFileTemplate( 'path/of/the/teplate', 'my.addons' ) translation.add_translated_template(mytranslation)
To declare a TranslatedFileTemplate more easily, a helper exist on FeretUI
feretui.feretui.FeretUI.import_templates_file()
.Attributes¶
[path:str] : the template file path
[addons:str] : the addons of the template file
- param template_path:
the template file path
- type template_path:
str
- param addons:
The addons where the message come from
- type addons:
str
- load(template: Template) None [source]¶
Load the template in the template instance.
- Parameters:
template (
feretui.template.Template
) – template instance
- class feretui.translation.TranslatedForm(form: FeretUIForm, addons: str = 'feretui')[source]¶
TranslatedForm class.
Declare a WTForm as translatable.
mytranslatedmenu = TranslatedForm(MyForm, 'my.addons') translation.add_translated_form(mytranslation)
To declare a TranslatedForm more easily, The helpers exist on FeretUI :
Attributes¶
[form:FeretUIForm] : the form to translated
[addons:str] : the addons of the template file
- param form:
the form class to translate
- type form:
- param addons:
The addons where the message come from
- type addons:
str
- export_catalog(translation: Translation, po: POFile) None [source]¶
Export the form translations in the catalog.
- Parameters:
translation (
Translation
) – The translation instance to add also inside it.po (PoFile) – The catalog instance
- class feretui.translation.TranslatedMenu(menu: Menu, addons: str = 'feretui')[source]¶
TranslatedMenu class.
Declare a menu as translatable. The instance is used to defined the menu targeted to be exported in the catalog
mytranslatedmenu = TranslatedMenu(mymenu, 'my.addons') translation.add_translated_menu(mytranslation)
To declare a TranslatedMenu more easily, The helpers exist on FeretUI :
Attributes¶
[menu:Menu] : the menu to translated
[addons:str] : the addons of the template file
- param menu:
the menu to translate
- type menu:
- param addons:
The addons where the message come from
- type addons:
str
- export_catalog(translation: Translation, po: POFile) None [source]¶
Export the menu translation in the catalog.
- Parameters:
translation (
Translation
) – The translation instance to add also inside it.po (PoFile) – The catalog instance
- class feretui.translation.TranslatedResource(resource: Resource, addons: str = 'feretui')[source]¶
TranslatedForm class.
Declare a resource as translatable.
MyResource.build() myresource = MyResource('Code', 'The label') translation.add_translated_resource(myresource)
To declare a TranslatedForm more easily, The helpers exist on FeretUI :
Attributes¶
[resource:Resource] : the resource to translated
[addons:str] : the addons of the template file
- param resource:
the resource instance to translate
- type resource:
feretui.resource.Resource
- param addons:
The addons where the message come from
- type addons:
str
- export_catalog(translation: Translation, po: POFile) None [source]¶
Export the resource translations in the catalog.
- Parameters:
translation (
Translation
) – The translation instance to add also inside it.po (PoFile) – The catalog instance
- class feretui.translation.TranslatedStringTemplate(template: str, addons: str = 'feretui')[source]¶
TranslatedStringTemplate class.
Declare a template str as translatable. The instance is used to defined the template str where take the entries to export in the catalog
mytranslation = TranslatedStringTemplate( ''' <template id="my-teplate"> ... </template> ''', 'my.addons' ) translation.add_translated_template(mytranslation)
To declare a TranslatedStringTemplate more easily, a helper exist on FeretUI
feretui.feretui.FeretUI.register_page()
.Attributes¶
[path:str] : the template file path
[addons:str] : the addons of the template file
- param template_path:
the template file path
- type template_path:
str
- param addons:
The addons where the message come from
- type addons:
str
- load(template: Template) None [source]¶
Load the template in the template instance.
- Parameters:
template (
feretui.template.Template
) – template instance
- class feretui.translation.TranslatedTemplate(addons: str = 'feretui')[source]¶
TranslatedTemplate class.
Declare a template. The instance is used to defined the template files where take the entries to export in the catalog
mytranslation = TranslatedTemplate('my.addons') Translation.add_translated_template(mytranslation)
Attributes¶
[addons:str] : the addons of the template file
- param addons:
The addons where the message come from
- type addons:
str
- load(template: Template) None [source]¶
Load the template in the template instance.
- Parameters:
template (
feretui.template.Template
) – template instance- Exceptions:
TranslationError
- class feretui.translation.Translation(feretui: FeretUI)[source]¶
Translation class.
This class is used to manipulate translation.
Warning
The behaviour work with thread local
- add_translated_form(form: TranslatedForm) None [source]¶
Add in forms a TranslatedForm.
- Parameters:
form (
TranslatedForm
) – The Form.
Add in menus a TranslatedMenu.
- Parameters:
menu (
TranslatedMenu
) – The menu.
- add_translated_resource(resource: TranslatedResource) None [source]¶
Add in forms a TranslatedResource.
- Parameters:
resource (
TranslatedResource
) – The resource instance.
- add_translated_template(template: TranslatedTemplate) None [source]¶
Add in templates a TranslatedTemplate.
- Parameters:
template (
TranslatedTemplate
) – The template.
- define(context: str, message: str) POEntry [source]¶
Create a POEntry for a message.
- Parameters:
context (str) – The context in the catalog
message (str) – The original message
- Returns:
The poentry
- Return type:
- export_catalog(output_path: str, version: str, addons: str | None = None) None [source]¶
Export a catalog template.
- Parameters:
output_path (str) – The path where write the catalog
version (str) – The version of the catalog
addons (str) – The addons where the message come from
- get(lang: str, context: str, message: str, message_as_default: bool = True) str [source]¶
Get the translated message from translations.
- Parameters:
lang (str) – The language code
context (str) – The context in the catalog
message (str) – The original message
message_as_default (bool) – If True then when no translation is found it is return the message else return None
- Returns:
The translated message
- Return type:
str
- has_lang(lang: str) bool [source]¶
Return True the lang is declared.
- Parameters:
lang (str) – The language tested
- Returns:
The verification
- Return type:
bool
feretui.exceptions module¶
Module feretui.exceptions.
Get the exceptions known by FeretUI:
- exception feretui.exceptions.ActionAuthenticationError[source]¶
Exception raised by action mecanism in FeretUI object.
Inherits
ActionError
.
- exception feretui.exceptions.ActionError[source]¶
Exception raised by action mecanism in FeretUI object.
Inherits
FeretUIError
.
- exception feretui.exceptions.ActionUserIsAuthenticatedError[source]¶
Exception raised by action mecanism in FeretUI object.
Inherits
ActionAuthenticationError
.
- exception feretui.exceptions.ActionUserIsNotAuthenticatedError[source]¶
Exception raised by action mecanism in FeretUI object.
Inherits
ActionAuthenticationError
.
- exception feretui.exceptions.ActionValidatorError[source]¶
Exception raised by action mecanism in FeretUI object.
Inherits
ActionError
.
- exception feretui.exceptions.MenuError[source]¶
Exception raised by menu mecanism in FeretUI object.
Inherits
FeretUIError
.
- exception feretui.exceptions.PageError[source]¶
Exception raised by page mecanism in FeretUI object.
Inherits
FeretUIError
.
- exception feretui.exceptions.RequestError[source]¶
Exception raised by Request object.
Inherits
FeretUIError
.
- exception feretui.exceptions.RequestFormError[source]¶
Exception raised by Request object.
Inherits
RequestError
.
- exception feretui.exceptions.RequestNoSessionError[source]¶
Exception raised by Request object.
Inherits
RequestSessionError
.
- exception feretui.exceptions.RequestSessionError[source]¶
Exception raised by Request object.
Inherits
RequestError
.
- exception feretui.exceptions.RequestWrongSessionError[source]¶
Exception raised by Request object.
Inherits
RequestSessionError
.
- exception feretui.exceptions.ResourceError[source]¶
Exception raised by resource mecanism in FeretUI object.
Inherits
FeretUIError
.
- exception feretui.exceptions.TemplateError[source]¶
Exception raised by Template object.
Inherits
FeretUIError
.
- exception feretui.exceptions.TranslationError[source]¶
Exception raised by Translation object.
Inherits
FeretUIError
.
- exception feretui.exceptions.TranslationFormError[source]¶
Exception raised by Translation object.
Inherits
TranslationError
.
- exception feretui.exceptions.TranslationMenuError[source]¶
Exception raised by Translation object.
Inherits
TranslationError
.
- exception feretui.exceptions.TranslationResourceError[source]¶
Exception raised by Translation object.
Inherits
TranslationError
.
- exception feretui.exceptions.UnexistingActionError[source]¶
Exception raised by action mecanism in FeretUI object.
Inherits
ActionError
.
- exception feretui.exceptions.UnexistingResourceError[source]¶
Exception raised by resource mecanism in FeretUI object.
Inherits
ResourceError
.
- exception feretui.exceptions.ViewActionError[source]¶
Exception raised by resource mecanism in FeretUI object.
Inherits
ViewError
.
- exception feretui.exceptions.ViewError[source]¶
Exception raised by resource mecanism in FeretUI object.
Inherits
ResourceError
.