Beispiel #1
0
    def email(self, args):
        c = self.ctx.conn(args)
        a = c.sf.getAdminService()

        skipped = []
        records = []
        for exp in a.lookupExperimenters():

            # Handle users without email
            if not _(exp.email):
                if not args.ignore:
                    skipped.append(exp)
                continue

            record = ""
            if args.names:
                record += '"%s"' % self.format_name(exp)
                record += " <%s>" % _(exp.email)
            else:
                record += _(exp.email)

            records.append(record)

        if args.one:
            for record in records:
                self.ctx.out(record)
        else:
            self.ctx.out(", ".join(records))

        if skipped:
            self.ctx.err("Missing email addresses:")
            for s in skipped:
                self.ctx.err(self.format_name(s))
Beispiel #2
0
    def email(self, args):
        c = self.ctx.conn(args)
        a = c.sf.getAdminService()

        skipped = []
        records = []
        for exp in a.lookupExperimenters():

            # Handle users without email
            if not _(exp.email):
                if not args.ignore:
                    skipped.append(exp)
                continue

            record = ""
            if args.names:
                record += '"%s"' % self.format_name(exp)
                record += " <%s>" % _(exp.email)
            else:
                record += _(exp.email)

            records.append(record)

        if args.one:
            for record in records:
                self.ctx.out(record)
        else:
            self.ctx.out(", ".join(records))

        if skipped:
            self.ctx.err("Missing email addresses:")
            for s in skipped:
                self.ctx.err(self.format_name(s))
Beispiel #3
0
 def format_name(self, exp):
     record = ""
     fn = _(exp.firstName)
     mn = " "
     if _(exp.middleName):
         mn = " %s " % _(exp.middleName)
     ln = _(exp.lastName)
     record += "%s%s%s" % (fn, mn, ln)
     return record
Beispiel #4
0
 def format_name(self, exp):
     record = ""
     fn = _(exp.firstName)
     mn = " "
     if _(exp.middleName):
         mn = " %s " % _(exp.middleName)
     ln = _(exp.lastName)
     record += "%s%s%s" % (fn, mn, ln)
     return record
Beispiel #5
0
 def mkentry(self, clientPath):
     originalFile = omero.model.OriginalFileI()
     parts = clientPath.split("/")
     path = "/".join(parts[:-1])
     name = parts[-1]
     originalFile.path = _(path)
     originalFile.name = _(name)
     # etc.
     entry = omero.model.FilesetEntryI()
     entry.clientPath = _(clientPath)
     entry.originalFile = originalFile
     return entry
Beispiel #6
0
 def mkentry(self, clientPath):
     originalFile = omero.model.OriginalFileI()
     parts = clientPath.split("/")
     path = "/".join(parts[:-1])
     name = parts[-1]
     originalFile.path = _(path)
     originalFile.name = _(name)
     # etc.
     entry = omero.model.FilesetEntryI()
     entry.clientPath = _(clientPath)
     entry.originalFile = originalFile
     return entry
Beispiel #7
0
    def email(self, args):
        c = self.ctx.conn(args)
        a = c.sf.getAdminService()
        r = a.getSecurityRoles()

        skipped = []
        records = []
        for exp in a.lookupExperimenters():

            # Handle users without email
            if not _(exp.email):
                if not args.ignore:
                    skipped.append(exp)
                continue

            # Handle deactivated users
            if not args.all:
                groups = exp.linkedExperimenterGroupList()
                group_ids = [x.id.val for x in groups]
                if r.userGroupId not in group_ids:
                    continue

            record = ""
            if args.names:
                record += '"%s"' % self.format_name(exp)
                record += " <%s>" % _(exp.email)
            else:
                record += _(exp.email)

            records.append(record)

        if args.one:
            for record in records:
                self.ctx.out(record)
        else:
            self.ctx.out(", ".join(records))

        if skipped:
            self.ctx.err("Missing email addresses:")
            for s in skipped:
                self.ctx.err(self.format_name(s))
