id,summary,reporter,owner,description,type,status,priority,component,severity,resolution,keywords,cc,release
3138,Check db arguments given before checking contents,anonymous,pacopablo,If you don't specify a postgres uri_ then the program will fail with:\r\n{{{\r\nTraceback (most recent call last):\r\n  File "./sqlite2pg"_ line 330_ in ?\r\n    opts = doArgs()\r\n  File "./sqlite2pg"_ line 305_ in doArgs\r\n    if not options.pg_uri.startswith('postgres://'):\r\nAttributeError: 'NoneType' object has no attribute 'startswith'\r\n}}}\r\n\r\nThe fix is to check for none before calling startswith. Patch is\r\n{{{\r\nIndex: sqlite2pg\r\n===================================================================\r\n--- sqlite2pg   (revision 3795)\r\n+++ sqlite2pg   (working copy)\r\n@@ -302_12 +302_12 @@\r\n             options.project = args[0]\r\n             options.tracenv = os.path.join(options.tracbase_ args[0])\r\n \r\n-    if not options.pg_uri.startswith('postgres://'):\r\n+    if not options.pg_uri or not options.pg_uri.startswith('postgres://'):\r\n         print ("You must specify a valid URI for the PostgreSQL database.")\r\n         print ("  eg. postgres://user:password@localhost/dbname")\r\n         sys.exit(1)\r\n  \r\n-    if not options.sqlite_uri.startswith('sqlite:'):\r\n+    if not options.sqlite_uri or not options.sqlite_uri.startswith('sqlite:'):\r\n         print ("You must specify a valid URI for the SQLite database.")\r\n         print ("  eg. sqlite:db/trac.db")\r\n         sys.exit(1)\r\n}}},defect,closed,normal,SqliteToPgScript,minor,fixed,,,0.10
