tip from andrew to use proper escaping in my regex
authorBryan Clark <clarkbw@gnome.org>
Wed, 04 Feb 2009 12:11:22 -0800
changeset 42 9e8e39dc38a7919574157806398e290f2c07adc9
parent 41 0d8aa961206ddf2e1a3331c87eefeb3b2d26179c
child 43 afc84851c10a47f658cf04adf866059b23358afd
push id1
push userroot
push dateWed, 08 Apr 2009 01:46:05 +0000
tip from andrew to use proper escaping in my regex
server/python/junius/model.py
--- a/server/python/junius/model.py
+++ b/server/python/junius/model.py
@@ -186,17 +186,17 @@ class Message(schema.Document):
         function(doc) {
             if (doc.timestamp)
                 emit([doc.account_id, doc.storage_path, doc.storage_id], null);
         }''', include_docs=False)
         
     by_mailing_list = schema.View('by_header_id', '''\
         function(doc) {
           if (doc.headers && doc.headers["List-Id"]) {
-            var parts = doc.headers["List-Id"].match(/([\W\w]*)\s*<(.+)>.*/);
+            var parts = doc.headers["List-Id"].match(/([\\W\\w]*)\\s*<(.+)>.*/);
             var values = {"List-Id" : doc.headers["List-Id"],
                           "id" : parts[2],
                           "name" : parts[1] };
             for each (var headerId in ["List-Post","List-Archive","List-Help",
                                        "List-Subscribe","List-Unsubscribe"]) {
               if (doc.headers[headerId])
                 values[headerId] = doc.headers[headerId];
             }
@@ -212,17 +212,17 @@ class Message(schema.Document):
             }
           }
           return output;
         }''', include_docs=False, group=True, group_level=1)
 
     by_list_id = schema.View('by_mailing_list', '''\
         function(doc) {
           if (doc.headers && doc.headers["List-Id"]) {
-            var parts = doc.headers["List-Id"].match(/[\W\w\s]*<(.+)>.*/);
+            var parts = doc.headers["List-Id"].match(/[\\W\\w\\s]*<(.+)>.*/);
             emit([parts[1], doc.timestamp], doc.conversation_id);
           }
         }''', include_docs=True)    
         
 DATABASES = {
     # the app database proper, no real data
     'junius': None,
     #