1: """New version of the product started February, 8th. Without scientific classification, use content-type for further classification."""
2: """Echo collection provides the classes for the ECHO content web-site.
3:
4: class ECHO_collection is the basis class for an ECHO collection.
5:
6: class ECHO_resource contains information on ECHO resources (e.g. an Display environment for Metadata
7:
8: class ECHO_externalLink contains information on externalLinks
9:
10:
11: """
12: import string
13: import re
14: import OFS.Image
15: from types import *
16: from OFS.Image import Image
17: from Globals import DTMLFile
18: from OFS.Folder import Folder
19: from OFS.SimpleItem import SimpleItem
20: from AccessControl import ClassSecurityInfo
21: from Globals import InitializeClass
22: from Globals import DTMLFile
23: from Products.PageTemplates.PageTemplateFile import PageTemplateFile
24: from Products.PageTemplates.PageTemplate import PageTemplate
25: from Globals import Persistent
26: from Acquisition import Implicit
27: #from psycopg import libpq
28: #from pyPgSQL import libpq
29: import xml.dom.minidom
30:
31: import urllib
32: import xml.dom.minidom
33:
34:
35: #List of different types for the graphical linking viewer
36: viewClassificationListMaster=['view point','area']
37:
38:
39: def toList(field):
40: """Einzelfeld in Liste umwandeln"""
41: if type(field)==StringType:
42: return [field]
43: else:
44: return field
45:
46: def getText(nodelist):
47:
48: rc = ""
49: for node in nodelist:
50: if node.nodeType == node.TEXT_NODE:
51: rc = rc + node.data
52: return rc
53:
54:
55: def readMetadata(url):
56: """Methoden zum Auslesen der Metadateninformation zu einer Resource
57: Vorerst noch Typ bib"""
58:
59: metadict={}
60: try:
61: geturl=""
62: for line in urllib.urlopen(url).readlines():
63: geturl=geturl+line
64:
65:
66: except:
67: return (None,"Cannot open: "+url)
68:
69: try:
70: dom=xml.dom.minidom.parseString(geturl)
71: except:
72: return (None,"Cannot parse: "+url+"<br>"+geturl)
73:
74: metanode=dom.getElementsByTagName('bib')
75: metadict['bib_type']='Book'
76: if len(metanode)==0:
77: metanode=dom.getElementsByTagName('archimedes')
78: metadict['bib_type']='Archimedes'
79: #print "HELLO"
80:
81: if not len(metanode)==0:
82: metacontent=metanode[0].childNodes
83:
84: try:
85: metadict['bib_type']=getText(dom.getElementsByTagName('bib')[0].attributes['type'].childNodes)
86: except:
87: """nothing"""
88:
89: for node in metacontent:
90: try:
91: metadict[node.tagName.lower()]=getText(node.childNodes)
92: except:
93: """nothing"""
94:
95: #print metadict
96: return metadict,""
97:
98:
99: def setECHO_collectionInformation(self,title,label,description,content_type,responsible,credits,weight,coordstrs,viewClassification=""):
100:
101: """Allegemeine Informationen zu einer ECHO Collection"""
102:
103: self.viewClassification=viewClassification
104:
105: self.label = label
106: self.title=title
107: self.description=description
108: self.content_type=content_type
109: self.responsible=responsible
110: self.credits=toList(credits)
111: self.weight=weight
112:
113: coords=[]
114: #coordinates of for rectangles
115:
116: #print "cs", coordstrs
117: if coordstrs:
118: for coordstr in coordstrs:
119: #print "cs", coordstr
120: try:
121: temco=coordstr.split(",")
122: except:
123: temco=[]
124: #temco.append(angle)
125: coords.append(temco)
126:
127:
128: self.coords=coords[0:]
129:
130:
131: class scientificClassification(SimpleItem,Persistent,Implicit):
132: """outdated will be deleeted in the next versions: subclass"""
133: security=ClassSecurityInfo()
134:
135: def __init__(self,context,science,practice):
136: self.context=context
137: self.science=science
138: self.practice=practice
139: self.id="scientific_Classification"
140:
141: security.declarePublic('get_context')
142: def get_context(self):
143: return self.context
144:
145: security.declarePublic('get_science')
146: def get_science(self):
147: return self.science
148:
149: security.declarePublic('get_practice')
150: def get_practice(self):
151: return self.practice
152:
153:
154: class scientificInformation(Folder,Persistent,Implicit):
155: """outdated will be deleted in the next versions: subclass scientificInformation"""
156: security=ClassSecurityInfo()
157:
158:
159:
160: def __init__(self,source_type,period):
161:
162: self.id="scientific_Information"
163: self.source_type=source_type
164: self.period=period
165:
166:
167:
168: security.declarePublic('get_source_type')
169: def get_source_type(self):
170: return self.source_type
171:
172: security.declarePublic('get_period')
173: def get_period(self):
174: return self.period
175:
176:
177: class ECHO_resource(Folder):
178: """ECHO Ressource"""
179: meta_type='ECHO_resource'
180:
181: viewClassificationList=viewClassificationListMaster
182:
183: def getViewClassification(self):
184: if hasattr(self,'viewClassification'):
185: return self.viewClassification
186: else:
187: return ""
188:
189: def getCredits(self):
190: """Ausgabe der credits"""
191: if self.credits:
192: return self.credits
193: else:
194: return []
195:
196: def __init__(self,id,link,metalink,title,label,description,content_type,responsible,credits,weight,coords):
197:
198: self.id = id
199: """Festlegen der ID"""
200:
201: self.label = label
202: self.link= link
203: self.metalink=metalink
204: self.title=title
205: self.weight=weight
206: self.credits=toList(credits)
207: self.description=description
208: self.content_type=content_type
209: self.responsible=responsible
210:
211: if coords:
212: coordsnew=[ string.split(x,",") for x in coords]
213: else:
214: coordsnew=[]
215:
216: self.coords=coordsnew
217:
218:
219: def getCoords(self):
220: try:
221: return [string.join(x,",") for x in self.coords]
222: except:
223: return []
224:
225:
226: def ECHO_resource_config(self):
227: """Main configuration"""
228:
229: if not hasattr(self,'weight'):
230: self.weight=""
231: if not hasattr(self,'coords'):
232: self.coords=[]
233:
234: pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_resource.zpt').__of__(self)
235: return pt()
236:
237:
238: def changeECHO_resource(self,metalink,link,title,label,description,content_type,responsible,weight,viewClassification="",coords=None,credits=None,RESPONSE=None):
239:
240:
241: """Änderung der Properties"""
242:
243:
244: setECHO_collectionInformation(self,title,label,description,content_type,responsible,credits,weight,coords,viewClassification)
245:
246:
247: self.link=link
248: self.metalink=metalink
249:
250: if RESPONSE is not None:
251: RESPONSE.redirect('manage_main')
252:
253:
254: manage_options = Folder.manage_options+(
255: {'label':'Main Config','action':'ECHO_resource_config'},
256: {'label':'Metadata','action':'ECHO_getResourceMD'},
257: {'label':'Graphics','action':'ECHO_graphicEntry'},
258: )
259:
260: def ECHO_graphicEntry(self):
261: """DO nothing"""
262: if 'overview' in self.aq_parent.__dict__.keys():
263: pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_draw.zpt').__of__(self)
264: return pt()
265: else:
266: return "NO OVERVIEW GRAPHICS"
267:
268: def ECHO_enterCoords(self,coordstr,angle="",RESPONSE=None):
269: """Enter coords"""
270: coords=self.coords
271: temco=coordstr.split(",")
272: temco.append(angle)
273: coords.append(temco)
274:
275: self.coords=coords[0:]
276:
277: if RESPONSE is not None:
278: RESPONSE.redirect('ECHO_graphicEntry')
279:
280: def ECHO_getResourceMD(self,template="yes"):
281: """Einlesen der Metadaten und Anlegen dieser Metadaten als Informationen zur Resource"""
282: (metadict, error)=readMetadata(self.metalink)
283:
284:
285:
286: if not error=="": #Fehler beim Auslesen des Metafiles
287: return "ERROR:",error
288: for key in metadict.keys():#Hinzufügen der Felder
289:
290: setattr(self,key,metadict[key].encode('ascii','replace'))
291:
292:
293: self.metadata=metadict.keys()
294:
295: self.label=self.generate_label()
296:
297: if template=="yes":
298: pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_resourceMD.zpt').__of__(self)
299: return pt()
300:
301: def ECHO_getMD(self,item):
302: """Ausgabe der MD"""
303: return getattr(self,item)
304:
305: def index_html(self):
306: """standard page"""
307:
308: return self.REQUEST.RESPONSE.redirect(self.link)
309:
310: def generate_label(self):
311: """Erzeugt_standard_Label aus Template"""
312: pt=getattr(self,"label_template_"+self.bib_type)
313:
314: return pt()
315:
316: def manage_addECHO_resourceForm(self):
317: """Form for adding a ressource"""
318: pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_resourceForm.zpt').__of__(self)
319: return pt()
320:
321:
322:
323: def manage_addECHO_resource(self,id,title,label,description,content_type,responsible,link,metalink,weight,credits=None,coords=None,RESPONSE=None):
324: """addaresource"""
325:
326: newObj=ECHO_resource(id,link,metalink,title,label,description,content_type,responsible,credits,weight,coords)
327:
328: self._setObject(id,newObj)
329:
330: if RESPONSE is not None:
331: RESPONSE.redirect('manage_main')
332:
333:
334: class ECHO_externalLink(Folder):
335: """Link zu einer externen Ressource"""
336: security=ClassSecurityInfo()
337: meta_type='ECHO_externalLink'
338:
339:
340: def __init__(self,id,link,title,label,description,content_type,responsible,credits,weight,coords):
341:
342: self.id = id
343: """Festlegen der ID"""
344:
345: self.credits=toList(credits)
346: self.label = label
347: self.link= link
348: self.title=title
349: self.weight=weight
350: self.description=description
351: self.content_type=content_type
352: self.responsible=responsible
353: coordsnew=[ string.split(x,",") for x in coords]
354: self.coords=coordsnew
355:
356: def ECHO_externalLink_config(self):
357: """Main configuration"""
358:
359: if not hasattr(self,'weight'):
360: self.weight=""
361: if not hasattr(self,'coords'):
362:
363: self.coords=['']
364: #print "G",self.coords
365:
366: pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_externalLink.zpt').__of__(self)
367: return pt()
368:
369:
370: def changeECHO_externalLink(self,link,title,label,description,content_type,responsible,weight,coords=None,credits=None,RESPONSE=None):
371:
372: """Änderung der Properties"""
373:
374:
375: setECHO_collectionInformation(self,title,label,description,content_type,responsible,credits,weight,coords)
376:
377:
378: self.link=link
379: if RESPONSE is not None:
380: RESPONSE.redirect('manage_main')
381:
382:
383: manage_options = Folder.manage_options+(
384: {'label':'Main Config','action':'ECHO_externalLink_config'},
385: )
386:
387: def index_html(self):
388: """standard page"""
389:
390: return self.REQUEST.RESPONSE.redirect(self.link)
391:
392: def manage_addECHO_externalLinkForm(self):
393: """Form for external Links"""
394: pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_externalLinkForm.zpt').__of__(self)
395: return pt()
396:
397:
398: def manage_addECHO_externalLink(self,id,title,label,description,content_type,responsible,link,weight,coords=None,credits=None,RESPONSE=None):
399: """Add an external Link"""
400:
401: newObj=ECHO_externalLink(id,link,title,label,description,content_type,responsible,credits,weight,coords)
402:
403: self._setObject(id,newObj)
404:
405: if RESPONSE is not None:
406: RESPONSE.redirect('manage_main')
407:
408:
409: class ECHO_collection(Folder, Persistent, Implicit):
410: """ECHO Collection"""
411: security=ClassSecurityInfo()
412: meta_type='ECHO_collection'
413:
414:
415:
416: security.declarePublic('getCreditObject')
417: def getCreditObject(self,name):
418: """credit id to credititem"""
419: try:
420: return getattr(self.partners,name)
421: except:
422: return ""
423:
424: security.declarePublic('ECHO_generateNavBar')
425: def ECHO_generateNavBar(self):
426: """Erzeuge Navigationsbar"""
427: link=""
428: object="self"
429: ret=[]
430: path=self.getPhysicalPath()
431: for element in path:
432:
433:
434: if not element=="":
435: object+="."+element
436:
437: label=eval(object).label
438: link+="/"+element
439: if not label=="":
440: ret.append((label,link))
441: return ret
442:
443: security.declarePublic('ECHO_rerenderLinksMD')
444: def ECHO_rerenderLinksMD(self):
445: """Rerender all Links"""
446:
447: for entry in self.__dict__.keys():
448: object=getattr(self,entry)
449:
450:
451: try:
452:
453: if object.meta_type == 'ECHO_resource':
454:
455: object.ECHO_getResourceMD(template="no")
456:
457: except:
458: """nothing"""
459:
460: return "Rerenderd all links to resources in: "+self.title
461:
462:
463: def getCoords(self):
464: try:
465:
466: x= [string.join(x,",") for x in self.coords]
467: return x
468:
469: except:
470:
471: return []
472:
473: def __init__(self,id,title,label,description,content_type,responsible,credits,weight,sortfield,coords):
474: #print "CO",coords
475:
476: self.id = id
477: """Festlegen der ID"""
478: self.credits=toList(credits)
479: self.label = label
480: self.title=title
481: self.description=description
482: self.content_type=content_type
483: self.responsible=responsible
484:
485: self.weight=weight
486: self.sortfield=sortfield
487: coordsnew=[ string.split(x,",") for x in coords]
488: self.coords=coordsnew
489:
490:
491: manage_options = Folder.manage_options+(
492: {'label':'Main Config','action':'ECHO_collection_config'},
493: {'label':'Rerender Links','action':'ECHO_rerenderLinksMD'},
494: {'label':'Graphics','action':'ECHO_graphicEntry'},
495:
496: )
497:
498: def ECHO_graphicEntry(self):
499: """DO nothing"""
500: if 'overview' in self.aq_parent.__dict__.keys():
501: pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_draw.zpt').__of__(self)
502: return pt()
503: else:
504: return "NO OVERVIEW GRAPHICS"
505:
506: def ECHO_enterCoords(self,coordstr,angle="",RESPONSE=None):
507: """Enter coords"""
508: coords=self.coords
509: temco=coordstr.split(",")
510: temco.append(angle)
511: coords.append(temco)
512: self.coords=coords[0:]
513:
514: if RESPONSE is not None:
515: RESPONSE.redirect('ECHO_graphicEntry')
516:
517:
518: security.declarePublic('ECHO_collection_config')
519: def ECHO_collection_config(self):
520: """Main configuration"""
521:
522: if not hasattr(self,'weight'):
523: self.weight=""
524:
525: if not hasattr(self,'sortfield'):
526: self.sortfield="weight"
527:
528: if not hasattr(self,'coords'):
529: self.coords=[]
530:
531: pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_collection.zpt').__of__(self)
532: return pt()
533:
534:
535: security.declarePublic('changeECHO_collection')
536:
537:
538: def changeECHO_collection(self,title,label,description,content_type,responsible,weight,credits=None,sortfield="weight",coords=None,RESPONSE=None):
539: """Änderung der Properties"""
540:
541: try:
542: coordsnew=[ string.split(x,",") for x in coords]
543: except:
544: coordsnew=[]
545:
546: setECHO_collectionInformation(self,title,label,description,content_type,responsible,credits,weight,coordsnew)
547:
548: self.sortfield=sortfield
549:
550: if RESPONSE is not None:
551: RESPONSE.redirect('manage_main')
552:
553: security.declarePublic('index_html')
554:
555: showOverview=DTMLFile('ECHO_content_overview',globals())
556:
557:
558: def index_html(self):
559: """standard page"""
560:
561: if 'index.html' in self.__dict__.keys():
562: return getattr(self,'index.html')()
563: elif 'overview' in self.__dict__.keys():
564: return self.showOverview()
565:
566:
567: pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_content_standard.zpt').__of__(self)
568: pt.content_type="text/html"
569: return pt()
570:
571: def getCredits(self):
572: """Ausgabe der credits"""
573: if self.credits:
574: return self.credits
575: else:
576: return []
577:
578: def getGraphicCoords(self):
579: """Give list of coordinates"""
580: subColTypes=['ECHO_collection','ECHO_externalLink','ECHO_resource']
581: ids=[]
582: for entry in self.__dict__.keys():
583: object=getattr(self,entry)
584: try:
585: if object.meta_type in subColTypes:
586: for coordtemp in object.coords:
587: if len(coordtemp)>3:
588: coord=coordtemp[0:4]
589: if hasattr(object,'title'):
590: if not object.title=="":
591: ids.append([string.join(coord,", "),object.getId(),object.title])
592: else:
593: ids.append([string.join(coord,", "),object.getId(),object.getId()])
594: else:
595: ids.append([string.join(coord,", "),object.getId(),object.getId()])
596:
597: except:
598: """nothing"""
599:
600: return ids
601:
602: def getSubCols(self,sortfield="weight"):
603:
604: subColTypes=['ECHO_collection','ECHO_externalLink','ECHO_resource']
605: ids=[]
606: for entry in self.__dict__.keys():
607: object=getattr(self,entry)
608: try:
609: if object.meta_type in subColTypes:
610: ids.append(object)
611:
612: except:
613: """nothing"""
614: try:
615: sortfield=self.sortfield
616: except:
617: """nothing"""
618:
619: tmplist=[]
620: for x in ids:
621: if hasattr(x,sortfield):
622: try:
623: x=int(x)
624: except:
625: """nothing"""
626: tmp=getattr(x,sortfield)
627: else:
628: tmp=10000000
629: tmplist.append((tmp,x))
630: tmplist.sort()
631: return [x for (key,x) in tmplist]
632:
633:
634:
635:
636:
637:
638: def manage_addECHO_collectionForm(self):
639: """Add collection form"""
640: pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_collectionForm.zpt').__of__(self)
641: return pt()
642:
643:
644: def manage_addECHO_collection(self,id,title,label,description,content_type,responsible,weight,sortfield,coords="",credits=None,RESPONSE=None):
645: """add a echo collection"""
646:
647:
648: newObj=ECHO_collection(id,title,label,description,content_type,responsible,credits,weight,sortfield,coords)
649:
650: self._setObject(id,newObj)
651:
652: if RESPONSE is not None:
653: RESPONSE.redirect('manage_main')
654:
655: class ECHO_root(Folder,Persistent,Implicit):
656: """ECHO Root Folder"""
657: meta_type="ECHO_root"
658:
659: def __init__(self,id,title):
660: """init"""
661: self.id = id
662: self.title=title
663:
664: def deleteSpace(self,str):
665: """delete space at the end of a line"""
666: if str[len(str)-1]==" ":
667: return str[0:len(str)-1]
668: else:
669: return str
670:
671:
672:
673: # zusaetliche methoden fuer das vlp muessen in ein eigenes produkt
674:
675: def formatAscii(self,str,url=None):
676: """ersetze ascii umbrueche durch <br>"""
677: #url=None
678: if url:
679:
680: retStr=""
681: words=str.split("\n")
682:
683: for word in words:
684: strUrl=url%word
685: print "str",strUrl
686: retStr+="""<a href="%s">%s</a><br/>"""%(strUrl,word)
687: str=retStr
688: if str:
689: return re.sub(r"[\n]","<br/>",str)
690: else:
691: return ""
692:
693: def link2html(self,str):
694: """link2html fuer VLP muss hier noch raus"""
695: if str:
696: print str
697: str=re.sub("\&","&",str)
698: dom=xml.dom.minidom.parseString("<?xml version='1.0' ?><txt>"+str+"</txt>")
699: links=dom.getElementsByTagName("link")
700:
701: print "link",links
702: for link in links:
703: link.tagName="a"
704: ref=link.getAttribute("ref")
705: if self.checkRef(ref):
706: link.setAttribute("href",self.aq_parent.absolute_url()+"/vlp_coll?id="+ref)
707:
708: return dom.toxml('utf-8')
709: return ""
710:
711:
712: def checkRef(self,ref):
713: dbs={'vl_literature':'AND CD LIKE \'%lise%\'','vl_technology':'','vl_people':''}
714: res=None
715: for db in dbs.keys():
716: #print ref,"select reference from %s where reference =\'%s\' %s"%(db,ref,dbs[db])
717:
718: res=res or self.search(var=str("select reference from %s where reference =\'%s\' %s"%(db,ref,dbs[db])))
719: return res
720:
721: #Ende Methode fuer vlp
722:
723: def PgQuoteString(self,string):
724: """Quote string"""
725: #print "PG",string
726: return libpq.PgQuoteString(string)
727:
728: def getPartners(self):
729: """Get list of Partners. Presently only from a subfolder partners"""
730: partnerTypes=['ECHO_partner']
731: ids=[]
732: try:
733: for entry in self.partners.__dict__.keys():
734: object=getattr(self.partners,entry)
735:
736: try:
737:
738: if object.meta_type in partnerTypes:
739: ids.append(object)
740:
741: except:
742: """nothing"""
743: except:
744: ids=[] # no partners
745: return ids
746:
747: def getCollectionTree(self):
748: """get the collection tree (list of triples (parent,child, depth)"""
749:
750: def getCollection(object,depth=0):
751: depth+=1
752: collections=[]
753: for entry in object.__dict__.keys():
754: element=getattr(object,entry)
755: try:
756: if element.meta_type=="ECHO_collection":
757: collections.append((object,element,depth))
758: collections+=getCollection(element,depth)
759: except:
760: """nothing"""
761: return collections
762:
763:
764: return getCollection(self)
765:
766: def getCollectionTreeIds(self):
767: """Show the IDs of the Tree"""
768: ret=[]
769: for collection in self.getCollectionTree():
770: ret.append((collection[0].getId(),collection[1].getId(),collection[2]))
771: return ret
772:
773:
774:
775: def manage_addECHO_root(self,id,title,RESPONSE=None):
776: """Add an ECHO_root"""
777: self._setObject(id,ECHO_root(id,title))
778:
779: if RESPONSE is not None:
780: RESPONSE.redirect('manage_main')
781:
782: def manage_addECHO_rootForm(self):
783: """Nothing yet"""
784: pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_root.zpt').__of__(self)
785: return pt()
786:
787: class ECHO_partner(Image,Persistent):
788: """ECHO Partner"""
789:
790: meta_type="ECHO_partner"
791:
792: def __init__(self, id, title,url, file, content_type='', precondition=''):
793: self.__name__=id
794: self.title=title
795: self.url=url
796: self.precondition=precondition
797:
798: data, size = self._read_data(file)
799: content_type=self._get_content_type(file, data, id, content_type)
800: self.update_data(data, content_type, size)
801:
802: manage_options = Image.manage_options+(
803: {'label':'Partner Information','action':'ECHO_partner_config'},
804: )
805:
806: def changeECHO_partner(self,url,RESPONSE=None):
807: """Change main information"""
808: self.url=url
809: if RESPONSE is not None:
810: RESPONSE.redirect('manage_main')
811:
812:
813:
814: def ECHO_partner_config(self):
815: """Main configuration"""
816: if not hasattr(self,'url'):
817: self.url=""
818: pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_partner.zpt').__of__(self)
819: return pt()
820:
821:
822: manage_addECHO_partnerForm=DTMLFile('dtml/ECHO_partnerAdd',globals(),
823: Kind='ECHO_partner',kind='ECHO_partner')
824:
825:
826:
827: def manage_addECHO_partner(self, id, file,url, title='', precondition='', content_type='',
828: REQUEST=None):
829: """
830: Add a new ECHO_partner object.
831:
832: Creates a new ECHO_partner object 'id' with the contents of 'file'.
833: Based on Image.manage_addImage
834: """
835:
836: id=str(id)
837: title=str(title)
838: content_type=str(content_type)
839: precondition=str(precondition)
840:
841: id, title = OFS.Image.cookId(id, title, file)
842:
843: self=self.this()
844:
845: # First, we create the image without data:
846: self._setObject(id, ECHO_partner(id,title,url,'',content_type, precondition))
847:
848: # Now we "upload" the data. By doing this in two steps, we
849: # can use a database trick to make the upload more efficient.
850: if file:
851: self._getOb(id).manage_upload(file)
852: if content_type:
853: self._getOb(id).content_type=content_type
854:
855: if REQUEST is not None:
856: try: url=self.DestinationURL()
857: except: url=REQUEST['URL1']
858: REQUEST.RESPONSE.redirect('%s/manage_main' % url)
859: return id
860:
861:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>