Пример #1
0
    def __call__(self):
        plone.protect.CheckAuthenticator(self.request)
        uc = getToolByName(self, 'uid_catalog')

        allow_blank = self.request.get('allow_blank', False) == 'true'
        show_container_types = json.loads(
            self.request.get('show_container_types', 'true'))
        show_containers = json.loads(
            self.request.get('show_containers', 'true'))
        minvol = self.request.get("minvol", "0")
        try:
            minvol = minvol.split()
            minvol = mg(float(minvol[0]), " ".join(minvol[1:]))
        except:
            minvol = mg(0)

        containers = getContainers(
            self.context,
            minvol=minvol,
            allow_blank=allow_blank,
            show_containers=show_containers,
            show_container_types=show_container_types,
        )

        return json.dumps(containers)
Пример #2
0
    def __call__(self):
        plone.protect.CheckAuthenticator(self.request)
        uc = getToolByName(self, 'uid_catalog')
        st_uid = self.request.get('st_uid', [])
        st = st_uid and uc(UID=st_uid)[0].getObject() or None
        allow_blank = self.request.get('allow_blank', False) == 'true'
        pres_uid = json.loads(self.request.get('pres_uid', '[]'))
        minvol = self.request.get('minvol', '').split(" ")
        try:
            minvol = mg(float(minvol[0]), " ".join(minvol[1:]))
        except:
            minvol = mg(0)

        if not type(pres_uid) in (list, tuple):
            pres_uid = [
                pres_uid,
            ]
        preservations = [
            p and uc(UID=p)[0].getObject() or '' for p in pres_uid
        ]

        containers = getContainers(self.context,
                                   preservation=preservations and preservations
                                   or [],
                                   minvol=minvol,
                                   allow_blank=allow_blank)

        return json.dumps(containers)
Пример #3
0
    def __call__(self):
        plone.protect.CheckAuthenticator(self.request)

        allow_blank = self.request.get('allow_blank', False) == 'true'
        show_container_types = json.loads(self.request.get('show_container_types', 'true'))
        show_containers = json.loads(self.request.get('show_containers', 'true'))
        minvol = self.request.get("minvol", "0")
        try:
            minvol = minvol.split()
            minvol = mg(float(minvol[0]), " ".join(minvol[1:]))
        except:
            minvol = mg(0)

        containers = getContainers(
            self.context,
            minvol=minvol,
            allow_blank=allow_blank,
            show_containers=show_containers,
            show_container_types=show_container_types,
        )

        return json.dumps(containers)