Permalink
Browse files

new db schmeme needed to be pushed into other tools

  • Loading branch information...
1 parent 5a1a2ec commit 25c637c5d4f670116d86ef57e387398cb9d54fee BuzzTroll committed Oct 7, 2010
Showing with 13 additions and 3 deletions.
  1. +2 −0 cumulus/authz/pynimbusauthz/__init__.py
  2. +11 −3 cumulus/authz/pynimbusauthz/db.py
@@ -81,6 +81,8 @@ def random_string_gen(len):
def get_db_connection_string():
con_str = os.environ['NIMBUS_AUTHZ_DB']
+ if con_str[0] == "/":
+ con_str = "sqlite:///" + con_str
return con_str
def parse_args(p, all_opts, argv):
@@ -27,10 +27,18 @@ def __init__(self, con_str=None, con=None):
self.replace_char = None
if con_str != None:
- url = urlparse.urlparse(con_str)
- if url.scheme == "sqlite" or url.scheme == '':
+ parts_a = con_str.split("://", 1)
+
+ if len(parts_a) > 1:
+ scheme = parts_a[0]
+ rest = parts_a[1]
+ else:
+ rest = con_str
+ scheme = ""
+ url = urlparse.urlparse("http://" + rest)
+ if scheme == "sqlite" or scheme == '':
self.con = sqlite3.connect(url.path)
- elif url.scheme == "psycopg2":
+ elif scheme == "psycopg2":
import psycopg2
self.replace_char = '%s'

0 comments on commit 25c637c

Please sign in to comment.