diff --git a/src/postorius/doc/news.rst b/src/postorius/doc/news.rst
index 8322149..54fe546 100644
--- a/src/postorius/doc/news.rst
+++ b/src/postorius/doc/news.rst
@@ -36,6 +36,7 @@
* all code now conform to PEP8
* themes: removed obsolete MAILMAN_THEME settings from templates, contexts, file structure; contributed by Richard Wackerbarth (LP: 1043258)
* added access control for list owners and moderators
+* added a mailmanclient shell to use as a `manage.py` command (`python manage.py mmclient`)
1.0 alpha 1 -- "Space Farm"
diff --git a/src/postorius/management/__init__.py b/src/postorius/management/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/postorius/management/__init__.py
diff --git a/src/postorius/management/commands/__init__.py b/src/postorius/management/commands/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/postorius/management/commands/__init__.py
diff --git a/src/postorius/management/commands/mmclient.py b/src/postorius/management/commands/mmclient.py
new file mode 100644
index 0000000..1e5ec07
--- /dev/null
+++ b/src/postorius/management/commands/mmclient.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 1998-2012 by the Free Software Foundation, Inc.
+#
+# This file is part of Postorius.
+#
+# Postorius is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# Postorius is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Postorius. If not, see .
+
+from django.conf import settings
+from django.core.management.base import BaseCommand, CommandError
+from mailmanclient import Client, MailmanConnectionError
+from urllib2 import HTTPError
+
+class Command(BaseCommand):
+ help = """Opens a Python shell with a mailmanclient object named `client`.
+
+Usage example:
+ client.lists
+ []
+ foo = client.get_list('foo@example.org')
+ foo.members
+ []
+
+A complete list of commands can be found in the mailman.client documentation."""
+
+ def handle(self, *args, **options):
+ # choose an interpreter
+ console = None
+ try:
+ import IPython
+ console_fn = IPython.embed
+ except ImportError:
+ import code
+ shell = code.InteractiveConsole(globals())
+ console_fn = shell.interact
+ # connect to mailmanclient
+ client = Client('%s/3.0' % settings.REST_SERVER,
+ settings.API_USER, settings.API_PASS)
+ # run the interpreter
+ console_fn()
diff --git a/src/postorius/models.py b/src/postorius/models.py
index 22ad4e4..71fb61c 100644
--- a/src/postorius/models.py
+++ b/src/postorius/models.py
@@ -19,7 +19,10 @@
import logging
from django.conf import settings
+from django.contrib.auth.models import User
+from django.db.models.signals import pre_save
from django.db import models
+from django.dispatch import receiver
from django.http import Http404
from mailmanclient import Client, MailmanConnectionError
from urllib2 import HTTPError
@@ -171,3 +174,9 @@
"""Member model class.
"""
objects = MailmanRestManager('member', 'members')
+
+
+@receiver(pre_save, sender=User)
+def user_create_callback(sender, **kwargs):
+ # inst = kwargs['instance']
+ pass