Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/incendium/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,40 @@

from __future__ import unicode_literals

__all__ = [
"CANCEL_TEXT",
"CANNOT_DELETE_ELEMENT",
"CANNOT_EDIT_ELEMENT",
"CONFIRM",
"DEFAULT_LANGUAGE",
"EDIT_ERROR",
"EDIT_SUCCESS",
"EDIT_SUCCESS_WITH_ERRORS",
"EMPTY_STRING",
"ERROR_REPORT",
"ERROR_WINDOW_TITLE",
"FORM_ERROR",
"GATEWAY_EXCEPTION",
"INFO_WINDOW_TITLE",
"MSSQL_SERVER_EXCEPTION",
"NEW_LINE",
"NEW_TABBED_LINE",
"NO_TEXT",
"OK_TEXT",
"PROCEED_WITHOUT_SAVING_CHANGES",
"PROCEED_WITH_ROWS_DELETION",
"PROCEED_WITH_ROW_DELETION",
"PROCEED_WITH_SAVING_CHANGES",
"SENDER",
"SMTP",
"SUCCESS_WINDOW_TITLE",
"TABBED_LINE",
"UNEXPECTED_ERROR",
"UNEXPECTED_ERROR_CAUSED_BY",
"WARNING_WINDOW_TITLE",
"YES_TEXT",
]

# Email settings.
SMTP = "mail.mycompany.com:25"
SENDER = "no-reply@mycompany.com"
Expand Down
2 changes: 2 additions & 0 deletions src/incendium/helper/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

from java.lang import Exception as JavaException

__all__ = ["AnyStr", "DictIntStringAny", "DictStringAny", "InnerException", "Number"]

AnyStr = Union[str, unicode]
DictIntStringAny = Dict[Union[int, str, unicode], Any]
DictStringAny = Dict[Union[str, unicode], Any]
Expand Down
6 changes: 4 additions & 2 deletions src/incendium/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
from __future__ import unicode_literals

__all__ = [
"HTML_ESCAPE_TABLE",
"report_error",
"send_high_priority_email",
"send_html_email",
"send_plain_text_email",
]

from typing import List
from typing import Dict, List

import system.net

Expand All @@ -23,7 +25,7 @@
"<": "&lt;",
"\n": "<br />",
"\t": "&nbsp;" * 4,
}
} # type: Dict[AnyStr, AnyStr]


def _html_escape(text):
Expand Down
7 changes: 6 additions & 1 deletion stubs/stubs/incendium/net.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
from typing import List
from typing import Dict, List

from incendium.helper.types import AnyStr

HTML_ESCAPE_TABLE: Dict[AnyStr, AnyStr]

def send_html_email(
subject: AnyStr, body: AnyStr, to: List[AnyStr], priority: AnyStr = ...
) -> None: ...
def send_high_priority_email(
subject: AnyStr, body: AnyStr, to: List[AnyStr]
) -> None: ...
def report_error(
subject: AnyStr, message: AnyStr, details: AnyStr, to: List[AnyStr]
) -> None: ...
def send_plain_text_email(
subject: AnyStr, body: AnyStr, to: List[AnyStr], priority: AnyStr = ...
) -> None: ...