Commit d984c833 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Add removeLocalPropertySheet, removeLocalExtension and removeLocalDocument....

Add removeLocalPropertySheet, removeLocalExtension and removeLocalDocument. Fix the reversed behavior of the option create in writeLocalPropertySheet, writeLocalExtension and writeLocalDocument.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1822 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent da29ab4c
...@@ -291,6 +291,12 @@ def getLocalPropertySheetList(): ...@@ -291,6 +291,12 @@ def getLocalPropertySheetList():
result.sort() result.sort()
return result return result
def removeLocalPropertySheet(class_id):
instance_home = getConfiguration().instancehome
path = os.path.join(instance_home, "PropertySheet")
path = os.path.join(path, "%s.py" % class_id)
os.remove(path)
def readLocalPropertySheet(class_id): def readLocalPropertySheet(class_id):
instance_home = getConfiguration().instancehome instance_home = getConfiguration().instancehome
path = os.path.join(instance_home, "PropertySheet") path = os.path.join(instance_home, "PropertySheet")
...@@ -304,7 +310,7 @@ def writeLocalPropertySheet(class_id, text, create=1): ...@@ -304,7 +310,7 @@ def writeLocalPropertySheet(class_id, text, create=1):
instance_home = getConfiguration().instancehome instance_home = getConfiguration().instancehome
path = os.path.join(instance_home, "PropertySheet") path = os.path.join(instance_home, "PropertySheet")
path = os.path.join(path, "%s.py" % class_id) path = os.path.join(path, "%s.py" % class_id)
if not create: if create:
if os.path.exists(path): if os.path.exists(path):
raise IOError, 'the file %s is already present' % path raise IOError, 'the file %s is already present' % path
f = open(path, 'w') f = open(path, 'w')
...@@ -360,6 +366,12 @@ def getLocalExtensionList(): ...@@ -360,6 +366,12 @@ def getLocalExtensionList():
result.sort() result.sort()
return result return result
def removeLocalExtension(class_id):
instance_home = getConfiguration().instancehome
path = os.path.join(instance_home, "Extensions")
path = os.path.join(path, "%s.py" % class_id)
os.remove(path)
def readLocalExtension(class_id): def readLocalExtension(class_id):
instance_home = getConfiguration().instancehome instance_home = getConfiguration().instancehome
path = os.path.join(instance_home, "Extensions") path = os.path.join(instance_home, "Extensions")
...@@ -373,7 +385,7 @@ def writeLocalExtension(class_id, text, create=1): ...@@ -373,7 +385,7 @@ def writeLocalExtension(class_id, text, create=1):
instance_home = getConfiguration().instancehome instance_home = getConfiguration().instancehome
path = os.path.join(instance_home, "Extensions") path = os.path.join(instance_home, "Extensions")
path = os.path.join(path, "%s.py" % class_id) path = os.path.join(path, "%s.py" % class_id)
if not create: if create:
if os.path.exists(path): if os.path.exists(path):
raise IOError, 'the file %s is already present' % path raise IOError, 'the file %s is already present' % path
f = open(path, 'w') f = open(path, 'w')
...@@ -390,6 +402,12 @@ def getLocalDocumentList(): ...@@ -390,6 +402,12 @@ def getLocalDocumentList():
result.sort() result.sort()
return result return result
def removeLocalDocument(class_id):
instance_home = getConfiguration().instancehome
path = os.path.join(instance_home, "Document")
path = os.path.join(path, "%s.py" % class_id)
os.remove(path)
def readLocalDocument(class_id): def readLocalDocument(class_id):
instance_home = getConfiguration().instancehome instance_home = getConfiguration().instancehome
path = os.path.join(instance_home, "Document") path = os.path.join(instance_home, "Document")
...@@ -403,7 +421,7 @@ def writeLocalDocument(class_id, text, create=1): ...@@ -403,7 +421,7 @@ def writeLocalDocument(class_id, text, create=1):
instance_home = getConfiguration().instancehome instance_home = getConfiguration().instancehome
path = os.path.join(instance_home, "Document") path = os.path.join(instance_home, "Document")
path = os.path.join(path, "%s.py" % class_id) path = os.path.join(path, "%s.py" % class_id)
if not create: if create:
if os.path.exists(path): if os.path.exists(path):
raise IOError, 'the file %s is already present' % path raise IOError, 'the file %s is already present' % path
f = open(path, 'w') f = open(path, 'w')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment