Modules (API)

Core

The core module is the most important module there is, it stores the base template and the static files such as jQuery and bootstrap.

SMTP Server

class apps.core.smtpd.Lurker(localaddr, remoteaddr, data_size_limit=33554432, map=None, enable_SMTPUTF8=False, decode_data=None)[source]
CLEANER = None
INSTANCE = None
THREAD = None
static clean()[source]
static clean_international_string(entry)[source]
static clear_cache()[source]
enable_SMTPUTF8 = True
static parse_address(raw)[source]

Parse Address :param raw: :return:

static parse_addresses(raw)[source]

Parse Addresses :param raw: :return:

process_message(peer, mailfrom, rcpttos, data, **kwargs)[source]

Process and save message

Parameters:
  • peer
  • mailfrom
  • rcpttos
  • data
  • kwargs
Returns:

static start(test=False, threaded=False, cleaner=False)[source]

Start SMTP catcher.

Parameters:
  • test
  • threaded
  • cleaner
Returns:

static stop()[source]

Stop threaded server. :return:

Models

class apps.core.models.BaseModel(*args, **kwargs)[source]
class Meta[source]
abstract = False
BaseModel.get_next_by_created_at(*moreargs, **morekwargs)
BaseModel.get_next_by_updated_at(*moreargs, **morekwargs)
BaseModel.get_previous_by_created_at(*moreargs, **morekwargs)
BaseModel.get_previous_by_updated_at(*moreargs, **morekwargs)

Views

class apps.core.views.PreferenceView(**kwargs)[source]
get(request, *args, **kwargs)[source]
permission_classes = [<class 'rest_framework.permissions.AllowAny'>]
valid_attributes = {'fluid': {'type': <class 'bool'>, 'default': True}}

Accounts

The accounts module manages the users and the authentication.

Models

class apps.accounts.models.User(id, password, last_login, is_superuser, username, first_name, last_name, email, is_staff, is_active, date_joined)[source]
exception DoesNotExist
exception User.MultipleObjectsReturned
User.auth_token
User.created_filters
User.created_rules
User.get_gravatar_url(size=120, default='mm')[source]

Get Gravatar URL. :param size: :param default: :return:

User.get_next_by_date_joined(*moreargs, **morekwargs)
User.get_previous_by_date_joined(*moreargs, **morekwargs)
User.groups
User.logentry_set
User.objects = <django.contrib.auth.models.UserManager object>
User.social_auth
User.user_permissions

Views

class apps.accounts.views.Details(**kwargs)[source]
get_context_data(**kwargs)[source]
template_name = 'accounts/details.html'
class apps.accounts.views.Login(**kwargs)[source]
get(request, *args, **kwargs)[source]
post(request, *args, **kwargs)[source]
social_config
template_name = 'accounts/login.html'
class apps.accounts.views.Logout(**kwargs)[source]
get(request, *args, **kwargs)[source]

Forms

class apps.accounts.forms.LoginForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False)[source]

Bases: django.forms.forms.Form

Login Form

class Meta[source]

Bases: object

fields = ['username', 'password']
LoginForm.base_fields = OrderedDict([('username', <django.forms.fields.CharField object>), ('password', <django.forms.fields.CharField object>)])
LoginForm.declared_fields = OrderedDict([('username', <django.forms.fields.CharField object>), ('password', <django.forms.fields.CharField object>)])
LoginForm.media

Middleware

class apps.accounts.middleware.SocialAuthExceptionMiddleware[source]

Bases: object

process_exception(request, exception)[source]

API

The API module is responsible for an rest_framework API to provide real-time informations to the client-side. There are plans to expand this module for external API usages.

Models

Views

Serializers

class apps.api.serializers.FilterSetAdvancedSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]
class Meta[source]
fields = ('id', 'name', 'created_by', 'is_global', 'is_active', 'icon', 'count', 'rules')
model

alias of FilterSet

class apps.api.serializers.FilterSetSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]
class Meta[source]
fields = ('name', 'created_by', 'is_global', 'is_active', 'icon', 'count')
model

alias of FilterSet

class apps.api.serializers.MessagePartSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]
class Meta[source]
fields = ('id', 'is_attachment', 'type', 'filename', 'charset', 'body', 'size')
model

alias of MessagePart

