From 9b9ed47e9663e404eace7c390d1bde09f1caabaa Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 16 Jan 2021 10:44:02 +0100 Subject: [PATCH] Removed more Zope archaeological remains --- ZAbsences.py | 20 +------------------- ZEntreprises.py | 29 ----------------------------- ZNotes.py | 19 ------------------- ZScoDoc.py | 8 +------- ZScoUsers.py | 14 -------------- ZScolar.py | 18 +----------------- __init__.py | 18 ------------------ 7 files changed, 3 insertions(+), 123 deletions(-) diff --git a/ZAbsences.py b/ZAbsences.py index afdcb396..33e09b6b 100644 --- a/ZAbsences.py +++ b/ZAbsences.py @@ -697,6 +697,7 @@ class ZAbsences( return int(self.get_preference("work_saturday")) security.declareProtected(ScoView, "day_names") + def day_names(self): """Returns week day names. If work_saturday property is set, include saturday @@ -1993,22 +1994,3 @@ ou entrez une date pour visualiser les absents un jour donnĂ© : doc._pop() log("XMLgetAbsEtud (%gs)" % (time.time() - t0)) return repr(doc) - - -# -------------------------------------------------------------------- -# -# Zope Product Administration -# -# -------------------------------------------------------------------- -def manage_addZAbsences( - self, id="id_ZAbsences", title="The Title for ZAbsences Object", REQUEST=None -): - "Add a ZAbsences instance to a folder." - self._setObject(id, ZAbsences(id, title)) - if REQUEST is not None: - return self.manage_main(self, REQUEST) - # return self.manage_editForm(self, REQUEST) - - -# The form used to get the instance id from the user. -# manage_addZAbsencesForm = DTMLFile('dtml/manage_addZAbsencesForm', globals()) diff --git a/ZEntreprises.py b/ZEntreprises.py index 5eb610aa..53d287a0 100644 --- a/ZEntreprises.py +++ b/ZEntreprises.py @@ -251,20 +251,6 @@ class ZEntreprises( self.id = id self.title = title - # The form used to edit this object - # def manage_editZEntreprises(self, title, RESPONSE=None): - # "Changes the instance values" - # self.title = title - # self._p_changed = 1 - # RESPONSE.redirect("manage_editForm") - - # Ajout (dans l'instance) d'un dtml modifiable par Zope - def defaultDocFile(self, id, title, file): - f = open(file_path + "/dtml-editable/" + file + ".dtml") - file = f.read() - f.close() - self.manage_addDTMLMethod(id, title, file) - security.declareProtected(ScoEntrepriseView, "entreprise_header") def entreprise_header(self, REQUEST=None, page_title=""): @@ -1648,18 +1634,3 @@ class ZEntreprises( else: self.do_entreprise_edit(tf[2]) return REQUEST.RESPONSE.redirect(REQUEST.URL1 + "?start=" + start) - - -# -------------------------------------------------------------------- -# -# Zope Product Administration -# -# -------------------------------------------------------------------- -def manage_addZEntreprises( - self, id="id_ZEntreprises", title="The Title for ZEntreprises Object", REQUEST=None -): - "Add a ZEntreprises instance to a folder." - self._setObject(id, ZEntreprises(id, title)) - if REQUEST is not None: - return self.manage_main(self, REQUEST) - # return self.manage_editForm(self, REQUEST) diff --git a/ZNotes.py b/ZNotes.py index b1e4fe92..d02d384e 100644 --- a/ZNotes.py +++ b/ZNotes.py @@ -3631,22 +3631,3 @@ class ZNotes(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Impl ) # -------------------------------------------------------------------- - - -# -------------------------------------------------------------------- -# -# Zope Product Administration -# -# -------------------------------------------------------------------- -def manage_addZNotes( - self, id="id_ZNotes", title="The Title for ZNotes Object", REQUEST=None -): - "Add a ZNotes instance to a folder." - self._setObject(id, ZNotes(id, title)) - if REQUEST is not None: - return self.manage_main(self, REQUEST) - # return self.manage_editForm(self, REQUEST) - - -# The form used to get the instance id from the user. -manage_addZNotesForm = DTMLFile("dtml/manage_addZNotesForm", globals()) diff --git a/ZScoDoc.py b/ZScoDoc.py index c2c7094c..76827bd8 100644 --- a/ZScoDoc.py +++ b/ZScoDoc.py @@ -77,13 +77,7 @@ class ZScoDoc(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Imp manage_options = ( ({"label": "Contents", "action": "manage_main"},) + PropertyManager.manage_options # add the 'Properties' tab - + ( - # this line is kept as an example with the files : - # dtml/manage_editZScolarForm.dtml - # html/ZScolar-edit.stx - # {'label': 'Properties', 'action': 'manage_editForm',}, - {"label": "View", "action": "index_html"}, - ) + + ({"label": "View", "action": "index_html"},) + Item.manage_options # add the 'Undo' & 'Owner' tab + RoleManager.manage_options # add the 'Security' tab ) diff --git a/ZScoUsers.py b/ZScoUsers.py index c62d74f2..0e03a39e 100644 --- a/ZScoUsers.py +++ b/ZScoUsers.py @@ -105,20 +105,6 @@ class ZScoUsers( self.id = id self.title = title - # The form used to edit this object - # def manage_editZScousers(self, title, RESPONSE=None): - # "Changes the instance values" - # self.title = title - # self._p_changed = 1 - # RESPONSE.redirect("manage_editForm") - - # Ajout (dans l'instance) d'un dtml modifiable par Zope - def defaultDocFile(self, id, title, file): - f = open(file_path + "/dtml-editable/" + file + ".dtml") - file = f.read() - f.close() - self.manage_addDTMLMethod(id, title, file) - # Connexion to SQL database of users: # Ugly but necessary during transition out of Zope: diff --git a/ZScolar.py b/ZScolar.py index e42397c8..c39d8bdc 100644 --- a/ZScolar.py +++ b/ZScolar.py @@ -133,13 +133,7 @@ class ZScolar(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Imp manage_options = ( ({"label": "Contents", "action": "manage_main"},) + PropertyManager.manage_options # add the 'Properties' tab - + ( - # this line is kept as an example with the files : - # dtml/manage_editZScolarForm.dtml - # html/ZScolar-edit.stx - # {'label': 'Properties', 'action': 'manage_editForm',}, - {"label": "View", "action": "index_html"}, - ) + + ({"label": "View", "action": "index_html"},) + Item.manage_options # add the 'Undo' & 'Owner' tab + RoleManager.manage_options # add the 'Security' tab ) @@ -152,17 +146,7 @@ class ZScolar(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Imp self.title = title self._db_cnx_string = db_cnx_string self._cnx = None - # --- add editable DTML documents: - # self.defaultDocFile('sidebar_dept', - # 'barre gauche (partie haute)', - # 'sidebar_dept') - # --- add DB connector - # id = 'DB' - # da = ZopeDA.Connection( - # id, 'DB connector', db_cnx_string, False, - # check=1, tilevel=2, encoding='utf-8') - # self._setObject(id, da) # --- add Scousers instance id = "Users" obj = ZScoUsers.ZScoUsers(id, "Gestion utilisateurs zope") diff --git a/__init__.py b/__init__.py index a7ebcf4b..98fd4023 100644 --- a/__init__.py +++ b/__init__.py @@ -27,8 +27,6 @@ from ZScolar import ZScolar, manage_addZScolarForm, manage_addZScolar -# from ZNotes import ZNotes, manage_addZNotesForm, manage_addZNotes - from ZScoDoc import ZScoDoc, manage_addZScoDoc # from sco_zope import * @@ -53,23 +51,7 @@ def initialize(context): icon="static/icons/sco_icon.png", ) - # context.registerHelp() - # context.registerHelpTitle("ZScolar") - # --- ZScoDoc context.registerClass( ZScoDoc, constructors=(manage_addZScoDoc,), icon="static/icons/sco_icon.png" ) - - # --- ZNotes - # context.registerClass( - # ZNotes, - # constructors = ( - # manage_addZNotesForm, - # manage_addZNotes - # ), - # icon = 'static/icons/notes_icon.png' - # ) - - # context.registerHelp() - # context.registerHelpTitle("ZNotes")