[Checkins] SVN: Products.AsyncMailhost/trunk/ the standard boilerplate

Andreas Jung andreas at andreas-jung.com
Sat Aug 18 08:56:32 EDT 2007


Log message for revision 78926:
  the standard boilerplate
  

Changed:
  A   Products.AsyncMailhost/trunk/__init__.py
  A   Products.AsyncMailhost/trunk/header.txt
  A   Products.AsyncMailhost/trunk/mailhost.py
  A   Products.AsyncMailhost/trunk/pt/
  A   Products.AsyncMailhost/trunk/pt/addMailHostForm.zpt
  A   Products.AsyncMailhost/trunk/ww/

-=-
Added: Products.AsyncMailhost/trunk/__init__.py
===================================================================
--- Products.AsyncMailhost/trunk/__init__.py	                        (rev 0)
+++ Products.AsyncMailhost/trunk/__init__.py	2007-08-18 12:56:32 UTC (rev 78926)
@@ -0,0 +1,19 @@
+##########################################################################
+# A transaction-aware Mailhost implementation based on zope.sendmail
+#
+# (C) Zope Corporation and Contributors
+# Written by Andreas Jung for ZOPYX Ltd. & Co. KG, Tuebingen, Germany
+##########################################################################
+
+
+from AccessControl.Permissions import add_mailhost_objects
+
+def initialize(context):
+
+    from mailhost import (MailHost, manage_addMailHost, manage_addMailHostForm)
+
+    context.registerClass(MailHost, 
+                          constructors=(manage_addMailHostForm, 
+                                        manage_addMailHost),
+                          icon='www/MailHost_icon.gif',
+                          permission=add_mailhost_objects)

Added: Products.AsyncMailhost/trunk/header.txt
===================================================================
--- Products.AsyncMailhost/trunk/header.txt	                        (rev 0)
+++ Products.AsyncMailhost/trunk/header.txt	2007-08-18 12:56:32 UTC (rev 78926)
@@ -0,0 +1,7 @@
+##########################################################################
+# A transaction-aware Mailhost implementation based on zope.sendmail
+#
+# (C) Zope Corporation and Contributors
+# Written by Andreas Jung for ZOPYX Ltd. & Co. KG, Tuebingen, Germany
+##########################################################################
+

Added: Products.AsyncMailhost/trunk/mailhost.py
===================================================================
--- Products.AsyncMailhost/trunk/mailhost.py	                        (rev 0)
+++ Products.AsyncMailhost/trunk/mailhost.py	2007-08-18 12:56:32 UTC (rev 78926)
@@ -0,0 +1,67 @@
+##########################################################################
+# A transaction-aware Mailhost implementation based on zope.sendmail
+#
+# (C) Zope Corporation and Contributors
+# Written by Andreas Jung for ZOPYX Ltd. & Co. KG, Tuebingen, Germany
+##########################################################################
+
+import os
+import logging
+import random
+import time
+
+from Globals import InitializeClass
+from AccessControl import ClassSecurityInfo
+from AccessControl.Permissions import view, view_management_screens
+from OFS.SimpleItem import SimpleItem
+from OFS.PropertyManager import PropertyManager
+from Products.PageTemplates.PageTemplateFile import PageTemplateFile
+
+import zope.sendmail
+
+
+LOG = logging.getLogger('AsyncMailHost')
+
+
+
+class MailHost(SimpleItem, PropertyManager):
+    """ A transaction-aware MailHost implementation """
+
+    manage_options = PropertyManager.manage_options + \
+                     SimpleItem.manage_options
+    _properties = (
+        {'id' : 'smtp_host', 'type' : 'string', 'mode' : 'rw', },
+        {'id' : 'smtp_port', 'type' : 'int', 'mode' : 'rw'}, 
+    )
+
+    id = 'MailHost'
+    meta_type = 'AsyncMailHost'
+    smtp_host = 'localhost'
+    smtp_port = 25
+
+    security = ClassSecurityInfo()
+
+    def __init__(self, id, title='', smtp_host='localhost', smtp_port=25):
+        self.id = id
+        self.title = title
+        self.smtp_host = smtp_host
+        self.smtp_port = smtp_port
+
+
+InitializeClass(MailHost)
+
+
+
+def manage_addMailHost(self, id='MailHost', title='', smtp_host='localhost', smtp_port=25, RESPONSE=None):
+    """ create a new MailHost instance """
+    
+    mh = MailHost(id, title, smtp_host, smtp_port)
+    self._setObject(mh.getId(), mh.__of__(self))
+    if RESPONSE:
+        return RESPONSE.redirect(self._getOb(id).absolute_url() + '/manage_workspace')
+    else:
+        return mh
+
+manage_addMailHostForm = PageTemplateFile('pt/addMailHostForm', 
+                                           globals(), 
+                                           __name__='addMailhostForm')

Added: Products.AsyncMailhost/trunk/pt/addMailHostForm.zpt
===================================================================
--- Products.AsyncMailhost/trunk/pt/addMailHostForm.zpt	                        (rev 0)
+++ Products.AsyncMailhost/trunk/pt/addMailHostForm.zpt	2007-08-18 12:56:32 UTC (rev 78926)
@@ -0,0 +1,48 @@
+<div tal:replace="structure context/manage_page_header" />
+<div tal:replace="structure context/manage_tabs" />
+
+<p class="form-help">
+Add an AsyncMailHost 
+</p>
+
+
+<form action="manage_addMailHost" method="post" enctype="multipart/form-data" name="addform">
+<table cellspacing="0" cellpadding="2" border="0">
+  <tr>
+    <td>
+    <div class="form-label">
+    Id
+    </div>
+    </td>
+    <td>
+      <input type="text" name="id" size="40" />
+    </td>
+  </tr>
+
+  <tr>
+    <td>
+    <div class="form-label">
+    Title
+    </div>
+    </td>
+    <td>
+      <input type="text" name="title" size="40" value=""/>
+    </td>
+  </tr>
+
+  <tr>
+    <td>
+    </td>
+    <td   colspan="2">
+    <div class="form-element">
+    <input class="form-element" type="submit" name="submit" 
+     value=" Add " /> 
+    </div>
+    </td>
+  </tr>
+</table>
+
+
+</form>
+
+<div tal:replace="structure context/manage_page_footer" />



More information about the Checkins mailing list