Use inspect_table; default user license==None.
[mediagoblin.git] / mediagoblin / gmg_commands / util.py
index 8dcac913f0db519c27b2675bbbdc44ff5bca5ded..6a6853d5d14527098dda4f31083026dc0d1be724 100644 (file)
@@ -1,5 +1,5 @@
 # GNU MediaGoblin -- federated, autonomous media hosting
-# Copyright (C) 2011 Free Software Foundation, Inc
+# Copyright (C) 2011, 2012 MediaGoblin contributors.  See AUTHORS.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Affero General Public License as published by
@@ -16,6 +16,7 @@
 
 
 from mediagoblin import app
+import getpass
 
 
 def setup_app(args):
@@ -25,3 +26,15 @@ def setup_app(args):
     mgoblin_app = app.MediaGoblinApp(args.conf_file)
 
     return mgoblin_app
+
+def prompt_if_not_set(variable, text, password=False):
+    """
+    Checks if the variable is None and prompt for a value if it is
+    """
+    if variable is None:
+        if not password:
+            variable=raw_input(text + u' ')
+        else:
+            variable=getpass.getpass(text + u' ')
+    
+    return variable