def zipMetadata(self, REQUEST=None):
     """
     @summary: gets an id of a metadatacollection or metadatacontainer and zips the content and returns the zip file
     """        
     url = REQUEST.id        
     parts = url.split("/")
     theId = parts[-1]
             
     results = self.portal_catalog.searchResults(id = theId)
     obj = results[0].getObject()
     
     if obj.portal_type in ['Topic']:
         obj = obj.aq_parent
     print obj
     
     zipData = {}
     items = obj.objectItems()
     for i in items:
         if i[1].meta_type == "Metadata":
             #print i[1].title 
             zipData[i[1].id + ".xml"] = i[1].xml 
     
     sIO = StringIO("")
     z = ZipUtil(sIO, mode="w")       
     z.writeData(zipData)
     
     if REQUEST:
         REQUEST.RESPONSE.setHeader("Content-type","application/zip")
     return z.getZipFileData()
 def getFile(self):
     """
     @summary: a dict with file data as key and file path as value
     """  
     try: 
         if (self.username == "") and (self.password == ""):
             res = urllib.urlopen(self.url)
             self.contentType = res.info()["Content-Type"]
             print 'Get HTTP File anonymously.'
         else:
             req = urllib2.Request(self.url)
             base64string = base64.encodestring('%s:%s' % (self.username, self.password))[:-1]
             authheader =  "Basic %s" % base64string
             req.add_header("Authorization", authheader)
             res = urllib2.urlopen(req)
             self.contentType = res.info()["Content-Type"]
             print 'Get Authenticated File.'
         print 'self.contentType', self.contentType
         if self.contentType.lower().find("zip") != -1:
             tDict = {}
             f = StringIO()
             f.write(res.read())
             util = ZipUtil(f)
             theFiles = util.getFileContentWithExtension("xml")
             for f in theFiles:
                 tDict[f[1]] = self.url +"/"+ f[0]
             return tDict
         elif self.contentType.lower().find("xml") != -1:
             return {res.read():self.url}
         else:
             print 'Return unknown.'
             result = res.read()
             return {result:self.url}
         self.message = "Invalid URL or Wrong Content Type"
         return {}
     except:
         traceback.print_exc(file=sys.stdout)
         io = StringIO()
         traceback.print_exc(file=io)
         io.seek(0)            
         trace = io.read()
         self.message = trace            
         return {}