mirror of
https://github.com/coddingtonbear/django-mailbox.git
synced 2026-07-09 22:38:19 +02:00
commit
0d77e85d24
10 changed files with 119 additions and 146 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -13,3 +13,6 @@ dummy_project/*
|
|||
.tox/
|
||||
messages
|
||||
*.sqlite3
|
||||
manage.py
|
||||
old/
|
||||
poetry.lock
|
||||
|
|
|
|||
14
CHANGELOG.md
Normal file
14
CHANGELOG.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
[Also based on](https://github.com/conventional-changelog/standard-version/blob/master/CHANGELOG.md) so decending.
|
||||
|
||||
## [0.1.0] - 2021-02-03
|
||||
### Added
|
||||
- bot - adds changelog
|
||||
|
||||
### Changed
|
||||
- changes repo to customized solution
|
||||
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
Changelog
|
||||
=========
|
||||
|
||||
4.8.1
|
||||
-----
|
||||
|
||||
* Add missing migration
|
||||
|
||||
4.8.0
|
||||
-----
|
||||
|
||||
* ```django_mailbox.models.Mailbox.get_new_mail``` become generator
|
||||
* Added to ```django_mailbox.models.Message.mailbox``` in-memory caches of result
|
||||
* Added to command ```processincomingmessage``` argument to pass mailbox name
|
||||
* Improved tests, especially different Django & Python version
|
||||
|
||||
4.6.1
|
||||
-----
|
||||
|
||||
* Add Django 2.0 support
|
||||
|
||||
- Add on_delete=models.CASCADE in models & migrations
|
||||
- Add Django 2.0 to tests matrices
|
||||
|
||||
4.4
|
||||
---
|
||||
|
||||
* Adds Django 1.8 support.
|
||||
|
||||
4.3
|
||||
---
|
||||
|
||||
* Adds functionality for allowing one to store the message body on-disk
|
||||
instead of in the database.
|
||||
|
||||
4.2
|
||||
---
|
||||
|
||||
* Adds 'envelope headers' to the Admin interface.
|
||||
|
||||
4.1
|
||||
---
|
||||
|
||||
* Adds Django 1.7 migrations support.
|
||||
|
||||
4.0
|
||||
---
|
||||
|
||||
* Adds ``html`` property returning the HTML contents of
|
||||
``django_mailbox.models.Message`` instances.
|
||||
Thanks `@ariel17 <https://github.com/ariel17>`_!
|
||||
* Adds translation support.
|
||||
Thanks `@ariel17 <https://github.com/ariel17>`_!
|
||||
* **Drops support for Python 3.2**. The fact that only versions of
|
||||
Python newer than 3.2 allow unicode literals has convinced me
|
||||
that supporting Python 3.2 is probably more trouble than it's worth.
|
||||
Please let me know if you were using Python 3.2, and I've left you
|
||||
out in the cold; I'm willing to fix Python 3.2 support if it is
|
||||
actively used.
|
||||
|
||||
3.4
|
||||
---
|
||||
|
||||
* Adds ``gmail`` transport allowing one to use Google
|
||||
OAuth credentials for gathering messages from gmail.
|
||||
Thanks `@alexlovelltroy <https://github.com/alexlovelltroy>`_!
|
||||
|
||||
3.3
|
||||
---
|
||||
|
||||
* Adds functionality to ``imap`` transport allowing one to
|
||||
archive processed e-mails.
|
||||
Thanks `@yellowcap <https://github.com/yellowcap>`_!
|
||||
|
||||
3.2
|
||||
---
|
||||
|
||||
* Fixes `#13 <https://github.com/coddingtonbear/django-mailbox/issues/13>`_;
|
||||
Python 3 support had been broken for some time. Thanks for catching that,
|
||||
`@greendee <https://github.com/greendee>`_!
|
||||
|
||||
3.1
|
||||
---
|
||||
|
||||
* Fixes a wide variety of unicode-related errors.
|
||||
|
||||
3.0
|
||||
---
|
||||
|
||||
* Restructures message storage such that non-text message attachments
|
||||
are stored as files, rather than in the database in their original
|
||||
(probably base64-encoded) blobs.
|
||||
* So many new tests.
|
||||
51
Makefile
Normal file
51
Makefile
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
VERSION := 0.1.0
|
||||
|
||||
clean:
|
||||
-rm -rf dist
|
||||
-rm -rf env
|
||||
|
||||
patch:
|
||||
git aftermerge patch || exit 1
|
||||
|
||||
minor:
|
||||
git aftermerge minor || exit 1
|
||||
|
||||
major:
|
||||
git aftermerge major || exit 1
|
||||
|
||||
|
||||
fmt:
|
||||
poetry run black . || exit 1
|
||||
|
||||
lint:
|
||||
poetry run flake8 . || exit 1
|
||||
|
||||
test: clean fmt lint
|
||||
poetry run pytest || exit 1
|
||||
|
||||
build: test
|
||||
poetry build
|
||||
|
||||
deploytest: build
|
||||
python3 -m venv env
|
||||
./env/bin/pip install wheel
|
||||
./env/bin/pip install dist/django-ngmailbox-\$(VERSION).tar.gz
|
||||
-echo "source ./env/bin/activate"
|
||||
|
||||
serve:
|
||||
bash ./devenv/start_firefox.sh &
|
||||
poetry run python manage.py runserver
|
||||
|
||||
dev:
|
||||
bash ./devenv/start_dev.sh &
|
||||
poetry run python manage.py runserver
|
||||
|
||||
migrations:
|
||||
poetry run python manage.py makemigrations
|
||||
poetry run python manage.py migrate
|
||||
|
||||
# Not setup yet
|
||||
#deploy: build
|
||||
# poetry publish -r focus
|
||||
|
||||
|
||||
|
|
@ -31,6 +31,16 @@ class ImapTransport(EmailTransport):
|
|||
'DJANGO_MAILBOX_INTEGRATION_TESTING_SUBJECT',
|
||||
None
|
||||
)
|
||||
self.delete_message_from_server = getattr(
|
||||
settings,
|
||||
'DJANGO_MAILBOX_DELETE_MESSAGE_FROM_SERVER',
|
||||
True
|
||||
)
|
||||
self.delete_message_store = getattr(
|
||||
settings,
|
||||
'DJANGO_MAILBOX_DELETE_MESSAGE_STORE',
|
||||
"/tmp/store.json"
|
||||
)
|
||||
self.hostname = hostname
|
||||
self.port = port
|
||||
self.archive = archive
|
||||
|
|
@ -109,7 +119,29 @@ class ImapTransport(EmailTransport):
|
|||
# If the archive folder does not exist, create it
|
||||
self.server.create(self.archive)
|
||||
|
||||
# PoC of alternative method of storing email
|
||||
if not self.delete_from_server:
|
||||
j = {"uids":[]}
|
||||
if os.path.exists("store.json"):
|
||||
with open("store.json","r") as f:
|
||||
j = json.load(f)
|
||||
else:
|
||||
with open("store.json","w") as f:
|
||||
json.dump(j,f)
|
||||
# PoC of alternative method of storing email
|
||||
|
||||
|
||||
for uid in message_ids:
|
||||
# PoC of alternative method of storing email
|
||||
if not self.delete_from_server:
|
||||
if uid in j["uids"]:
|
||||
continue
|
||||
else:
|
||||
j["uids"].append(uid)
|
||||
with open("store.json","w") as f:
|
||||
json.dump(j,f)
|
||||
# PoC of alternative method of storing email
|
||||
|
||||
try:
|
||||
typ, msg_contents = self.server.uid('fetch', uid, '(RFC822)')
|
||||
if not msg_contents:
|
||||
|
|
@ -131,7 +163,7 @@ class ImapTransport(EmailTransport):
|
|||
|
||||
if self.archive:
|
||||
self.server.uid('copy', uid, self.archive)
|
||||
|
||||
self.server.uid('store', uid, "+FLAGS", "(\\Deleted)")
|
||||
self.delete_message_from_server:
|
||||
self.server.uid('store', uid, "+FLAGS", "(\\Deleted)")
|
||||
self.server.expunge()
|
||||
return
|
||||
|
|
|
|||
10
manage.py
10
manage.py
|
|
@ -1,10 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
import os
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_mailbox.tests.settings")
|
||||
|
||||
from django.core.management import execute_from_command_line
|
||||
|
||||
execute_from_command_line(sys.argv)
|
||||
17
pyproject.toml
Normal file
17
pyproject.toml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[tool.poetry]
|
||||
name = "django-mailbox2"
|
||||
version = "0.1.0"
|
||||
description = "I'm forking and making it my own."
|
||||
authors = ["Joe <joe@sunset-crew.com>"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.6"
|
||||
Django = "^3.1.6"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
pytest = "^6.2.2"
|
||||
pytest-django = "^4.1.0"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
django>=3.1.1,<3.2
|
||||
six
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
pytest==2.9.1
|
||||
pytest-django==2.9.1
|
||||
mock==2.0.0
|
||||
36
tox.ini
36
tox.ini
|
|
@ -1,36 +0,0 @@
|
|||
[tox]
|
||||
# sort by django version, next by python version
|
||||
envlist=
|
||||
flake8
|
||||
py{35,36}-django111
|
||||
py{35,36}-django20
|
||||
py{35,36,37}-django21
|
||||
py{35,36,37}-django22
|
||||
py{36,37,38}-django30
|
||||
|
||||
[testenv]
|
||||
passenv=EMAIL_IMAP_SERVER EMAIL_ACCOUNT EMAIL_PASSWORD EMAIL_SMTP_SERVER
|
||||
deps=
|
||||
django111: django==1.11.*
|
||||
django20: django==2.0.*
|
||||
django21: django==2.0.*
|
||||
django22: django==2.0.*
|
||||
django30: django==3.0b1
|
||||
-r{toxinidir}/test_requirements.txt
|
||||
sitepackages=False
|
||||
commands=
|
||||
python {toxinidir}/manage.py makemigrations --check --dry-run
|
||||
python -Wd manage.py test -v2 {posargs}
|
||||
|
||||
[testenv:docs]
|
||||
deps=
|
||||
sphinx
|
||||
-r{toxinidir}/rtd_requirements.txt
|
||||
.
|
||||
commands=make html clean SPHINXOPTS="-W --keep-going"
|
||||
changedir={toxinidir}/docs
|
||||
allowlist_externals=make
|
||||
|
||||
[testenv:flake8]
|
||||
deps=flake8
|
||||
commands=flake8 django_mailbox
|
||||
Loading…
Add table
Add a link
Reference in a new issue