vial.model.db module

class vial.model.db.BaseMixin[source]

Bases: object

Base class providing usefull mixin functionality.

createtime = Column(None, DateTime(), table=None, default=ColumnDefault(<function datetime.utcnow>))
get_id()[source]

Getter for retrieving current primary ID.

id = Column(None, Integer(), table=None, primary_key=True, nullable=False)
to_dict()[source]

Export object into dictionary containing only primitive data types.

to_json()[source]

Export object into JSON string.

class vial.model.db.GroupModel(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base, vial.model.db.BaseMixin

Class representing group objects within the SQL database mapped to groups table.

children
createtime
description
enabled
classmethod from_dict(structure, defaults=None)[source]

Convenience method for creating mydojo.db.GroupModel object from dict objects.

id
managers
members
members_wanted
name
parent_id
to_dict()[source]

Interface implementation: Implementation of mydojo.db.BaseMixin.to_dict() method.

class vial.model.db.ItemChangeLogModel(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base, vial.model.db.BaseMixin

Class representing item changelog records within the SQL database mapped to changelogs_items table.

after
author
author_id
before
calculate_diff()[source]

Calculate difference between internal before and after attributes and store it internally into diff attribute.

createtime
diff
endpoint
id
model
model_id
module
operation
class vial.model.db.UserModel(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base, vial.model.db.BaseMixin

Class representing user objects within the SQL database mapped to users table.

apikey
changelogs
check_password(password_plain)[source]

Check given plaintext password agains internal password hash.

createtime
email
enabled
classmethod from_dict(structure, defaults=None)[source]

Convenience method for creating mydojo.db.UserModel object from dict objects.

fullname
get_id()[source]

Mandatory interface required by the flask_login extension.

has_no_role()[source]

Returns True if the user has no role.

has_role(role)[source]

Returns True if the user identifies with the specified role.

Parameters

role (str) – A role name.

id
property is_active

Mandatory interface required by the flask_login extension.

property is_anonymous

Mandatory interface required by the flask_login extension.

property is_authenticated

Mandatory interface required by the flask_login extension.

is_state_disabled()[source]

Check if current user account state is disabled.

is_state_enabled()[source]

Check if current user account state is enabled.

locale
login
logintime
managements
memberships
memberships_wanted
password
roles
set_password(password_plain)[source]

Generate and set password hash from given plain text password.

set_state_disabled()[source]

Set current user account state to disabled.

set_state_enabled()[source]

Set current user account state to enabled.

timezone
to_dict()[source]

Interface implementation: Implementation of mydojo.db.BaseMixin.to_dict() method.

vial.model.db.dictdiff(dict_obj_a, dict_obj_b)[source]

Calculate the difference between two model objects given as dicts.

vial.model.db.diff(obj_a, obj_b)[source]

Calculate the difference between two model objects given as dicts.

vial.model.db.jsondiff(json_obj_a, json_obj_b)[source]

Calculate the difference between two model objects given as JSON strings.