Changeset 5215 for ndgCommon


Ignore:
Timestamp:
21/04/09 16:18:15 (11 years ago)
Author:
cbyrom
Message:

Remove Summary property and just use the simpler 'summary' single
string field.

Location:
ndgCommon/trunk/ndg/common/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ndgCommon/trunk/ndg/common/src/clients/xmldb/eXist/feedclient.py

    r5192 r5215  
    77import logging, httplib 
    88import feedparser 
     9from xml.sax.saxutils import escape 
    910from ndg.common.src.models.vocabtermdata import VocabTermData as VTD 
    1011from ndg.common.src.models.ndgObject import ndgObject 
     
    222223<summary>%s</summary>\ 
    223224<content src="%s" type="application/atom+xml"/>\ 
    224 </entry>' %(titleString, atom.title, atom.Summary, browseURL) 
     225</entry>' %(titleString, escape(atom.title), escape(atom.summary), browseURL) 
    225226        logging.info("Adding link to atom (%s) as entry in atom feed, %s" \ 
    226227                     %(browseURL, collection)) 
     
    242243<title>%s</title>\ 
    243244<content>%s</content>\ 
    244 </entry>' %(title, summary) 
     245</entry>' %(escape(title), escape(summary)) 
    245246        logging.info("Adding corrections data to atom feed") 
    246247        self.__postEditAtomFeed(path, entryXML) 
  • ndgCommon/trunk/ndg/common/src/lib/utilities.py

    r5195 r5215  
    355355    ''' 
    356356    Escape any XML unfriendly characters 
     357    - NB, do the escape/unescape of non-XML characters by 
     358    the data models on export/import of data 
    357359    @param inputString: string whose value to correct 
    358360    @return: corrected string  
    359361    ''' 
    360     correctedString = cgi.escape(inputString) 
     362    correctedString = inputString# cgi.escape(inputString) 
    361363     
    362364    correctedString = encodeIntoHTMLNumericalCodes(correctedString) 
  • ndgCommon/trunk/ndg/common/src/models/Atom.py

    r5212 r5215  
    286286        self.temporalData = [] 
    287287        self.relatedLinks = [] 
    288         self.summary = [] 
     288        self.summary = "" 
    289289        self.content = [] 
    290290        # NB, this deployments data duplicates other atom data - and is only used for a  
     
    351351            self.ME.__dict__.update(inputs) 
    352352             
    353             # NB, this doesn't trigger the Summary Property, so do this 
     353            # NB, this doesn't trigger the Content Property, so do this 
    354354            # explicitly, if need be 
    355             if inputs.has_key('Summary'): 
    356                 self.Summary = inputs.get('Summary') 
    357355            if inputs.has_key('Content'): 
    358356                self.Content = inputs.get('Content') 
     
    645643                     
    646644        summary = ET.SubElement(root, "summary") 
    647         summary.text = self.Summary 
     645        summary.text = escape(self.summary) 
    648646                     
    649647        # add link to content, if required - NB, can only have one content element in atom 
     
    693691 
    694692 
    695     def __getSummary(self): 
    696         logging.debug("Getting summary data") 
    697         summaryString = "" 
    698         for summary_line in self.summary: 
    699             summaryString += escape(summary_line) + "\n" 
    700  
    701         return summaryString 
    702  
    703  
    704     def __setSummary(self, summary): 
    705         logging.debug("Adding summary data") 
    706         self.summary = [] 
    707         for summary_line in summary.split('\n'): 
    708             self.summary.append(unescape(summary_line))#utilities.escapeSpecialCharacters(summary_line)) 
    709              
    710     Summary = property(fset=__setSummary, fget=__getSummary, doc="Atom summary") 
    711  
    712  
    713693    def __getContent(self): 
    714694        logging.debug("Getting content data") 
     
    750730        summary = tree.findtext('{%s}summary' %ndgObject.ATOM_NS) 
    751731        if summary: 
    752             self.Summary = summary#.decode('unicode_escape') 
     732            self.summary = unescape(summary) 
    753733 
    754734        authorElement = tree.find('{%s}author' %ndgObject.ATOM_NS) 
Note: See TracChangeset for help on using the changeset viewer.