Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Rename email app to mailer

Roland Geiderab19f47e9121
diff --git a/wger/core/fixtures/groups.json b/wger/core/fixtures/groups.json
index 179517e04..b81165963 100644
--- a/wger/core/fixtures/groups.json
+++ b/wger/core/fixtures/groups.json
@@ -323,12 +323,12 @@
"permissions": [
[
"add_log",
- "email",
+ "mailer",
"log"
],
[
"change_log",
- "email",
+ "mailer",
"log"
],
[
diff --git a/wger/gym/views/admin_config.py b/wger/gym/views/admin_config.py
index c275c93fe..f0b4e5791 100644
--- a/wger/gym/views/admin_config.py
+++ b/wger/gym/views/admin_config.py
@@ -19,7 +19,7 @@ import logging
# Django
from django.urls import reverse
-from django.utils.translation import ugettext_lazy
+from django.utils.translation import ugettext as _, ugettext_lazy
from django.views.generic import UpdateView
# wger
diff --git a/wger/email/__init__.py b/wger/mailer/__init__.py
similarity index 70%
rename from wger/email/__init__.py
rename to wger/mailer/__init__.py
index 7fb40407f..a0a057873 100644
--- a/wger/email/__init__.py
+++ b/wger/mailer/__init__.py
@@ -20,14 +20,5 @@ from wger import get_version
VERSION = get_version()
-default_app_config = 'wger.email.apps.Config'
+default_app_config = 'wger.mailer.apps.Config'
-
-def message_from_file(fp, *args, **kws):
- """
- Dummy method. Needed because this email app clashes with python's own
- "email" package and bad things happen sometimes. See the note in tasks.py.
-
- https://travis-ci.org/github/wger-project/wger/jobs/708008236
- """
- return ":("
diff --git a/wger/email/apps.py b/wger/mailer/apps.py
similarity index 96%
rename from wger/email/apps.py
rename to wger/mailer/apps.py
index 7880ce4b4..9d2716146 100644
--- a/wger/email/apps.py
+++ b/wger/mailer/apps.py
@@ -19,7 +19,7 @@ from django.apps import AppConfig
class Config(AppConfig):
- name = 'wger.email'
+ name = 'wger.mailer'
verbose_name = "Email"
def ready(self):
diff --git a/wger/email/forms.py b/wger/mailer/forms.py
similarity index 100%
rename from wger/email/forms.py
rename to wger/mailer/forms.py
diff --git a/wger/email/management/__init__.py b/wger/mailer/management/__init__.py
similarity index 100%
rename from wger/email/management/__init__.py
rename to wger/mailer/management/__init__.py
diff --git a/wger/email/management/commands/__init__.py b/wger/mailer/management/commands/__init__.py
similarity index 100%
rename from wger/email/management/commands/__init__.py
rename to wger/mailer/management/commands/__init__.py
diff --git a/wger/email/management/commands/send-mass-emails.py b/wger/mailer/management/commands/send-mass-emails.py
similarity index 97%
rename from wger/email/management/commands/send-mass-emails.py
rename to wger/mailer/management/commands/send-mass-emails.py
index 017172c77..8e7c3ed87 100644
--- a/wger/email/management/commands/send-mass-emails.py
+++ b/wger/mailer/management/commands/send-mass-emails.py
@@ -20,7 +20,7 @@ from django.core import mail
from django.core.management.base import BaseCommand
# wger
-from wger.email.models import CronEntry
+from wger.mailer.models import CronEntry
class Command(BaseCommand):
diff --git a/wger/email/migrations/0001_initial.py b/wger/mailer/migrations/0001_initial.py
similarity index 93%
rename from wger/email/migrations/0001_initial.py
rename to wger/mailer/migrations/0001_initial.py
index aa75b81a5..16915b262 100644
--- a/wger/email/migrations/0001_initial.py
+++ b/wger/mailer/migrations/0001_initial.py
@@ -34,6 +34,6 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='cronentry',
name='log',
- field=models.ForeignKey(editable=False, to='email.Log', on_delete=models.CASCADE),
+ field=models.ForeignKey(editable=False, to='mailer.Log', on_delete=models.CASCADE),
),
]
diff --git a/wger/email/migrations/0002_auto_20190618_1617.py b/wger/mailer/migrations/0002_auto_20190618_1617.py
similarity index 86%
rename from wger/email/migrations/0002_auto_20190618_1617.py
rename to wger/mailer/migrations/0002_auto_20190618_1617.py
index f97edb6ff..9db9632ae 100644
--- a/wger/email/migrations/0002_auto_20190618_1617.py
+++ b/wger/mailer/migrations/0002_auto_20190618_1617.py
@@ -9,7 +9,7 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
- ('email', '0001_initial'),
+ ('mailer', '0001_initial'),
]
operations = [
@@ -22,6 +22,6 @@ class Migration(migrations.Migration):
name='gym',
field=models.ForeignKey(
editable=False, on_delete=django.db.models.deletion.CASCADE,
- related_name='email_log', to='gym.Gym'),
+ related_name='mailer_log', to='gym.Gym'),
),
]
diff --git a/wger/email/migrations/__init__.py b/wger/mailer/migrations/__init__.py
similarity index 100%
rename from wger/email/migrations/__init__.py
rename to wger/mailer/migrations/__init__.py
diff --git a/wger/email/models.py b/wger/mailer/models.py
similarity index 100%
rename from wger/email/models.py
rename to wger/mailer/models.py
diff --git a/wger/email/templates/email/gym/form.html b/wger/mailer/templates/mailer/gym/form.html
similarity index 100%
rename from wger/email/templates/email/gym/form.html
rename to wger/mailer/templates/mailer/gym/form.html
diff --git a/wger/email/templates/email/gym/overview.html b/wger/mailer/templates/mailer/gym/overview.html
similarity index 100%
rename from wger/email/templates/email/gym/overview.html
rename to wger/mailer/templates/mailer/gym/overview.html
diff --git a/wger/email/templates/email/gym/preview.html b/wger/mailer/templates/mailer/gym/preview.html
similarity index 100%
rename from wger/email/templates/email/gym/preview.html
rename to wger/mailer/templates/mailer/gym/preview.html
diff --git a/wger/email/tests/__init__.py b/wger/mailer/tests/__init__.py
similarity index 100%
rename from wger/email/tests/__init__.py
rename to wger/mailer/tests/__init__.py
diff --git a/wger/email/tests/test_gym_emails.py b/wger/mailer/tests/test_gym_emails.py
similarity index 100%
rename from wger/email/tests/test_gym_emails.py
rename to wger/mailer/tests/test_gym_emails.py
diff --git a/wger/email/urls.py b/wger/mailer/urls.py
similarity index 93%
rename from wger/email/urls.py
rename to wger/mailer/urls.py
index a7a022676..e4e4e978a 100644
--- a/wger/email/urls.py
+++ b/wger/mailer/urls.py
@@ -21,8 +21,8 @@ from django.conf.urls import (
)
# wger
-from wger.email.forms import EmailListForm
-from wger.email.views import gym
+from wger.mailer.forms import EmailListForm
+from wger.mailer.views import gym
# sub patterns for email lists
diff --git a/wger/email/views/__init__.py b/wger/mailer/views/__init__.py
similarity index 100%
rename from wger/email/views/__init__.py
rename to wger/mailer/views/__init__.py
diff --git a/wger/email/views/gym.py b/wger/mailer/views/gym.py
similarity index 95%
rename from wger/email/views/gym.py
rename to wger/mailer/views/gym.py
index a74ed76c4..1a72ba06d 100644
--- a/wger/email/views/gym.py
+++ b/wger/mailer/views/gym.py
@@ -30,7 +30,7 @@ from django.views import generic
from formtools.preview import FormPreview
# wger
-from wger.email.models import (
+from wger.mailer.models import (
CronEntry,
Log
)
@@ -44,8 +44,8 @@ class EmailLogListView(PermissionRequiredMixin, generic.ListView):
model = Log
context_object_name = "email_list"
- template_name = 'email/gym/overview.html'
- permission_required = 'email.add_log'
+ template_name = 'mailer/gym/overview.html'
+ permission_required = 'mailer.add_log'
gym = None
def get_queryset(self):
@@ -77,8 +77,8 @@ class EmailLogListView(PermissionRequiredMixin, generic.ListView):
class EmailListFormPreview(FormPreview):
- preview_template = 'email/gym/preview.html'
- form_template = 'email/gym/form.html'
+ preview_template = 'mailer/gym/preview.html'
+ form_template = 'mailer/gym/form.html'
list_type = None
gym = None
diff --git a/wger/settings_global.py b/wger/settings_global.py
index b1e696a88..6a3eb27d2 100644
--- a/wger/settings_global.py
+++ b/wger/settings_global.py
@@ -53,7 +53,7 @@ INSTALLED_APPS = (
# Apps from wger proper
'wger.config',
'wger.core',
- 'wger.email',
+ 'wger.mailer',
'wger.exercises',
'wger.gym',
'wger.manager',
diff --git a/wger/tasks.py b/wger/tasks.py
index 4bfe368ee..05da0d664 100644
--- a/wger/tasks.py
+++ b/wger/tasks.py
@@ -15,46 +15,26 @@
# You should have received a copy of the GNU Affero General Public License
# Standard Library
-import ctypes # noqa E402
-import logging # noqa E402
-import os # noqa E402
-import pathlib # noqa E402
-import socket # noqa E402
+import ctypes
+import logging
+import os
+import pathlib
+import socket
import sys
-import threading # noqa E402
-import time # noqa E402
-import webbrowser # noqa E402
+import threading
+import time
+import webbrowser
# Third Party
-from invoke import task # noqa E402
-
-
-#
-# This is an ugly and terrible hack, please don't do this!
-#
-# The reason we do this is that during django's setup later in this script, it
-# tries to load the standard library's "mail" module which collides with our
-# (perhaps unluckily named) app with the same name. Since this script is only
-# used for installation and does not depend on anything from wger proper, it
-# is kind of OK to change the system path. Also, some of the errors only
-# occur in travisCI
-
-# Remove all falsy values from path (such as "", the current folder)
-sys.path = list(filter(None, sys.path))
-
-# Remove the wger source folder
-try:
- sys.path.remove(pathlib.Path(__file__).parent.absolute())
-except ValueError:
- pass
+from invoke import task
# Django
-import django # noqa E402
-from django.core.management import ( # noqa E402
+import django
+from django.core.management import (
call_command,
execute_from_command_line
)
-from django.utils.crypto import get_random_string # noqa E402
+from django.utils.crypto import get_random_string
logger = logging.getLogger(__name__)
diff --git a/wger/urls.py b/wger/urls.py
index 66d93ae99..bba734895 100644
--- a/wger/urls.py
+++ b/wger/urls.py
@@ -113,7 +113,7 @@ urlpatterns = i18n_patterns(
url(r'software/', include(('wger.software.urls', 'software'), namespace='software')),
url(r'config/', include(('wger.config.urls', 'config'), namespace='config')),
url(r'gym/', include(('wger.gym.urls', 'gym'), namespace='gym')),
- url(r'email/', include(('wger.email.urls', 'email'), namespace='email')),
+ url(r'email/', include(('wger.mailer.urls', 'email'), namespace='email')),
url(r'^sitemap\.xml$',
sitemap,
{'sitemaps': sitemaps},