class apps.api.serializers.MessagePartSummarySerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]
class Meta[source]
fields = ('id', 'is_attachment', 'type', 'filename', 'charset', 'size')
model

alias of MessagePart

class apps.api.serializers.MessageSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]
class Meta[source]
fields = ('id', 'peer', 'port', 'sender_name', 'sender_address', 'recipients_to', 'recipients_cc', 'recipients_bcc', 'subject', 'size', 'type', 'headers', 'source', 'parts')
model

alias of Message

class apps.api.serializers.RuleAdvancedSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]
class Meta[source]
fields = ('id', 'field', 'operator', 'negate', 'value', 'filter_set')
model

alias of Rule

Mails

The mails module is the core of the mails storage and the mail list.

Models

class apps.mails.models.Message(id, created_at, updated_at, peer, port, sender_name, sender_address, recipients_to, recipients_cc, recipients_bcc, subject, source, size, type, headers)[source]
exception DoesNotExist
exception Message.MultipleObjectsReturned
static Message.cleanup()[source]
static Message.count_all()[source]
Message.eml
Message.get_next_by_created_at(*moreargs, **morekwargs)
Message.get_next_by_updated_at(*moreargs, **morekwargs)
Message.get_previous_by_created_at(*moreargs, **morekwargs)
Message.get_previous_by_updated_at(*moreargs, **morekwargs)
Message.has_attachments
Message.headers

A placeholder class that provides a way to set the attribute on the model.

Message.num_parts
Message.num_real_parts
Message.objects = <django.db.models.manager.Manager object>
Message.parts
Message.recipients_bcc

A placeholder class that provides a way to set the attribute on the model.

Message.recipients_cc

A placeholder class that provides a way to set the attribute on the model.

Message.recipients_to

A placeholder class that provides a way to set the attribute on the model.

class apps.mails.models.MessagePart(id, created_at, updated_at, message, is_attachment, type, filename, charset, body, size)[source]
exception DoesNotExist
exception MessagePart.MultipleObjectsReturned
MessagePart.get_next_by_created_at(*moreargs, **morekwargs)
MessagePart.get_next_by_updated_at(*moreargs, **morekwargs)
MessagePart.get_previous_by_created_at(*moreargs, **morekwargs)
MessagePart.get_previous_by_updated_at(*moreargs, **morekwargs)
MessagePart.message
MessagePart.objects = <django.db.models.manager.Manager object>

Views

class apps.mails.views.MailDownload(**kwargs)[source]
get(request, mail_ids)[source]
class apps.mails.views.MailList(**kwargs)[source]
get_context_data(**kwargs)[source]
sortable_columns = {'size': 'size', 'to': 'recipients_to', 'received': 'created_at', 'subject': 'subject', 'from': 'sender_address'}
template_name = 'mails/list.html'
class apps.mails.views.MailPart(**kwargs)[source]
get(request, mail_id, part_id, *args, **kwargs)[source]
template_name = 'mails/part.html'
class apps.mails.views.MailPartBody(**kwargs)[source]
cant_display = ['multipart/alternative', 'multipart/mixed']
get(request, mail_id, part_id, *args, **kwargs)[source]

Filters

The filters module is the core of the filters and rules. It stores and deserialize intro Django ORM Q-objects.

Models

class apps.filters.models.FilterSet(id, created_at, updated_at, name, created_by, is_global, is_active, icon, combine)[source]
COMBINE_CHOICES = (('and', 'Match all criteria (AND)'), ('or', 'Match one of the criteria (OR)'))
exception DoesNotExist
FilterSet.ICON_CHOICES = (('fa fa-filter', 'Default Filter'), ('fa fa-server', 'Server'))
exception FilterSet.MultipleObjectsReturned
FilterSet.combine = None

Combine of the rules

FilterSet.count
FilterSet.created_by

Couple filter to user. Use this especially when filter is not global but user defined.

static FilterSet.get_combine_choices()[source]
FilterSet.get_combine_display(*moreargs, **morekwargs)
static FilterSet.get_icon_choices()[source]
FilterSet.get_icon_display(*moreargs, **morekwargs)
FilterSet.get_matches()[source]
FilterSet.get_next_by_created_at(*moreargs, **morekwargs)
FilterSet.get_next_by_updated_at(*moreargs, **morekwargs)
FilterSet.get_previous_by_created_at(*moreargs, **morekwargs)
FilterSet.get_previous_by_updated_at(*moreargs, **morekwargs)
FilterSet.icon = None

