[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r21973: {weather} Mail subjects now make more sense (in weather/trunk: . lib/weather)



Author: kaner
Date: 2010-03-15 21:54:02 +0000 (Mon, 15 Mar 2010)
New Revision: 21973

Modified:
   weather/trunk/Weather.py
   weather/trunk/lib/weather/constants.py
   weather/trunk/lib/weather/poller.py
   weather/trunk/lib/weather/utils.py
Log:
Mail subjects now make more sense


Modified: weather/trunk/Weather.py
===================================================================
--- weather/trunk/Weather.py	2010-03-15 21:18:49 UTC (rev 21972)
+++ weather/trunk/Weather.py	2010-03-15 21:54:02 UTC (rev 21973)
@@ -76,7 +76,8 @@
         url = URLbase + "/confirm-subscribe?auth=" + self.subs_auth
         try:
             mailText = CONFIRMATION_MAIL % (self.node, url)
-            utils.sendMail(mailFrom, self.email, mailText)
+            subject = "Confirmation needed"
+            utils.sendMail(mailFrom, self.email, mailText, subject)
         except Exception, e:
             self.error = "Unknown error while sending confirmation mail. " + \
                          "Please try again later."
@@ -144,7 +145,8 @@
         pageout = PAGE_SUB_FIN % link
         try:
             mailText = SUBS_MAIL % (self.node, url)
-            utils.sendMail(mailFrom, self.email, mailText)
+            subject = "Subscription successfull"
+            utils.sendMail(mailFrom, self.email, mailText, subject)
         except Exception, e:
             pageout += "\n\nUnknown error while sending confirmation mail."
             print e

Modified: weather/trunk/lib/weather/constants.py
===================================================================
--- weather/trunk/lib/weather/constants.py	2010-03-15 21:18:49 UTC (rev 21972)
+++ weather/trunk/lib/weather/constants.py	2010-03-15 21:54:02 UTC (rev 21973)
@@ -100,7 +100,7 @@
 </p>
 <p>
 How many hours of downtime until we send a notification:<br>
-<input type="text" name="downtime" size="50" maxlength="255" value="Default is 1 hour, enter up to 8760 (1 year)" onclick="if (this.value == 'Default is 1 hour, enter up to 8760 (1 year)') {this.value = ''}" />
+<input type="text" name="downtime" size="50" maxlength="255" value="Default is 1 hour, enter up to 8760 (1 year)" onclick="if (this.value == 'Default is 1 hour, enter up to 8760 (1 year)') {this.value = '1'}" />
 </p>
 <p>
 <input type="submit" class="submit" value="Subscribe to Tor Weather" name="sa"/>

Modified: weather/trunk/lib/weather/poller.py
===================================================================
--- weather/trunk/lib/weather/poller.py	2010-03-15 21:18:49 UTC (rev 21972)
+++ weather/trunk/lib/weather/poller.py	2010-03-15 21:54:02 UTC (rev 21973)
@@ -69,7 +69,8 @@
         unsubsURL =  URLbase + "/unsubscribe?auth=" + str(unsubs_auth)
         mailText = REPORT_MAIL % (node, unsubsURL)
         try:
-            utils.sendMail(mailFrom, email, mailText)
+            subject = "Report"
+            utils.sendMail(mailFrom, email, mailText, subject)
         except:
             # XXX: Log
             print "Error, exception!"

Modified: weather/trunk/lib/weather/utils.py
===================================================================
--- weather/trunk/lib/weather/utils.py	2010-03-15 21:18:49 UTC (rev 21972)
+++ weather/trunk/lib/weather/utils.py	2010-03-15 21:54:02 UTC (rev 21973)
@@ -70,10 +70,10 @@
     """Our great template engine ;-)"""
     return PAGE_TEMPLATE % text
 
-def sendMail(fromPart, toPart, messageText):
+def sendMail(fromPart, toPart, messageText, subject=""):
     """Send a certain mail text with certain From: and certain To: field"""
     message = MIMEMultipart()
-    message['Subject'] = "Tor Weather Subscription Request"
+    message['Subject'] = "[Tor Weather] " + subject
     message['To'] = toPart
     message['From'] = fromPart