commons¶
filters module¶
Jinja2 additionnal filters
-
extrapypi.commons.filters.
tohtml
(s)¶ Convert rst string to raw html
Used for display long description of releases
login module¶
Module handling all Flask-Login logic and handlers
-
extrapypi.commons.login.
load_user_from_request
(request)¶ Used to identify a request from pip or twine when downloading / uploading packages and releases
-
extrapypi.commons.login.
on_identity_loaded
(sender, identity)¶ Load rights for flask-principal
Handle only role need and user need
-
extrapypi.commons.login.
user_loader
(user_id)¶ Default user handler, from Flask-Login documentation
packages module¶
Packages utils.
This module export packages logic outside of the views
-
extrapypi.commons.packages.
create_package
(name, summary, store)¶ Create a package for a given release if the package don’t exists already
Note
Maintainer and installer cannot create packages
Parameters: - data (dict) – request data to use to create package
- storage (extrapypi.storage.BaseStorage) – storage object to use
Raises: PermissionDenied
-
extrapypi.commons.packages.
create_release
(data, config, files)¶ Register and save a new release
Since pypi itself don’t support pre-registration anymore, we don’t
Note
Installers cannot create a new release
If a release with same version number and package exists, we return it :param dict data: request data for registering package :param dict config: current app config :raises: PermissionDenied
-
extrapypi.commons.packages.
create_release_from_source
(metadata, user)¶ Create a new release from a raw file. Used for import of existing packages into database
Warning
This function does not check any permissions since it’s never called from web ui
If a release already exists, it does nothing
Parameters: - metadata (dict) – metadata of the package
- user (extrapypi.models.User) – user to use as maintainer
-
extrapypi.commons.packages.
get_store
(name, params)¶ Utility function to get correct storage class based on its name
Parameters: - name (str) – name of the storage
- params (dict) – storage params from application config
Returns: Correct storage class instance, passing params to constructor
Return type: Raises: AttributeError
permission module¶
Permissions and needs helpers
Roles logic is defined like this :
admin > developer > maintainer > installer