Commit 28e8e579 authored by Bartek Górny's avatar Bartek Górny

implementation-specific things moved to the other bt5

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11671 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4bc7ebe5
......@@ -2,9 +2,6 @@ import zipfile, cStringIO, re
import xmlrpclib, base64
from Products.CMFCore.utils import getToolByName
rx_atr='([\w]+)###([\w/]+)'
rx_atr=re.compile(rx_atr)
def extractContent(data):
cs=cStringIO.StringIO()
cs.write(data)
......@@ -18,43 +15,9 @@ def extractContent(data):
z.close()
return s
rx_fileno=re.compile('File No.: *(?P<reference>(?P<group>[A-Za-z-]+)-(?P<project>\d+)-(?P<number>\d+)\.(?P<year>\d{2}))')
rx_classif=re.compile('([A-Z]{1}[a-z]+/[A-Z]{1}[a-z]+)')
def getAttrFromContent(self,data,ptype):
if ptype!='Memo':return {}
atrs={}
if data is None:return {}
fileno=rx_fileno.search(data)
if fileno:
dic=fileno.groupdict()
atrs['source_project']='project_module/'+dic['project']
atrs['reference']=dic['reference']
classif=rx_classif.search(data)
log=[]
if classif:
classif=classif.groups()[0].split('/')
classif.reverse()
res=self.portal_catalog(portal_type='Category',title=classif[0])
for r in res:
c=r.getObject()
for x,t in enumerate(classif):
c=c.aq_parent
if c.getId()=='classification':
atrs['classification']='/'.join(r.getRelativeUrl().split('/')[1:])
break
if c.getTitle()!=classif[x+1]:
break
self.log(atrs)
return atrs
def getDoctypeFromContent(data):
atrs=getAttrFromContent(data)
return atrs.get('doctype')
def convertToOdf(name,data):
sp=mkProxy()
kw=sp.run_convert(name,data)
def convertToOdf(self,name,data):
sp=mkProxy(self)
kw=sp.run_convert(name,base64.encodestring(data))
odf=base64.decodestring(kw['data'])
return odf
......
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