Beispiel #8
0
    def email(self, args):
        c = self.ctx.conn(args)
        a = c.sf.getAdminService()
        r = a.getSecurityRoles()

        skipped = []
        records = []
        for exp in a.lookupExperimenters():

            # Handle users without email
            if not _(exp.email):
                if not args.ignore:
                    skipped.append(exp)
                continue

            # Handle deactivated users
            if not args.all:
                groups = exp.linkedExperimenterGroupList()
                group_ids = [x.id.val for x in groups]
                if r.userGroupId not in group_ids:
                    continue

            record = ""
            if args.names:
                record += '"%s"' % self.format_name(exp)
                record += " <%s>" % _(exp.email)
            else:
                record += _(exp.email)

            records.append(record)

        if args.one:
            for record in records:
                self.ctx.out(record)
        else:
            self.ctx.out(", ".join(records))

        if skipped:
            self.ctx.err("Missing email addresses:")
            for s in skipped:
                self.ctx.err(self.format_name(s))
Beispiel #9
0
    def testBasicImport(self):
        """
        basic server-side import steps

        Once a list of file paths have been passed to the server,
        an omero.model.Fileset object will be created which captures
        the state of the import.
        """

        # This should be passed in by the client
        clientInfo = omero.model.FilesetVersionInfoI()

        # This will be created server-side
        serverInfo = omero.model.FilesetVersionInfoI()
        serverInfo.bioformatsReader = _("ExampleReader")
        serverInfo.bioformatsVersion = _("v4.4.5 git: abc123")
        serverInfo.omeroVersion = _("v.4.4.4 git: def456")
        serverInfo.osName = _("Linux")
        serverInfo.osArchitecture = _("amd64")
        serverInfo.osVersion = _("2.6.38-8-generic")
        # Something returned by Locale.getDefault().toString()
        serverInfo.locale = "en_US"

        # Now that the basics are setup, we
        # need to link to all of the original files.
        fs = omero.model.FilesetI()
        fs.addFilesetEntry(self.mkentry("main_file.txt")) # First!
        fs.addFilesetEntry(self.mkentry("uf1.data"))
        fs.addFilesetEntry(self.mkentry("uf2.data"))

        # Now that the files are all added, we
        # add the "activities" that will be
        # performed on them.

        # Uploading is almost always the first
        # step, and must be completed by the clients
        # before any other activity.
        job1 = omero.model.UploadJobI()
        job1.scheduledFor = rtime(time.time() * 1000) # Now
        # Set this "started" since we're expecting
        # upload to be in process.

        # Import is a server-side activity which
        # causes the files to be parsed and their
        # metadata to be stored.
        job2 = omero.model.MetadataImportJobI()

        # Other possible activities include "pyramids"
        # and "re-import"

        fs.linkJob(job1)
        fs.linkJob(job2)
Beispiel #10
0
    def testBasicImport(self):
        """
        basic server-side import steps

        Once a list of file paths have been passed to the server,
        an omero.model.Fileset object will be created which captures
        the state of the import.
        """

        # This will be created server-side
        serverInfo = omero.model.FilesetVersionInfoI()
        serverInfo.bioformatsReader = _("ExampleReader")
        serverInfo.bioformatsVersion = _("v4.4.5 git: abc123")
        serverInfo.omeroVersion = _("v.4.4.4 git: def456")
        serverInfo.osName = _("Linux")
        serverInfo.osArchitecture = _("amd64")
        serverInfo.osVersion = _("2.6.38-8-generic")
        # Something returned by Locale.getDefault().toString()
        serverInfo.locale = "en_US"

        # Now that the basics are setup, we
        # need to link to all of the original files.
        fs = omero.model.FilesetI()
        fs.addFilesetEntry(self.mkentry("main_file.txt"))  # First!
        fs.addFilesetEntry(self.mkentry("uf1.data"))
        fs.addFilesetEntry(self.mkentry("uf2.data"))

        # Now that the files are all added, we
        # add the "activities" that will be
        # performed on them.

        # Uploading is almost always the first
        # step, and must be completed by the clients
        # before any other activity.
        job1 = omero.model.UploadJobI()
        job1.scheduledFor = rtime(time.time() * 1000)  # Now
        # Set this "started" since we're expecting
        # upload to be in process.

        # Import is a server-side activity which
        # causes the files to be parsed and their
        # metadata to be stored.
        job2 = omero.model.MetadataImportJobI()

        # Other possible activities include "pyramids"
        # and "re-import"

        fs.linkJob(job1)
        fs.linkJob(job2)