def _get_username(self, defuser): if defuser is None: defuser = get_user("root") rv = self.ctx.input("Username: [%s]" % defuser) if not rv: return defuser else: return rv
def _get_username(self, defuser): if defuser is None: defuser = get_user("root") self._require_tty("cannot request username") rv = self.ctx.input("Username: [%s]" % defuser) if not rv: return defuser else: return rv
def main(): """ Default main() that performs OMERO data directory cleansing. """ try: options, args = getopt(sys.argv[1:], "u:k:", ["dry-run"]) except GetoptError as xxx_todo_changeme: (msg, opt) = xxx_todo_changeme.args usage(msg) try: data_dir, = args except: usage('Expecting single OMERO data directory!') username = get_user("root") session_key = None dry_run = False for option, argument in options: if option == "-u": username = argument if option == "-k": session_key = argument if option == "--dry-run": dry_run = True if session_key is None: print("Username: %s" % username) try: password = getpass.getpass() except KeyboardInterrupt: sys.exit(2) try: client = omero.client('localhost') client.setAgent("OMERO.cleanse") if session_key is None: client.createSession(username, password) else: client.createSession(session_key) except PermissionDeniedException: print("%s: Permission denied" % sys.argv[0]) print("Sorry.") sys.exit(1) try: cleanse(data_dir, client, dry_run) finally: if session_key is None: client.closeSession()
def requests_user(self, user = '******'): self.REQRESP["Username: [%s]" % get_user("Unknown")] = user
def requests_user(self, user='******'): self.REQRESP["Username: [%s]" % get_user("Unknown")] = user
def username(self): """ Returns the current OS-user's name """ return get_user("Unknown")
def main(): """ Default main() that performs OMERO data directory cleansing. """ try: options, args = getopt(sys.argv[1:], "u:k:", ["dry-run"]) except GetoptError, (msg, opt): usage(msg) try: data_dir, = args except: usage('Expecting single OMERO data directory!') username = get_user("root") session_key = None dry_run = False for option, argument in options: if option == "-u": username = argument if option == "-k": session_key = argument if option == "--dry-run": dry_run = True if session_key is None: print "Username: %s" % username try: password = getpass.getpass() except KeyboardInterrupt: