Example #1
0
    def testAddObjectMakesDirty(self):
        from euphorie.content.behaviour.dirtytree import isDirty

        self.loginAsPortalOwner()
        survey = self.create()
        survey.invokeFactory("euphorie.module", "module")
        self.assertEqual(isDirty(survey), True)
Example #2
0
    def morph(group, survey):
        published = survey.id == group.published
        info = {
            "id": survey.id,
            "title": survey.title,
            "url": survey.absolute_url(),
            "published": published,
            "publication_date": published and survey.published or None,
            "current": aq_base(survey) is current_version,
            "modified": isDirty(survey),
            "versions": [],
        }
        if not allow_history:
            return info

        history = repository.getHistoryMetadata(survey)
        if history:
            for id in range(history.getLength(countPurged=False) - 1, -1, -1):
                meta = history.retrieve(id, countPurged=False)["metadata"][
                    "sys_metadata"
                ]
                info["versions"].append(
                    {
                        "timestamp": datetime.datetime.fromtimestamp(meta["timestamp"]),
                        "history_id": meta["parent"]["history_id"],
                        "version_id": meta["parent"]["version_id"],
                        "location_id": meta["parent"]["location_id"],
                    }
                )
            info["versions"].sort(key=lambda x: x["timestamp"], reverse=True)
        return info
Example #3
0
    def morph(group, survey):
        info = {
            'id': survey.id,
            'title': survey.title,
            'url': survey.absolute_url(),
            'published': survey.id == group.published,
            'current': aq_base(survey) is current_version,
            'modified': isDirty(survey),
            'versions': []
        }
        if not allow_history:
            return info

        history = repository.getHistoryMetadata(survey)
        if history:
            for id in range(history.getLength(countPurged=False) - 1, -1, -1):
                meta = history.retrieve(
                    id, countPurged=False)["metadata"]["sys_metadata"]
                info["versions"].append({
                    'timestamp':
                    datetime.datetime.fromtimestamp(meta["timestamp"]),
                    'history_id':
                    meta["parent"]["history_id"],
                    'version_id':
                    meta["parent"]["version_id"],
                    'location_id':
                    meta["parent"]["location_id"]
                })
            info["versions"].sort(key=lambda x: x["timestamp"], reverse=True)
        return info
 def testDeleteObjetMakesDiry(self):
     from euphorie.content.behaviour.dirtytree import isDirty
     from euphorie.content.behaviour.dirtytree import clearDirty
     self.loginAsPortalOwner()
     survey = self.create()
     survey.invokeFactory("euphorie.module", "module")
     clearDirty(survey)
     del survey["module"]
     self.assertEqual(isDirty(survey), True)
Example #5
0
    def testDeleteObjetMakesDiry(self):
        from euphorie.content.behaviour.dirtytree import isDirty
        from euphorie.content.behaviour.dirtytree import clearDirty

        self.loginAsPortalOwner()
        survey = self.create()
        survey.invokeFactory("euphorie.module", "module")
        clearDirty(survey)
        del survey["module"]
        self.assertEqual(isDirty(survey), True)
 def testModifyObjectMakesDirty(self):
     from euphorie.content.behaviour.dirtytree import isDirty
     from euphorie.content.behaviour.dirtytree import clearDirty
     from zope.event import notify
     from zope.lifecycleevent import ObjectModifiedEvent
     self.loginAsPortalOwner()
     survey = self.create()
     survey.invokeFactory("euphorie.module", "module")
     clearDirty(survey)
     notify(ObjectModifiedEvent(survey["module"]))
     self.assertEqual(isDirty(survey), True)
Example #7
0
    def testModifyObjectMakesDirty(self):
        from euphorie.content.behaviour.dirtytree import isDirty
        from euphorie.content.behaviour.dirtytree import clearDirty
        from zope.event import notify
        from zope.lifecycleevent import ObjectModifiedEvent

        self.loginAsPortalOwner()
        survey = self.create()
        survey.invokeFactory("euphorie.module", "module")
        clearDirty(survey)
        notify(ObjectModifiedEvent(survey["module"]))
        self.assertEqual(isDirty(survey), True)
Example #8
0
    def morph(group, survey):
        info = {'id': survey.id,
                'title': survey.title,
                'url': survey.absolute_url(),
                'published': survey.id == group.published,
                'current': aq_base(survey) is current_version,
                'modified': isDirty(survey),
                'versions': []}
        if not allow_history:
            return info

        history = repository.getHistoryMetadata(survey)
        if history:
            for id in range(history.getLength(countPurged=False) - 1, -1, -1):
                meta = history.retrieve(id,
                        countPurged=False)["metadata"]["sys_metadata"]
                info["versions"].append({
                    'timestamp': datetime.datetime.fromtimestamp(
                        meta["timestamp"]),
                    'history_id': meta["parent"]["history_id"],
                    'version_id': meta["parent"]["version_id"],
                    'location_id': meta["parent"]["location_id"]})
            info["versions"].sort(key=lambda x: x["timestamp"], reverse=True)
        return info
Example #9
0
 def testModifyObjectMakesDirty(self):
     survey = self.create()
     survey.invokeFactory("euphorie.module", "module")
     clearDirty(survey)
     notify(ObjectModifiedEvent(survey["module"]))
     self.assertEqual(isDirty(survey), True)
Example #10
0
 def testDeleteObjetMakesDiry(self):
     survey = self.create()
     survey.invokeFactory("euphorie.module", "module")
     clearDirty(survey)
     del survey["module"]
     self.assertEqual(isDirty(survey), True)
Example #11
0
 def testAddObjectMakesDirty(self):
     survey = self.create()
     survey.invokeFactory("euphorie.module", "module")
     self.assertEqual(isDirty(survey), True)
Example #12
0
 def testStartClean(self):
     survey = self.create()
     self.assertEqual(isDirty(survey), False)
 def testAddObjectMakesDirty(self):
     from euphorie.content.behaviour.dirtytree import isDirty
     self.loginAsPortalOwner()
     survey = self.create()
     survey.invokeFactory("euphorie.module", "module")
     self.assertEqual(isDirty(survey), True)
 def testStartClean(self):
     from euphorie.content.behaviour.dirtytree import isDirty
     self.loginAsPortalOwner()
     survey = self.create()
     self.assertEqual(isDirty(survey), False)
Example #15
0
    def testStartClean(self):
        from euphorie.content.behaviour.dirtytree import isDirty

        self.loginAsPortalOwner()
        survey = self.create()
        self.assertEqual(isDirty(survey), False)