Diff for /ECHO_content/ECHO_collection.py between versions 1.301 and 1.307

version 1.301, 2008/12/17 12:12:26 version 1.307, 2009/05/06 07:53:46
Line 1 Line 1
 """New version of the product started February, 8th. Without scientific classification, use content-type for further classification."""  """New version of the produc started February, 8th. Without scientific classification, use content-type for further classification."""
 """Echo collection provides the classes for the ECHO content web-site.  """Echo collection provides the classes for the ECHO content web-site.
   
 class ECHO_collection is the basis class for an ECHO collection.  class ECHO_collection is the basis class for an ECHO collection.
Line 106  def setECHO_collectionInformation(self,t Line 106  def setECHO_collectionInformation(self,t
         self.weight=weight          self.weight=weight
   
 import ECHO_resource  import ECHO_resource
   from ECHO_resource import manage_addECHO_resource
   
 class ECHO_resource(ECHO_resource.ECHO_resource):  class ECHO_resource(ECHO_resource.ECHO_resource):
     """depricated use class in ECHO_resource.py"""      """depricated use class in ECHO_resource.py"""
Line 379  class ECHO_fullText(ZopePageTemplate,ECH Line 380  class ECHO_fullText(ZopePageTemplate,ECH
                 try:                  try:
                    dom=xml.dom.minidom.parseString(self())                     dom=xml.dom.minidom.parseString(self())
                 except:                  except:
                    dom=xml.dom.minidom.parseString(self().encode('latin-1'))                     dom=xml.dom.minidom.parseString(self.utf8ify(self()))
                 pages=dom.getElementsByTagName('page')                  pages=dom.getElementsByTagName('page')
                                   
                 return pages[int(nr)-1].toxml()                  return pages[int(nr)-1].toxml()
Line 721  class ECHO_collection(CatalogAware, Fold Line 722  class ECHO_collection(CatalogAware, Fold
         ret=None          ret=None
                   
         for name in zf.namelist():          for name in zf.namelist():
                fn=tempfile.mkstemp()[1]                 ds,fn=tempfile.mkstemp()
                tf=file(fn,"w")                 tf=file(fn,"w")
                x=zf.read(name)                 x=zf.read(name)
                tf.write(x)                 tf.write(x)
Line 732  class ECHO_collection(CatalogAware, Fold Line 733  class ECHO_collection(CatalogAware, Fold
                    if not ret:                     if not ret:
                        ret=""                         ret=""
                    ret+="Cannot import: %s (Already existing?)<br>"%name                     ret+="Cannot import: %s (Already existing?)<br>"%name
              os.close(ds)
                os.remove(fn)                 os.remove(fn)
                   
           zf.close()
   
         if ret:          if ret:
             return """<html><body>%s</body></html>"""%ret              return """<html><body>%s</body></html>"""%ret
         if RESPONSE:          if RESPONSE:
Line 852  class ECHO_collection(CatalogAware, Fold Line 856  class ECHO_collection(CatalogAware, Fold
             if not urn:              if not urn:
                     urn=self.absolute_url()                      urn=self.absolute_url()
                                           
             li="""<RDF:li RDF:resource="%s" />\n"""              li="""<rdf:li rdf:resource="%s" />\n"""
   
                           
             for content in contents:              for content in contents:
           try:
                     ret+=content[1].getRDF()+"\n"                      ret+=content[1].getRDF()+"\n"
                                       except:
             ret+="""<RDF:Seq RDF:about="%s">\n"""%urn              logging.error("getrdf: "+repr(content[1].getRDF()))
               try:
                   ret+=self.unicodify(content[1].getRDF())+"\n"
               except:
               logging.error("--still cannot do it")
                   ret+=repr(content[1].getRDF())+"\n"
               ret+="""<rdf:Seq rdf:about="%s">\n"""%urn
             for content in contents:              for content in contents:
                     nurn=content[1].absolute_url()                      nurn=content[1].absolute_url()
                     ret+=li%nurn                      ret+=li%nurn
             return ret+"</RDF:Seq>"              return ret+"</rdf:Seq>"
                           
   
           
Line 1610  class ECHO_group(ECHO_collection): Line 1621  class ECHO_group(ECHO_collection):
                           
             if not urn:              if not urn:
                     urn=self.absolute_url()                      urn=self.absolute_url()
             li="""<RDF:li RDF:resource="%s" />\n"""              li="""<rdf:li rdf:resource="%s" />\n"""
                           
                           
             for content in contents:              for content in contents:
                     ret+=content[1].getRDF()+"\n"                      ret+=self.unicodify(content[1].getRDF())+"\n"
                                           
             ret+="""<RDF:Seq RDF:about="%s">\n"""%urn              ret+="""<rdf:Seq rdf:about="%s">\n"""%urn
             for content in contents:              for content in contents:
                     nurn=content[1].absolute_url()                      nurn=content[1].absolute_url()
                     ret+=li%nurn                      ret+=li%nurn
             return ret+"</RDF:Seq>"              return ret+"</rdf:Seq>"
                           
         def index_html(self):          def index_html(self):
                 """standard page"""                  """standard page"""
Line 2055  class ECHO_root(Folder,Persistent,Implic Line 2066  class ECHO_root(Folder,Persistent,Implic
                     global key                      global key
                     global value                      global value
                     seq=""                      seq=""
                     if name=="RDF:Seq":                      if name=="rdf:Seq":
                             key=attrs.get('RDF:about')                              key=attrs.get('rdf:about')
                             try: # teste ob liste                              try: # teste ob liste
                                     x=seqs[key][0]                                      x=seqs[key][0]
                             except:                              except:
Line 2064  class ECHO_root(Folder,Persistent,Implic Line 2075  class ECHO_root(Folder,Persistent,Implic
                                     seqs[key]=[]                                      seqs[key]=[]
   
                                           
                     elif name=="RDF:Description":                      elif name=="rdf:Description":
                             key=attrs.get('RDF:about')                              key=attrs.get('rdf:about')
                                                           
   
                     elif name=="RDF:li":                      elif name=="rdf:li":
                             name=attrs.get('RDF:resource')                              name=attrs.get('rdf:resource')
                             seqs[key].append(name)                              seqs[key].append(name)
   
                     elif name=="ECHONAVIGATION:type":                      elif name=="echonavigation:type":
                             value="type"                              value="type"
   
                     elif name=="ECHONAVIGATION:name":                      elif name=="echonavigation:name":
                             value="name"                              value="name"
                     elif name=="ECHONAVIGATION:linkClickable":                      elif name=="echonavigation:linkClickable":
                             value="linkClickable"                              value="linkClickable"
                                                           
             def end_element(name):              def end_element(name):
Line 2158  class ECHO_root(Folder,Persistent,Implic Line 2169  class ECHO_root(Folder,Persistent,Implic
   
             ret=getRDFDescription(self,self.absolute_url(),urn=urn)              ret=getRDFDescription(self,self.absolute_url(),urn=urn)
                           
             li="""<RDF:li RDF:resource="%s" />\n"""              li="""<rdf:li rdf:resource="%s" />\n"""
   
                           
             for content in contents:              for content in contents:
                     ret+=content[1].getRDF()+"\n"                      ret+=content[1].getRDF()+"\n"
                                           
             ret+="""<RDF:Seq RDF:about="%s">\n"""%urn              ret+="""<rdf:Seq rdf:about="%s">\n"""%urn
             for content in contents:              for content in contents:
                     nurn=content[1].absolute_url()                      nurn=content[1].absolute_url()
                     ret+=li%nurn                      ret+=li%nurn
             return ret+"</RDF:Seq>"              return ret+"</rdf:Seq>"
                           
   
     def showContent(self,path):      def showContent(self,path):

Removed from v.1.301  
changed lines
  Added in v.1.307


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>