[Commits] (morgen) Allow comments (#) in inbound.txt, deal with rss items with no displayName, and don't give twisted any unicode.

commits at osafoundation.org commits at osafoundation.org
Thu Apr 14 23:48:14 PDT 2005


Commit by: morgen
Modified files:
chandler/parcels/osaf/framework/webserver/servlets/inbound/Inbound.py 1.4 1.5

Log message:
Allow comments (#) in inbound.txt, deal with rss items with no displayName, and don't give twisted any unicode.


ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/webserver/servlets/inbound/Inbound.py.diff?r1=text&tr1=1.4&r2=text&tr2=1.5

Index: chandler/parcels/osaf/framework/webserver/servlets/inbound/Inbound.py
diff -u chandler/parcels/osaf/framework/webserver/servlets/inbound/Inbound.py:1.4 chandler/parcels/osaf/framework/webserver/servlets/inbound/Inbound.py:1.5
--- chandler/parcels/osaf/framework/webserver/servlets/inbound/Inbound.py:1.4	Wed Mar 30 18:48:31 2005
+++ chandler/parcels/osaf/framework/webserver/servlets/inbound/Inbound.py	Thu Apr 14 23:48:13 2005
@@ -1,5 +1,5 @@
-__revision__  = "$Revision: 1.4 $"
-__date__      = "$Date: 2005/03/31 02:48:31 $"
+__revision__  = "$Revision: 1.5 $"
+__date__      = "$Date: 2005/04/15 06:48:13 $"
 __copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation"
 __license__   = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -26,6 +26,8 @@
         for url in urls:
             try:
                 url = url.strip()
+                if url.startswith('#'):
+                    continue
                 logger.info("Adding channel from file: %s" % url)
                 newChannel = RSSChannel(view=view)
                 newChannel.url = url
@@ -98,7 +100,10 @@
         except Exception, e: # outer try
             result = "<html>Caught an exception: %s<br> %s</html>" % (e, "<br>".join(traceback.format_tb(sys.exc_traceback)))
 
-        return str(result)
+        if isinstance(result, unicode):
+            result = result.encode('ascii', 'replace')
+            
+        return result
 
 
 
@@ -170,10 +175,14 @@
 
         count = 0
         for item in items:
+            try:
+                displayName = item.displayName
+            except:
+                displayName = "No Title"
             result += oddEvenRow(count)
             result += "<td>"
             result += "&nbsp;<a href=/inbound/%s>%s</a>" % (item.itsUUID,
-              item.displayName)
+              displayName)
             result += "</td></tr>"
             count += 1
 
@@ -183,7 +192,11 @@
 
     if theItem is not None:
         item = theItem
-        result += "<span class=header><a href=%s>%s</a></span></br>" % (item.link, item.displayName)
+        try:
+            displayName = item.displayName
+        except:
+            displayName = "No Title"
+        result += "<span class=header><a href=%s>%s</a></span></br>" % (item.link, displayName)
         result += "<b>%s</b> | %s</br>" % (item.channel.displayName, item.date.localtime().strftime('%A, %B %d @ %I:%M %p'))
 
         try:



More information about the Commits mailing list