logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

[mb-commits] r8202 - mb2cddb/trunk/mb2cddb: msg#00205

Subject: [mb-commits] r8202 - mb2cddb/trunk/mb2cddb
Author: robert
Date: 2006-07-18 03:38:20 +0000 (Tue, 18 Jul 2006)
New Revision: 8202

Modified:
   mb2cddb/trunk/mb2cddb/request.py
Log:
Checking in inhouseuk's patch to make sure that the gateway always returns \r 
for each line of text


Modified: mb2cddb/trunk/mb2cddb/request.py
===================================================================
--- mb2cddb/trunk/mb2cddb/request.py    2006-07-17 20:10:45 UTC (rev 8201)
+++ mb2cddb/trunk/mb2cddb/request.py    2006-07-18 03:38:20 UTC (rev 8202)
@@ -31,20 +31,20 @@
         self.server_port = server_port
 
     def do_CDDB_HELLO(self, cmd, hello, proto):
-        return "500 Unsupported CGI mode command.\n"
+        return "500 Unsupported CGI mode command.\r\n"
 
     def do_CDDB_LSCAT(self, cmd, hello, proto):
         out = []
-        out.append("210 OK, category list follows (until terminating `.')\n")
-        out.append("rock\n")
-        out.append("jazz\n")
-        out.append(".\n")
+        out.append("210 OK, category list follows (until terminating `.')\r")
+        out.append("rock\r")
+        out.append("jazz\r")
+        out.append(".\r\n")
         return "".join(out)
 
     def do_CDDB_QUERY(self, cmd, hello, proto):
         cmd = cmd.lower().split(' ', 1)
         if len(cmd) < 1:
-            return "500 Command syntax error.\n"
+            return "500 Command syntax error.\r\n"
             
         discId = cmd[0]
         
@@ -90,7 +90,7 @@
     def do_CDDB_READ(self, cmd, hello, proto):
         cmd = cmd.lower().split(' ', 2)
         if len(cmd) < 2:
-            return "500 Command syntax error.\n"
+            return "500 Command syntax error.\r\n"
 
         db = self.pool.getconn()
         cursor = db.cursor()
