Пример #1
0
    def __init__(self, conn, year=None, month=None, day=None, eid=None, **kw):
        BaseController.__init__(self, conn)
        self.year = int(year)
        self.month = int(month)
        if eid is None:
            self.eid = self.conn.getEventContext().userId
        else:
            self.eid = eid

        if day:
            self.day = int(day)
            date = datetime.datetime.strptime(
                ("%i-%i-%i" % (self.year, self.month, self.day)), "%Y-%m-%d")
            self.displayDate = '%s %s' % (date.strftime("%A, %d"),
                                          date.strftime("%B %Y"))
            self.nameday = date.strftime("%A")
        else:
            date = datetime.datetime.strptime(
                ("%i-%i" % (self.year, self.month)), "%Y-%m")
Пример #2
0
    def __init__(self, conn, share_id=None, **kw):
        BaseController.__init__(self, conn)

        if share_id is not None:
            self.share = self.conn.getShare(share_id)
            if self.share is None:
                raise AttributeError(
                    "We are sorry, but that share either does not exist, or"
                    " if it does, you have not been invited to see it."
                    " Contact the user you think might own this share for"
                    " more information.")
            if self.share._obj is None:
                raise AttributeError(
                    "We are sorry, but that share either does not exist, or"
                    " if it does, you have not been invited to see it."
                    " Contact the user you think might own this share for"
                    " more information.")
            if (self.share is not None and not self.share.active and not
                    self.share.isOwned()):
                raise AttributeError(
                    "%s is not active and cannot be visible. Please contact"
                    " the user you think might own this share for more"
                    " information." % self.share.getShareType())
Пример #3
0
 def __init__(self, conn, **kw):
     BaseController.__init__(self, conn)
Пример #4
0
 def __init__(self,
              conn,
              project=None,
              dataset=None,
              image=None,
              screen=None,
              plate=None,
              acquisition=None,
              well=None,
              tag=None,
              tagset=None,
              file=None,
              comment=None,
              annotation=None,
              index=None,
              orphaned=None,
              **kw):
     BaseController.__init__(self, conn)
     if project is not None:
         self.obj_type = "project"
         self.project = self.conn.getObject("Project", project)
         self.assertNotNone(self.project, project, "Project")
         self.assertNotNone(self.project._obj, project, "Project")
     if dataset is not None:
         self.obj_type = "dataset"
         self.dataset = self.conn.getObject("Dataset", dataset)
         self.assertNotNone(self.dataset, dataset, "Dataset")
         self.assertNotNone(self.dataset._obj, dataset, "Dataset")
     if screen is not None:
         self.obj_type = "screen"
         self.screen = self.conn.getObject("Screen", screen)
         self.assertNotNone(self.screen, screen, "Screen")
         self.assertNotNone(self.screen._obj, screen, "Screen")
     if plate is not None:
         self.obj_type = "plate"
         self.plate = self.conn.getObject("Plate", plate)
         self.assertNotNone(self.plate, plate, "Plate")
         self.assertNotNone(self.plate._obj, plate, "Plate")
     if acquisition is not None:
         self.obj_type = "acquisition"
         self.acquisition = self.conn.getObject("PlateAcquisition",
                                                acquisition)
         self.assertNotNone(self.acquisition, acquisition,
                            "Plate Acquisition")
         self.assertNotNone(self.acquisition._obj, acquisition,
                            "Plate Acquisition")
     if image is not None:
         self.obj_type = "image"
         self.image = self.conn.getObject("Image", image)
         self.assertNotNone(self.image, image, "Image")
         self.assertNotNone(self.image._obj, image, "Image")
     if well is not None:
         self.obj_type = "well"
         self.well = self.conn.getObject("Well", well)
         self.assertNotNone(self.well, well, "Well")
         self.assertNotNone(self.well._obj, well, "Well")
     if tag is not None:
         self.obj_type = "tag"
         self.tag = self.conn.getObject("Annotation", tag)
         self.assertNotNone(self.tag, tag, "Tag")
         self.assertNotNone(self.tag._obj, tag, "Tag")
     if tagset is not None:
         self.obj_type = "tagset"
         self.tag = self.conn.getObject("Annotation", tagset)
         # We need to check if tagset via hasattr(manager, o_type)
         self.tagset = self.tag
         self.assertNotNone(self.tag, tagset, "Tag")
         self.assertNotNone(self.tag._obj, tagset, "Tag")
     if comment is not None:
         self.obj_type = "comment"
         self.comment = self.conn.getObject("Annotation", comment)
         self.assertNotNone(self.comment, comment, "Comment")
         self.assertNotNone(self.comment._obj, comment, "Comment")
     if file is not None:
         self.obj_type = "file"
         self.file = self.conn.getObject("Annotation", file)
         self.assertNotNone(self.file, file, "File")
         self.assertNotNone(self.file._obj, file, "File")
     if annotation is not None:
         self.obj_type = "annotation"
         self.annotation = self.conn.getObject("Annotation", annotation)
         self.assertNotNone(self.annotation, annotation, "Annotation")
         self.assertNotNone(self.annotation._obj, annotation, "Annotation")
     if orphaned:
         self.orphaned = True
     if index is not None:
         self.index = index