From 1ed36bc860f96f2d6fe7b6375e8c6bf3bbde1949 Mon Sep 17 00:00:00 2001 From: Sebastien Robin <seb@nexedi.com> Date: Thu, 4 Mar 2010 08:43:50 +0000 Subject: [PATCH] add API to initialize and clear generators git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33371 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/interfaces/id_generator.py | 18 +++++++++++++++ product/ERP5/interfaces/id_tool.py | 30 +++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/product/ERP5/interfaces/id_generator.py b/product/ERP5/interfaces/id_generator.py index 1431e5fee4..3a93afb2c8 100644 --- a/product/ERP5/interfaces/id_generator.py +++ b/product/ERP5/interfaces/id_generator.py @@ -76,3 +76,21 @@ class IIdGenerator(Interface): id (optional). By default, ids are managed like integers and are increased one by one """ + + def initializeGenerator(): + """ + Initialize generator. This is mostly used when a new ERP5 site + is created. Some generators will need to do some initialization like + creating SQL Database, prepare some data in ZODB, etc + """ + + def clearGenerator(): + """ + Clear generators data. This can be usefull when working on a + development instance or in some other rare cases. This will + loose data and must be use with caution + + This can be incompatible with some particular generator implementation, + in this case a particular error will be raised (to be determined and + added here) + """ diff --git a/product/ERP5/interfaces/id_tool.py b/product/ERP5/interfaces/id_tool.py index 17b8102750..6063799987 100644 --- a/product/ERP5/interfaces/id_tool.py +++ b/product/ERP5/interfaces/id_tool.py @@ -90,3 +90,33 @@ class IIdTool(Interface): default=100, id_count=3) # this can returns ['154', '155', '156'] """ + + def initializeGenerator(id_generator=None, all=False): + """ + Initialize generators. This is mostly used when a new ERP5 site + is created. Some generators will need to do some initialization like + creating SQL Database, prepare some data in ZODB, etc + + id_generator (string) + Select an particular id generator by giving its reference. + + all (boolean) + do initialization for all generators + """ + + def clearGenerator(id_generator=None, all=False): + """ + Clear generators data. This can be usefull when working on a + development instance or in some other rare cases. This will + loose data and must be use with caution + + This can be incompatible with some particular generator implementation, + in this case a particular error will be raised (to be determined and + added here) + + id_generator (string) + Select an particular id generator by giving its reference. + + all (boolean) + do initialization for all generators + """ -- 2.30.9