Commit a5565885 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Add an optional paramete create into writeLocalPropertySheet,...

Add an optional paramete create into writeLocalPropertySheet, writeLocalExtension and writeLocalDocument.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1346 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b9e419ae
...@@ -278,10 +278,13 @@ def readLocalPropertySheet(class_id): ...@@ -278,10 +278,13 @@ def readLocalPropertySheet(class_id):
f.close() f.close()
return text return text
def writeLocalPropertySheet(class_id, text): 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 os.path.exists(path):
raise IOError, 'the file %s is already present' % path
f = open(path, 'w') f = open(path, 'w')
f.write(text) f.write(text)
...@@ -336,10 +339,13 @@ def readLocalExtension(class_id): ...@@ -336,10 +339,13 @@ def readLocalExtension(class_id):
f.close() f.close()
return text return text
def writeLocalExtension(class_id, text): 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 os.path.exists(path):
raise IOError, 'the file %s is already present' % path
f = open(path, 'w') f = open(path, 'w')
f.write(text) f.write(text)
...@@ -363,10 +369,13 @@ def readLocalDocument(class_id): ...@@ -363,10 +369,13 @@ def readLocalDocument(class_id):
f.close() f.close()
return text return text
def writeLocalDocument(class_id, text): 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 os.path.exists(path):
raise IOError, 'the file %s is already present' % path
f = open(path, 'w') f = open(path, 'w')
f.write(text) f.write(text)
......
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