コード例 #1
0
 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
コード例 #2
0
 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
コード例 #3
0
ファイル: sessions.py プロジェクト: mtbc/omero-py
 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
コード例 #4
0
ファイル: cleanse.py プロジェクト: tlambert-forks/omero-py
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()
コード例 #5
0
 def requests_user(self, user = '******'):
     self.REQRESP["Username: [%s]" % get_user("Unknown")] = user
コード例 #6
0
ファイル: test_sess.py プロジェクト: zfarooq2/openmicroscopy
 def requests_user(self, user='******'):
     self.REQRESP["Username: [%s]" % get_user("Unknown")] = user
コード例 #7
0
ファイル: temp_files.py プロジェクト: sbesson/openmicroscopy
 def username(self):
     """
     Returns the current OS-user's name
     """
     return get_user("Unknown")
コード例 #8
0
ファイル: cleanse.py プロジェクト: zfarooq2/openmicroscopy
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:
コード例 #9
0
ファイル: temp_files.py プロジェクト: tlambert-forks/omero-py
 def username(self):
     """
     Returns the current OS-user's name
     """
     return get_user("Unknown")
コード例 #10
0
ファイル: cleanse.py プロジェクト: bramalingam/openmicroscopy
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: