shuup.notify package
Subpackages
- shuup.notify.actions package
- shuup.notify.admin_module package
- Subpackages
- shuup.notify.admin_module.views package
- Submodules
- shuup.notify.admin_module.views.delete module
- shuup.notify.admin_module.views.edit module
- shuup.notify.admin_module.views.editor module
- shuup.notify.admin_module.views.email_template module
- shuup.notify.admin_module.views.list module
ScriptListView
ScriptListView.template_name
ScriptListView.model
ScriptListView.default_columns
ScriptListView.toolbar_buttons_provider_key
ScriptListView.mass_actions_provider_key
ScriptListView.get_object_url
ScriptListView.get_event_identifier_text
ScriptListView.get_toolbar
ScriptListView.get_object_abstract
ScriptListView.get_queryset
- shuup.notify.admin_module.views.template module
- Module contents
script_item_editor
ScriptEditView
EditScriptContentView
ScriptListView
ScriptListView.default_columns
ScriptListView.get_event_identifier_text
ScriptListView.get_object_abstract
ScriptListView.get_object_url
ScriptListView.get_queryset
ScriptListView.get_toolbar
ScriptListView.mass_actions_provider_key
ScriptListView.model
ScriptListView.template_name
ScriptListView.toolbar_buttons_provider_key
ScriptTemplateView
ScriptTemplateConfigView
ScriptTemplateEditView
- shuup.notify.admin_module.views package
- Submodules
- shuup.notify.admin_module.forms module
- shuup.notify.admin_module.utils module
- Module contents
- Subpackages
- shuup.notify.conditions package
- shuup.notify.models package
- Submodules
- shuup.notify.models.email_template module
- shuup.notify.models.notification module
NotificationManager
Notification
Notification.shop
Notification.recipient_type
Notification.recipient
Notification.created_on
Notification.message
Notification.identifier
Notification.priority
Notification.marked_read
Notification.marked_read_by
Notification.marked_read_on
Notification.objects
Notification.__init__
Notification.save
Notification.mark_read
Notification.is_read
Notification.data
Notification.DoesNotExist
Notification.MultipleObjectsReturned
Notification.get_next_by_created_on
Notification.get_previous_by_created_on
Notification.get_priority_display
Notification.get_recipient_type_display
Notification.id
Notification.marked_read_by_id
Notification.recipient_id
Notification.shop_id
Notification.url
Notification.set_reverse_url
- shuup.notify.models.script module
Script
Script.shop
Script.event_identifier
Script.identifier
Script.created_on
Script.name
Script.enabled
Script.template
Script.get_steps
Script.set_steps
Script.get_serialized_steps
Script.set_serialized_steps
Script.event_class
Script.execute
Script.DoesNotExist
Script.MultipleObjectsReturned
Script.add_log_entry
Script.get_next_by_created_on
Script.get_previous_by_created_on
Script.id
Script.log_entries
Script.objects
Script.shop_id
ScriptLogEntry
ScriptLogEntry.DoesNotExist
ScriptLogEntry.MultipleObjectsReturned
ScriptLogEntry.get_kind_display
ScriptLogEntry.get_next_by_created_on
ScriptLogEntry.get_previous_by_created_on
ScriptLogEntry.id
ScriptLogEntry.kind
ScriptLogEntry.logged_model
ScriptLogEntry.objects
ScriptLogEntry.target
ScriptLogEntry.target_id
ScriptLogEntry.user
- Module contents
EmailTemplate
Notification
Notification.DoesNotExist
Notification.MultipleObjectsReturned
Notification.__init__
Notification.created_on
Notification.data
Notification.get_next_by_created_on
Notification.get_previous_by_created_on
Notification.get_priority_display
Notification.get_recipient_type_display
Notification.id
Notification.identifier
Notification.is_read
Notification.mark_read
Notification.marked_read
Notification.marked_read_by
Notification.marked_read_by_id
Notification.marked_read_on
Notification.message
Notification.objects
Notification.priority
Notification.recipient
Notification.recipient_id
Notification.recipient_type
Notification.save
Notification.set_reverse_url
Notification.shop
Notification.shop_id
Notification.url
Script
Script.DoesNotExist
Script.MultipleObjectsReturned
Script.add_log_entry
Script.created_on
Script.enabled
Script.event_class
Script.event_identifier
Script.execute
Script.get_next_by_created_on
Script.get_previous_by_created_on
Script.get_serialized_steps
Script.get_steps
Script.id
Script.identifier
Script.log_entries
Script.name
Script.objects
Script.set_serialized_steps
Script.set_steps
Script.shop
Script.shop_id
Script.template
- shuup.notify.script_template package
- Submodules
- shuup.notify.script_template.factory module
- shuup.notify.script_template.generic module
GenericScriptTemplateEmailContentForm
GenericScriptTemplateEmailForm
GenericSendEmailScriptTemplate
GenericSendEmailScriptTemplate.template_name
GenericSendEmailScriptTemplate.extra_js_template_name
GenericSendEmailScriptTemplate.base_form_class
GenericSendEmailScriptTemplate.multilingual_form_class
GenericSendEmailScriptTemplate.get_script_steps
GenericSendEmailScriptTemplate.get_context_data
GenericSendEmailScriptTemplate.get_form
GenericSendEmailScriptTemplate.get_initial
GenericSendEmailScriptTemplate.can_edit_script
- Module contents
Submodules
shuup.notify.base module
- class shuup.notify.base.Variable(name, type=<class 'shuup.notify.typology.Type'>, required=True, help_text='', attributes=())[source]
Bases:
object
- Parameters:
name (str) – A human readable name for the variable.
type (shuup.notify.typology.Type) – The datatype of the variable.
required (bool) – Whether the variable is required or not.
help_text (str) – A free-form plaintext help text for the variable.
attributes (Sequence[tuple[str, str]]) – A sequence of (label, accessor) pairs that will be shown under the variable as guides of attributes that can be accessed from it. If one would pass
[_("ID", "id")]
to this when thename
param is “Order” if would get rendered asOrder ID: {{ order.id }}
in the script editor.
- __init__(name, type=<class 'shuup.notify.typology.Type'>, required=True, help_text='', attributes=())[source]
- Parameters:
name (str) – A human readable name for the variable.
type (shuup.notify.typology.Type) – The datatype of the variable.
required (bool) – Whether the variable is required or not.
help_text (str) – A free-form plaintext help text for the variable.
attributes (Sequence[tuple[str, str]]) – A sequence of (label, accessor) pairs that will be shown under the variable as guides of attributes that can be accessed from it. If one would pass
[_("ID", "id")]
to this when thename
param is “Order” if would get rendered asOrder ID: {{ order.id }}
in the script editor.
- class shuup.notify.base.Binding(name, type=<class 'shuup.notify.typology.Type'>, required=False, help_text='', constant_use=ConstantUse.VARIABLE_ONLY, default=None)[source]
Bases:
Variable
- Parameters:
name (str) – A human readable name for the variable.
type (shuup.notify.typology.Type) – The datatype of the variable.
required (bool) – Whether the variable is required or not.
help_text (str) – A free-form plaintext help text for the variable.
attributes (Sequence[tuple[str, str]]) – A sequence of (label, accessor) pairs that will be shown under the variable as guides of attributes that can be accessed from it. If one would pass
[_("ID", "id")]
to this when thename
param is “Order” if would get rendered asOrder ID: {{ order.id }}
in the script editor.
- __init__(name, type=<class 'shuup.notify.typology.Type'>, required=False, help_text='', constant_use=ConstantUse.VARIABLE_ONLY, default=None)[source]
- Parameters:
name (str) – A human readable name for the variable.
type (shuup.notify.typology.Type) – The datatype of the variable.
required (bool) – Whether the variable is required or not.
help_text (str) – A free-form plaintext help text for the variable.
attributes (Sequence[tuple[str, str]]) – A sequence of (label, accessor) pairs that will be shown under the variable as guides of attributes that can be accessed from it. If one would pass
[_("ID", "id")]
to this when thename
param is “Order” if would get rendered asOrder ID: {{ order.id }}
in the script editor.
- property accepts_any_type
- property allow_constant
- property allow_variable
- class shuup.notify.base.TemplatedBinding(*args, **kwargs)[source]
Bases:
Binding
- Parameters:
name (str) – A human readable name for the variable.
type (shuup.notify.typology.Type) – The datatype of the variable.
required (bool) – Whether the variable is required or not.
help_text (str) – A free-form plaintext help text for the variable.
attributes (Sequence[tuple[str, str]]) – A sequence of (label, accessor) pairs that will be shown under the variable as guides of attributes that can be accessed from it. If one would pass
[_("ID", "id")]
to this when thename
param is “Order” if would get rendered asOrder ID: {{ order.id }}
in the script editor.
- __init__(*args, **kwargs)[source]
- Parameters:
name (str) – A human readable name for the variable.
type (shuup.notify.typology.Type) – The datatype of the variable.
required (bool) – Whether the variable is required or not.
help_text (str) – A free-form plaintext help text for the variable.
attributes (Sequence[tuple[str, str]]) – A sequence of (label, accessor) pairs that will be shown under the variable as guides of attributes that can be accessed from it. If one would pass
[_("ID", "id")]
to this when thename
param is “Order” if would get rendered asOrder ID: {{ order.id }}
in the script editor.
- class shuup.notify.base.Base[source]
Bases:
object
- identifier = None
- name = None
- description = None
- variables = {}
- bindings = {}
- provide_category = None
- class shuup.notify.base.Event(**variable_values)[source]
Bases:
Base
- provide_category = 'notify_event'
- identifier = None
- log_target_variable = None
The name of the variable to be used as the log target for this event.
The target variable must have an
add_log_entry
method.
- property log_target
- bindings = {}
- variables = {}
- class shuup.notify.base.ScriptItem(data, validate=True)[source]
Bases:
Base
- provide_category = None
- get_value(context, binding_name)[source]
Get the actual value of a binding from the given script context.
- Parameters:
context (shuup.notify.script.Context) – Script Context
binding_name (str) – Binding name.
- Returns:
The variable value
- get_values(context)[source]
Get all binding values in a dict.
- Parameters:
context (shuup.notify.script.Context) – Script Context
- Returns:
Dict of binding name -> value
- Return type:
dict[name, value]
- bindings = {}
- identifier = 'script_item'
- name = 'Script Item'
- variables = {}
- class shuup.notify.base.Condition(data, validate=True)[source]
Bases:
ScriptItem
- provide_category = 'notify_condition'
- bindings = {}
- identifier = 'condition'
- name = 'Condition'
- variables = {}
- class shuup.notify.base.Action(data, validate=True)[source]
Bases:
ScriptItem
- provide_category = 'notify_action'
- template_use = 0
- template_fields = {}
- abstractmethod execute(context)[source]
- Parameters:
context (shuup.notify.script.Context) – Script Context
- get_template(context)[source]
Get this action’s template instance, bound in the context.
- Return type:
- get_template_values(context, language_preferences=())[source]
Render this Action’s template with data from the given context.
- Parameters:
context (shuup.notify.script.Context) – Script Context
language_preferences (list[str]) – Language preference list. The first language in the template to have values for all fields will be used. Has no effect for UNILINGUAL template_use.
- Returns:
Dict of field name -> rendered template text.
- Return type:
- bindings = {}
- identifier = 'action'
- name = 'Action'
- variables = {}
- class shuup.notify.base.ScriptTemplate(script_instance=None)[source]
Bases:
object
Represents a script template to use in provides.
Subclass this, implement the methods and add a reference to the class in the
notify_script_template
provide category.When
form_class
is set, a form will be presented to the user and validated, so you can extract more information to build the Script.- Variables:
identifier (str) – unique identifier for this ScriptTemplate with a max of 64 characters.
event (shuup.notify.Event) – event class which will be used to trigger the notification.
name (str) – name of the ScriptTemplate.
description (str) – description of the ScriptTemplate presented to the user.
help_text (str) – text to help users understand how this script will work.
form_class (django.forms.Form|None) – form class if your ScriptTemplate needs extra configuration.
initial (dict) – initial data to use in forms.
template_name (str) – template to use to render the form, if needed.
extra_js_template_name (str) – template with extra JavaScript code to use when rendering the form, if needed.
:ivar django.http.request.HttpRequest : http request.
- Parameters:
script_instance (shuup.notify.models.script.Script|None) – script instance to change or None
- identifier = ''
- event = None
- name = ''
- description = ''
- help_text = ''
- form_class = None
- initial = {}
- template_name = ''
- extra_js_template_name = ''
- __init__(script_instance=None)[source]
- Parameters:
script_instance (shuup.notify.models.script.Script|None) – script instance to change or None
- abstractmethod create_script(shop, form=None)[source]
Create and returns the Script.
If
form_class
is set, the will be validated and you can use it to do extra configuration on the Script.- Returns:
the created script
- Return type:
- abstractmethod can_edit_script()[source]
Check whether the bound
script_instance
attribute can be edited by this TemplateScript.This means if you can still understand the current script state and structure and parse it, so you can edit the script through the
form_class
.This is a necessary check since the user can change the script through the Editor and those changes can disfigure the expected script structure.
- Return type:
- Returns:
whether the bound
script_instance
can be edited by this script template
- abstractmethod update_script(form)[source]
Updates the current bound
script_instance
with the validated form data.This method is invoked when editing a Script created through this ScriptTemplate.
Note that only script templates which provides a form will have this method invoked.
- Returns:
the updated script
- Return type:
- get_initial()[source]
Returns the initial data to use for configuration form.
Note: You must also check for the bound
script_instance
attribute. One can edit the Script created by the template editor through the form this instance provides. This way, when a script instance is bound, you must return the the representantion of the Script as the initial form data.- Returns:
initial data to to use in configuration form
- Return type:
shuup.notify.enums module
- class shuup.notify.enums.TemplateUse(value)[source]
Bases:
Enum
- NONE = 0
- UNILINGUAL = 1
- MULTILINGUAL = 2
- class shuup.notify.enums.ConstantUse(value)[source]
Bases:
Enum
- VARIABLE_ONLY = 1
- CONSTANT_ONLY = 2
- VARIABLE_OR_CONSTANT = 3
shuup.notify.notify_events module
- class shuup.notify.notify_events.PasswordReset(**variable_values)[source]
Bases:
Event
- identifier = 'shuup_notify_password_reset'
- name = 'Password Reset'
- description = 'This event is triggered when password reset is requested.'
- bindings = {}
- variables = {'customer_email': <shuup.notify.base.Variable object>, 'recovery_url': <shuup.notify.base.Variable object>, 'site_name': <shuup.notify.base.Variable object>, 'token': <shuup.notify.base.Variable object>, 'uid': <shuup.notify.base.Variable object>, 'user_to_recover': <shuup.notify.base.Variable object>}
shuup.notify.runner module
shuup.notify.script module
- class shuup.notify.script.Step(conditions=(), actions=(), next=StepNext.CONTINUE, cond_op=StepConditionOperator.ALL, enabled=True)[source]
Bases:
object
- __init__(conditions=(), actions=(), next=StepNext.CONTINUE, cond_op=StepConditionOperator.ALL, enabled=True)[source]
- property enabled
- class shuup.notify.script.Context(variables=None, shop=None, event_identifier=None)[source]
Bases:
object
- classmethod from_variables(shop=None, event_identifier=None, **variables)[source]
Create Context from variables.
- Parameters:
event_identifier – identifier for shuup.notify event type
- Return type:
- log(level, msg, *args, **kwargs)[source]
Log a message with the context’s logger (not the log target). This may be an useful debugging tool.
The parameters are the same as for
logging.Logger.log()
.
- add_log_entry_on_log_target(message, identifier, **kwargs)[source]
Add a log entry on the context’s log target.
The kwargs are passed to the target’s
add_log_entry
method.If no log target exists or if it has no
add_log_entry
method, this method does nothing.
- property log_entry_queryset
shuup.notify.script_templates module
shuup.notify.settings module
- shuup.notify.settings.SHUUP_NOTIFY_SCRIPT_RUNNER = 'shuup.notify.runner.run_event'
The method used to run scripts.
- shuup.notify.settings.SHUUP_NOTIFY_TEMPLATE_ENVIRONMENT_PROVIDER = 'shuup.notify.template.get_sandboxed_template_environment'
The method used to return the render environment for templates.
shuup.notify.signal_handlers module
shuup.notify.signals module
shuup.notify.tasks module
shuup.notify.template module
- shuup.notify.template.get_sandboxed_template_environment(context, **kwargs)[source]
Returns a Jinja2 enviroment for rendering templates in notifications
- Parameters:
context (shuup.notify.script.Context) – Script context.
kwargs (dict) – extra args.
- Returns:
The environment used to render.
- Return type:
jinja2.environment.Environment
- shuup.notify.template.render_in_context(context, template_text, html_intent=False)[source]
Render the given Jinja2 template text in the script context.
- Parameters:
context (shuup.notify.script.Context) – Script context.
template_text (str) – Jinja2 template text.
html_intent (bool) – Is the template text intended for HTML output? This currently turns on autoescaping.
- Returns:
Rendered template text.
- Return type:
- Raises:
Whatever Jinja2 might happen to raise.
- class shuup.notify.template.Template(context, data)[source]
Bases:
object
- Parameters:
context (shuup.notify.script.Context) – Script context.
data (dict) – Template data dictionary.
- __init__(context, data)[source]
- Parameters:
context (shuup.notify.script.Context) – Script context.
data (dict) – Template data dictionary.
shuup.notify.typology module
- class shuup.notify.typology.MultiEmailField(*, required=True, widget=None, label=None, initial=None, help_text='', error_messages=None, show_hidden_initial=False, validators=(), localize=False, disabled=False, label_suffix=None)[source]
Bases:
Field
From https://docs.djangoproject.com/en/1.11/ref/forms/validation/#form-field-default-cleaning
- class shuup.notify.typology.Type[source]
Bases:
object
- name = None
- identifier = None
- class shuup.notify.typology.Boolean[source]
Bases:
Type
- name = 'Boolean'
- identifier = 'boolean'
- class shuup.notify.typology.Integer[source]
Bases:
_Number
- name = 'Integer Number'
- identifier = 'integer'
- class shuup.notify.typology.Decimal[source]
Bases:
_Number
- name = 'Decimal Number'
- identifier = 'decimal'
- class shuup.notify.typology.Language[source]
Bases:
_String
- name = 'Language'
- identifier = 'language'
- class shuup.notify.typology.Email[source]
Bases:
_String
- name = 'Email Address'
- identifier = 'email'
- class shuup.notify.typology.URL[source]
Bases:
_String
- name = 'URL Address'
- identifier = 'url'
- class shuup.notify.typology.Phone[source]
Bases:
_String
- name = 'Phone Number'
- identifier = 'phone'
- class shuup.notify.typology.Model(model_label)[source]
Bases:
Type
- Parameters:
model_label (str) – Model label in Django
app.Model
format (e.g.shuup.Order
).
- identifier = 'model'
- property name
- __init__(model_label)[source]
- Parameters:
model_label (str) – Model label in Django
app.Model
format (e.g.shuup.Order
).
- model_label = None
- class shuup.notify.typology.Enum(enum_class)[source]
Bases:
Type
- identifier = 'enum'
- property name
- enum_class = None
Module contents
- class shuup.notify.ShuupNotifyAppConfig(*args, **kwargs)[source]
Bases:
AppConfig
- name = 'shuup.notify'
- verbose_name = 'Shuup Notification Framework'
- label = 'shuup_notify'
- default_auto_field = 'django.db.models.BigAutoField'
- provides = {'admin_module': ['shuup.notify.admin_module:NotifyAdminModule', 'shuup.notify.admin_module:EmailTemplateAdminModule'], 'notify_action': ['shuup.notify.actions:SetDebugFlag', 'shuup.notify.actions:AddOrderLogEntry', 'shuup.notify.actions:SendEmail', 'shuup.notify.actions:AddNotification'], 'notify_condition': ['shuup.notify.conditions:LanguageEqual', 'shuup.notify.conditions:BooleanEqual', 'shuup.notify.conditions:IntegerEqual', 'shuup.notify.conditions:TextEqual', 'shuup.notify.conditions:Empty', 'shuup.notify.conditions:NonEmpty'], 'notify_event': ['shuup.notify.notify_events:PasswordReset'], 'notify_script_template': ['shuup.notify.script_templates:PasswordResetTemplate']}
See /provides for details about the
provides
variable.