Bloks

Blok furetui

class anyblok_furetui.furetui.FuretUIBlok(registry)

Bases: anyblok.blok.Blok

Setup FuretUI for AnyBlok

author = 'Suzanne Jean-Sébastien'
conditional_by = []
conflicting_by = []
furetui = {'i18n': {'en': {'components': {'fields': {'common': {'required': 'This is a required field'}, 'json': {'invalid': 'Json is invalid'}, 'relationship': {'no_more': 'No more datas found.', 'not_found': 'No data found with current filter.'}, 'yesno': {'no': 'No', 'yes': 'Yes'}}, 'header': {'apply': 'Apply', 'browse': 'Browse', 'cancel': 'Cancel', 'created': 'Created', 'delete': 'Delete', 'deleted': 'Deleted', 'edit': 'Edit', 'linked': 'Linked', 'new': 'New', 'next': 'Next', 'notFound': 'No result found', 'previous': 'Previous', 'return': 'Return', 'save': 'Save', 'search': 'Search', 'total': 'Total', 'unlinked': 'Unlinked', 'updated': 'Updated'}, 'login': {'appbar': 'Log in', 'button': 'Log in', 'password': 'Password', 'username': 'User name'}, 'logout': {'button': 'Log out'}}, 'error': 'Errors'}, 'fr': {'components': {'fields': {'common': {'required': 'Ce champ est requis'}, 'json': {'invalid': 'Ce Json est invalide'}, 'relationship': {'no_more': 'Tous les résultats sont trouvés.', 'not_found': 'Aucun résultat.'}, 'yesno': {'no': 'Non', 'yes': 'Oui'}}, 'header': {'apply': 'Appliquer', 'browse': 'Parcourir', 'cancel': 'Annuler', 'created': 'Créé', 'delete': 'Supprimer', 'deleted': 'Supprimé', 'edit': 'Modifier', 'linked': 'lié', 'new': 'Créer', 'next': 'Suivant', 'notFound': 'Aucun résultat', 'previous': 'Précédant', 'return': 'Retour', 'save': 'Sauver', 'search': 'Rechercher', 'total': 'Total', 'unlinked': 'délié', 'updated': 'Modifié'}, 'login': {'appbar': 'Se connecter', 'button': 'Se connecter', 'password': 'Mot de passe', 'username': 'Identifiant'}, 'logout': {'button': 'Se déconnecter'}}, 'error': 'Erreurs'}}, 'templates': []}
classmethod import_declaration_module()

Do the python import for the Declaration of the model or other

load()

Called on start / launch

logo = 'static/images/logo.png'
name = 'furetui'
optional_by = []
priority = 1
classmethod pyramid_load_config(config)
classmethod reload_declaration_module(reload)
required = ['anyblok-core', 'pyramid', 'anyblok-io']
required_by = ['furetui-address', 'furetui-auth', 'furetui-delivery', 'furetui-filter-ip']
version = '0.0.1'

API : Models

Core

class anyblok_furetui.furetui.core.SqlMixin

Bases: object

classmethod default_values(request=None, authenticated_userid=None, resource=None, uuid=None)

This method aims to be called by client on model before creating a new object to define it’s default values.

It return a dict with default values.

exposed_method defined with the arguments {exposed_kwargs:r}

class anyblok_furetui.furetui.core.SqlBase

Bases: anyblok_furetui.furetui.core.SqlMixin

Blok furetui-auth

class anyblok_furetui.auth.FuretUIAuthBlok(registry)

Bases: anyblok.blok.Blok, anyblok_io.blok.BlokImporter

author = 'Suzanne Jean-Sébastien'
conditional_by = []
conflicting_by = []
furetui = {'i18n': {'en': {'language': {'en': 'English', 'fr': 'French'}, 'menu': {'settings': {'auth': {'role': 'Roles', 'title': 'Authentication and authorization', 'user': 'Users'}}}, 'space': {'settings': {'description': 'Global setting of the application', 'title': 'Settings'}}}, 'fr': {'language': {'en': 'English', 'fr': 'French'}, 'menu': {'settings': {'auth': {'role': 'Roles', 'title': 'Authentifiation et permissions', 'user': 'Utilisateur'}}}, 'space': {'settings': {'description': "Configuration de l'application", 'title': 'Configuration'}}}}, 'templates': ['templates/user.tmpl', 'templates/role.tmpl']}
classmethod import_declaration_module()

Do the python import for the Declaration of the model or other

logo = 'static/images/logo.png'
name = 'furetui-auth'
optional_by = []
classmethod reload_declaration_module(reload)
required = ['anyblok-core', 'pyramid', 'furetui', 'anyblok-io-xml', 'auth', 'auth-password', 'authorization']
required_by = []
update(latest)

Called on install or update

Parameters:latest_version – latest version installed, if the blok has never been installed, latest_version is None
update_admin_role()
version = '0.0.1'

Blok furetui-address

Blok declaration example

class anyblok_furetui.address.FuretUIAddressBlok(registry)

Bases: anyblok.blok.Blok, anyblok_io.blok.BlokImporter

Workshop’s Blok class definition

author = 'Your name'
conditional_by = []
conflicting_by = []
furetui = {'i18n': {'en': {'resource': {'address': {}}}, 'fr': {'resource': {'address': {'first_name': 'First name', 'last_name': 'Last name'}}}}, 'templates': ['templates/address.tmpl']}
name = 'furetui-address'
optional_by = []
required = ['anyblok-core', 'furetui', 'address']
required_by = []
update(latest)

Called on install or update

Parameters:latest_version – latest version installed, if the blok has never been installed, latest_version is None
version = '0.1.0'

Blok furetui-delivery

Blok declaration example

class anyblok_furetui.delivery.FuretUIDeliveryBlok(registry)

Bases: anyblok.blok.Blok, anyblok_io.blok.BlokImporter

Workshop’s Blok class definition

author = 'Your name'
conditional_by = []
conflicting_by = []
furetui = {'i18n': {'en': {'resource': {'delivery': {'shipment': {'reason': 'Reason', 'tracking_number': 'Tracking number', 'uuid': 'UUID'}}}}, 'fr': {'resource': {'delivery': {'shipment': {'reason': 'Raison', 'tracking_number': 'Numéro de suivi', 'uuid': 'UUID'}}}}}, 'templates': ['templates/delivery.tmpl']}
name = 'furetui-delivery'
optional_by = []
required = ['anyblok-core', 'furetui', 'delivery']
required_by = []
update(latest)

Called on install or update

Parameters:latest_version – latest version installed, if the blok has never been installed, latest_version is None
version = '0.1.0'

Blok furetui-filter-ip

class anyblok_furetui.ip.FuretUIFilterIPBlok(registry)

Bases: anyblok.blok.Blok

Added security validation for client IP

The goal is to allowed some ip to access of anyblok resource

author = 'Suzanne Jean-Sébastien'
conditional_by = []
conflicting_by = []
classmethod import_declaration_module()

Do the python import for the Declaration of the model or other

load()

Called on start / launch

logo = 'static/images/logo.png'
name = 'furetui-filter-ip'
optional_by = []
classmethod reload_declaration_module(reload)
required = ['anyblok-core', 'pyramid', 'furetui']
required_by = []
version = '0.0.1'

To improve security you mai added in the configuration’s file furetui_authorized_networks, it is a list of ip areas

API : Models

class anyblok_furetui.ip.furetui.FuretUI

Bases: object

Improve security

classmethod check_security(request)
classmethod define_authorized_ips()

Fill the class attribute IPS with the ip areas