Commit fff6b279 authored by Bartek Górny's avatar Bartek Górny

server coordinates drawn from preferences

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9189 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 15ab3e27
......@@ -39,6 +39,7 @@ from DateTime import DateTime
import xmlrpclib, base64, mimetypes
# to overwrite WebDAV methods
from Products.CMFDefault.File import File as CMFFile
from Products.CMFCore.utils import getToolByName
mimetypes.init()
......@@ -147,10 +148,15 @@ class OOoDocument(XMLObject,File):
def _getServerCoordinates(self):
"""
Returns OOo conversion server data from some
preferences. NOT IMPLEMENTED YET - XXX
Returns OOo conversion server data from
preferences
"""
return '127.0.0.1',8080
pref=getToolByName(self,'portal_preferences')
adr=pref.getPreferredDmsOoodocServerAddress()
nr=pref.getPreferredDmsOoodocServerPortNumber()
if adr is None or nr is None:
raise Exception('you should set conversion server coordinates in preferences')
return adr,nr
def _mkProxy(self):
sp=xmlrpclib.ServerProxy('http://%s:%d' % self._getServerCoordinates(),allow_none=True)
......@@ -165,13 +171,13 @@ class OOoDocument(XMLObject,File):
return (code,m)
security.declareProtected(Permissions.ModifyPortalContent,'convert')
def convert(self,REQUEST=None):
def convert(self,force=0,REQUEST=None):
"""
Converts from the initial format to OOo format;
communicates with the conversion server
and gets converted file as well as metadata
"""
if not self.isFileUploaded():
if force==0 and not self.isFileUploaded():
return self.returnMessage('OOo file is up do date')
try:
self._convert()
......
##############################################################################
#
## Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
#
## WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# # consequences resulting from its eventual inadequacies and bugs
# # End users who are looking for a ready-to-use solution with commercial
# # garantees and support are strongly adviced to contract a Free Software
# # Service Company
# #
# # This program is Free Software; you can redistribute it and/or
# # modify it under the terms of the GNU General Public License
# # as published by the Free Software Foundation; either version 2
# # of the License, or (at your option) any later version.
# #
# # This program is distributed in the hope that it will be useful,
# # but WITHOUT ANY WARRANTY; without even the implied warranty of
# # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# # GNU General Public License for more details.
# #
# # You should have received a copy of the GNU General Public License
# # along with this program; if not, write to the Free Software
# # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# #
# ##############################################################################
class DMSPreference:
"""
"""
_properties = (
{ 'id' : 'preferred_dms_ooodoc_server_address',
'description' : 'address of a server for converting docs (ip or domain)',
'type' : 'string',
'preference':1,
'mode' : '' },
{ 'id' : 'preferred_dms_ooodoc_server_port_number',
'description' : 'port number of a server for converting docs (ip or domain)',
'type' : 'int',
'preference':1,
'mode' : '' },
)
# vim: shiftwidth=2
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