Added action to get a word document out
This commit is contained in:
parent
15cfc3ce3c
commit
3723c2c43d
3
Avis.py
3
Avis.py
|
@ -41,7 +41,8 @@ class AvisOdt:
|
|||
fileType)
|
||||
renderer = appy.pod.renderer.Renderer(
|
||||
'%s/%s.odt' % (os.path.dirname(__file__), self.portal_type),
|
||||
{'avis': self}, tempFileName)
|
||||
{'avis': self}, tempFileName,
|
||||
pythonWithUnoPath='/usr/bin/python2.6')
|
||||
renderer.run()
|
||||
# Tell the browser that the resulting page contains PDF
|
||||
response.setHeader('Content-type', 'application/%s' % fileType)
|
||||
|
|
16
AvisLegis.py
16
AvisLegis.py
|
@ -3830,13 +3830,18 @@ class AvisLegis(BaseContent, AvisOdt):
|
|||
typeDescription = "AvisLegis"
|
||||
typeDescMsgId = 'description_edit_avis_simplif'
|
||||
|
||||
security.declarePublic('generateOdt')
|
||||
|
||||
actions = (
|
||||
{'action': "string:$object_url/generateOdt",
|
||||
'category': "document_actions",
|
||||
'id': 'asOdt',
|
||||
'name': u'Générer en ODT',
|
||||
'name': u'Générer en Open Document Format',
|
||||
'permissions': ("View",),
|
||||
'condition': 'python:1'
|
||||
},
|
||||
{'action': "string:$object_url/generateDoc",
|
||||
'category': "document_actions",
|
||||
'id': 'asDoc',
|
||||
'name': u'Générer au format Microsoft Word',
|
||||
'permissions': ("View",),
|
||||
'condition': 'python:1'
|
||||
},
|
||||
|
@ -3859,6 +3864,11 @@ class AvisLegis(BaseContent, AvisOdt):
|
|||
'''Generates the ODT version of this advice.'''
|
||||
return self._generate(RESPONSE, 'odt')
|
||||
|
||||
security.declarePublic('generateDoc')
|
||||
def generateDoc(self, RESPONSE):
|
||||
'''Generates the Doc version of this advice.'''
|
||||
return self._generate(RESPONSE, 'doc')
|
||||
|
||||
security.declarePublic('getResponses')
|
||||
def getResponses(self):
|
||||
"""Returns the predefined responses that are possible for each question.
|
||||
|
|
|
@ -812,6 +812,13 @@ class AvisSimplif(BaseContent, AvisOdt):
|
|||
'permissions': ("View",),
|
||||
'condition': 'python:1'
|
||||
},
|
||||
{'action': "string:$object_url/generateDoc",
|
||||
'category': "document_actions",
|
||||
'id': 'asDoc',
|
||||
'name': u'Générer au format Microsoft Word',
|
||||
'permissions': ("View",),
|
||||
'condition': 'python:1'
|
||||
},
|
||||
)
|
||||
|
||||
_at_rename_after_creation = True
|
||||
|
@ -822,6 +829,11 @@ class AvisSimplif(BaseContent, AvisOdt):
|
|||
'''Generates the ODT version of this advice.'''
|
||||
return self._generate(RESPONSE, 'odt')
|
||||
|
||||
security.declarePublic('generateDoc')
|
||||
def generateDoc(self, RESPONSE):
|
||||
'''Generates the Doc version of this advice.'''
|
||||
return self._generate(RESPONSE, 'doc')
|
||||
|
||||
security.declarePublic('getResponses')
|
||||
def getResponses(self):
|
||||
"""Returns the predefined responses that are possible for each question.
|
||||
|
|
Reference in New Issue