Icon to show in the list.

FilterSet.is_active = None

Filter active. True to show in the filter list.

FilterSet.is_global = None

Set true if the filter is global

FilterSet.name = None

Name of the filter

FilterSet.objects = <django.db.models.manager.Manager object>
FilterSet.rules
class apps.filters.models.Rule(id, created_at, updated_at, filter_set, created_by, field, operator, negate, value)[source]
exception DoesNotExist
Rule.FIELD_CHOICES = (('peer', 'Peer Address'), ('port', 'Peer Port'), ('sender_name', 'Sender Name'), ('sender_address', 'Sender Address'), ('recipients_to', 'To Recipients'), ('recipients_cc', 'CC Recipients'), ('recipients_bcc', 'BCC Recipients'), ('subject', 'Subject'), ('size', 'Message Size'), ('type', 'Message Content Type'), ('headers', 'Message Headers'))
exception Rule.MultipleObjectsReturned
Rule.OPERATOR_CHOICES = (('iexact', 'Equal Than (==)'), ('icontains', 'Contains'), ('iregex', 'Matches Regular Expression'), ('isnull', 'Is NULL'), ('istrue', 'Is TRUE'), ('isfalse', 'Is FALSE'), ('lt', 'Less Than (<)'), ('gt', 'Greater Than (>)'), ('lte', 'Less or Equal Than (<=)'), ('gte', 'Greater or Equal Than (>=)'))
Rule.created_by

Couple rule to user so we know if the user is allowed to change the Rule.

static Rule.deserialize_set(filterset: apps.filters.models.FilterSet)[source]
Rule.field = None

Field to run condition against.

Rule.filter_set
Rule.get_field_display(*moreargs, **morekwargs)
Rule.get_next_by_created_at(*moreargs, **morekwargs)
Rule.get_next_by_updated_at(*moreargs, **morekwargs)
Rule.get_operator_display(*moreargs, **morekwargs)
Rule.get_previous_by_created_at(*moreargs, **morekwargs)
Rule.get_previous_by_updated_at(*moreargs, **morekwargs)
Rule.negate = None

Negate condition

Rule.objects = <django.db.models.manager.Manager object>
Rule.operator = None

Operator

Forms

class apps.filters.forms.AdminFilterSetEditForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None)[source]
base_fields = OrderedDict()
declared_fields = OrderedDict()
media
class apps.filters.forms.AdvancedFilterSetForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False)[source]
base_fields = OrderedDict([('filter_name', <django.forms.fields.CharField object>), ('filter_condition', <django.forms.fields.ChoiceField object>), ('filter_is_global', <django.forms.fields.BooleanField object>), ('filter_is_active', <django.forms.fields.BooleanField object>), ('filter_icon', <django.forms.fields.ChoiceField object>), ('rules', <apps.filters.fields.JSONFormField object>)])
declared_fields = OrderedDict([('filter_name', <django.forms.fields.CharField object>), ('filter_condition', <django.forms.fields.ChoiceField object>), ('filter_is_global', <django.forms.fields.BooleanField object>), ('filter_is_active', <django.forms.fields.BooleanField object>), ('filter_icon', <django.forms.fields.ChoiceField object>), ('rules', <apps.filters.fields.JSONFormField object>)])
get_rules()[source]
media
update(instance: apps.filters.models.FilterSet)[source]
class apps.filters.forms.FilterSetDeleteForm(*args, **kwargs)[source]
base_fields = OrderedDict()
declared_fields = OrderedDict()
media
class apps.filters.fields.JSONFormField(valid_json=True, *args, **kwargs)[source]
to_python(value)[source]
validate(value)[source]

Views

class apps.filters.views.DeleteView(**kwargs)[source]
get(request, *args, **kwargs)[source]
post(request, *args, **kwargs)[source]
template_name = 'filters/delete.html'
class apps.filters.views.EditView(**kwargs)[source]
get(request, *args, **kwargs)[source]
post(request, *args, **kwargs)[source]
template_name = 'filters/edit.html'
class apps.filters.views.ListView(**kwargs)[source]
get_context_data(**kwargs)[source]
template_name = 'filters/list.html'