@@ -130,10 +130,10 @@
                 """, (cmd[1],))
                 
         else:
-            return "401 Specified CDDB entry not found.\n"
+            return "401 Specified CDDB entry not found.\r\n"
 
         if cursor.rowcount == 0:
-            return "401 Specified CDDB entry not found.\n"
+            return "401 Specified CDDB entry not found.\r\n"
 
         albumId, album, artistId, artist = cursor.fetchone()    
 
@@ -212,98 +212,98 @@
         return out 
         
     def do_CDDB_UNLINK(self, cmd, hello, proto):
-        return "500 Command syntax error, command unknown, command 
unimplemented.\n"
+        return "500 Command syntax error, command unknown, command 
unimplemented.\r\n"
         
     def do_CDDB_WRITE(self, cmd, hello, proto):
-        return "500 Command syntax error, command unknown, command 
unimplemented.\n"
+        return "500 Command syntax error, command unknown, command 
unimplemented.\r\n"
         
     def do_DISCID(self, cmd, hello, proto):
-        return "500 Command syntax error, command unknown, command 
unimplemented.\n"
+        return "500 Command syntax error, command unknown, command 
unimplemented.\r\n"
         
     def do_GET(self, cmd, hello, proto):
-        return "500 Command syntax error, command unknown, command 
unimplemented.\n"
+        return "500 Command syntax error, command unknown, command 
unimplemented.\r\n"
         
     def do_HELP(self, cmd, hello, proto):
-        return """210 OK, help information follows (until terminating `.')
-The following commands are supported:
-
-CDDB <subcmd> (valid subcmds: HELLO LSCAT QUERY READ UNLINK WRITE)
-DISCID <ntrks> <off_1> <off_2> <...> <off_n> <nsecs>
-GET <file>
-HELP [command [subcmd]]
-LOG [-l lines] [get [-f flag]] [start_time [end_time]] | [day [days]]
-MOTD
-PROTO [level]
-PUT <file>
-QUIT
-SITES
-STAT
-UPDATE
-VALIDATE
-VER
-WHOM
-.
+        return """210 OK, help information follows (until terminating `.')\r
+The following commands are supported:\r
+\r
+CDDB <subcmd> (valid subcmds: HELLO LSCAT QUERY READ UNLINK WRITE)\r
+DISCID <ntrks> <off_1> <off_2> <...> <off_n> <nsecs>\r
+GET <file>\r
+HELP [command [subcmd]]\r
+LOG [-l lines] [get [-f flag]] [start_time [end_time]] | [day [days]]\r
+MOTD\r
+PROTO [level]\r
+PUT <file>\r
+QUIT\r
+SITES\r
+STAT\r
+UPDATE\r
+VALIDATE\r
+VER\r
+WHOM\r
+.\r\n
 """
 
     def do_LOG(self, cmd, hello, proto):
-        return "500 Command syntax error, command unknown, command 
unimplemented.\n"
+        return "500 Command syntax error, command unknown, command 
unimplemented.\r\n"
 
     def do_MOTD(self, cmd, hello, proto):
-        return """210 Last modified: 07/04/2006 12:00:00 MOTD follows (until 
terminating `.')
-Welcome to the MusicBrainz CDDB gateway.
-You can find the MusicBrainz website at http://musicbrainz.org/
-.
+        return """210 Last modified: 07/04/2006 12:00:00 MOTD follows (until 
terminating `.')\r
+Welcome to the MusicBrainz CDDB gateway.\r
+You can find the MusicBrainz website at http://musicbrainz.org/\r
+.\r\n
 """
         
     def do_PROTO(self, cmd, hello, proto):
-        return "500 Unsupported http mode command.\n"
+        return "500 Unsupported http mode command.\r\n"
         
     def do_PUT(self, cmd, hello, proto):
-        return "500 Unsupported http mode command.\n"
+        return "500 Unsupported http mode command.\r\n"
         
     def do_QUIT(self, cmd, hello, proto):
-        return "500 Unsupported http mode command.\n"
+        return "500 Unsupported http mode command.\r\n"
         
     def do_SITES(self, cmd, hello, proto):
-        return """210 OK, site information follows (until terminating `.')
-%s http %d /~cddb/cddb.cgi N000.00 W000.00 MusicBrainz CDDB gateway
-.
+        return """210 OK, site information follows (until terminating `.')\r
+%s http %d /~cddb/cddb.cgi N000.00 W000.00 MusicBrainz CDDB gateway\r
+.\r\n
 """ % (self.server_name, self.server_port)
         
     def do_STAT(self, cmd, hello, proto):
-        return """210 OK, status information follows (until terminating `.')
-Server status:
-    current proto: 6
-    max proto: 6
-    interface: http
-    gets: no
-    puts: no
-    updates: no
-    posting: no
-    validation: accepted
-    quotes: yes
-    strip ext: no
-    secure: no
-    current users: 1
-    max users: 1
-Database entries: 2
-Database entries by category:
-    rock: 1
-    jazz: 1
-."""
+        return """210 OK, status information follows (until terminating `.')\r
+Server status:\r
+    current proto: 6\r
+    max proto: 6\r
+    interface: http\r
+    gets: no\r
+    puts: no\r
+    updates: no\r
+    posting: no\r
+    validation: accepted\r
+    quotes: yes\r
+    strip ext: no\r
+    secure: no\r
+    current users: 1\r
+    max users: 1\r
+Database entries: 2\r
+Database entries by category:\r
+    rock: 1\r
+    jazz: 1\r
+.\r\n"""
         
     def do_UPDATE(self, cmd, hello, proto):
-        return "500 Unsupported http mode command.\n"
+        return "500 Unsupported http mode command.\r\n"
         
     def do_VALIDATE(self, cmd, hello, proto):
-        return "500 Unsupported http mode command.\n"
+        return "500 Unsupported http mode command.\r\n"
         
     def do_VER(self, cmd, hello, proto):
-        return "200 mb2cddb %s, Copyright (c) 2006 Lukáš Lalinský.\n" % \
+        return "200 mb2cddb %s, Copyright (c) 2006 Lukáš Lalinský.\r\n" % \
             (mb2cddb.__version__,)
         
     def do_WHOM(self, cmd, hello, proto):
-        return "401 No user information available.\n"
+        return "401 No user information available.\r\n"
         
     def do_CDDB(self, cmd, hello, proto):
         self.dispatch(cmd, hello, proto, 'do_CDDB_')
@@ -316,7 +316,7 @@
             args = cmd[1]
         mname = prefix + cmd[0].upper()
         if not hasattr(self, mname):
-            self.wfile.write("500 Unrecognized command.\n")
+            self.wfile.write("500 Unrecognized command.\r\n")
             return
         method = getattr(self, mname)
         resp = method(args, hello, proto)


<Prev in Thread] Current Thread [Next in Thread>