Changeset 8375 for mauRepo/CedaMarkup


Ignore:
Timestamp:
21/06/12 11:00:24 (7 years ago)
Author:
mnagni
Message:

Corrected some pylint error messages

Location:
mauRepo/CedaMarkup/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/CedaMarkup/trunk

    • Property svn:ignore
      •  

        old new  
        88 
        99.pydevproject 
         10 
         11ceda_markup.egg-info 
  • mauRepo/CedaMarkup/trunk/ceda_markup/__init__.py

    r8373 r8375  
     1''' 
     2BSD Licence 
     3Copyright (c) 2012, Science & Technology Facilities Council (STFC) 
     4All rights reserved. 
     5 
     6Redistribution and use in source and binary forms, with or without modification,  
     7are permitted provided that the following conditions are met: 
     8 
     9    * Redistributions of source code must retain the above copyright notice,  
     10        this list of conditions and the following disclaimer. 
     11    * Redistributions in binary form must reproduce the above copyright notice, 
     12        this list of conditions and the following disclaimer in the documentation 
     13        and/or other materials provided with the distribution. 
     14    * Neither the name of the Science & Technology Facilities Council (STFC)  
     15        nor the names of its contributors may be used to endorse or promote  
     16        products derived from this software without specific prior written permission. 
     17 
     18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"  
     19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,  
     20THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR  
     21PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
     22BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,  
     23OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF  
     24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
     25HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
     26OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE  
     27OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     28 
     29Created on 21 Jun 2012 
     30 
     31@author: Maurizio Nagni 
     32''' 
     33 
    134__version__ = '0.0.1' 
     35 
     36def extendElement(element, collectionToAppend): 
     37    ''' 
     38        Manages the extention of an xml.etree.ElementTree instance. 
     39        As the Element.extend function has been introduced in python2.7 
     40        for backward compatibility this method chooses the best approach 
     41        @param element: an instance of xml.etree.ElementTree 
     42        @param collectionToAppend: a collection to append to the element   
     43    '''     
     44    if hasattr(element, 'extend'): 
     45        getattr(element, 'extend')(collectionToAppend) 
     46        return 
     47 
     48    for item in collectionToAppend: 
     49        getattr(element, 'append')(item) 
  • mauRepo/CedaMarkup/trunk/ceda_markup/atom/entry.py

    r8369 r8375  
    3232''' 
    3333from xml.etree.ElementTree import Element, SubElement 
     34from ceda_markup import extendElement 
    3435 
    3536class Entry(object): 
     
    103104        if hasattr(self, 'author'): 
    104105            if isinstance(self.author, list): 
    105                 entry.extend(self.author) 
     106                extendElement(entry, self.author) 
    106107            else: 
    107108                entry.append(self.author) 
     
    109110        if hasattr(self, 'contributor'): 
    110111            if isinstance(self.contributor, list): 
    111                 entry.extend(self.contributor) 
     112                extendElement(entry, self.contributor) 
    112113            else: 
    113114                entry.append(self.contributor)                 
     
    126127        if hasattr(self, 'category'): 
    127128            if isinstance(self.category, list): 
    128                 entry.extend(self.category) 
     129                extendElement(entry, self.category) 
    129130            else: 
    130131                entry.append(self.category) 
  • mauRepo/CedaMarkup/trunk/ceda_markup/opensearch/os_engine.py

    r8369 r8375  
    3333 
    3434import mimetypes 
    35 from ceda_markup.opensearch.query import QueryTag 
    36 from ceda_markup.opensearch.os_engine_helper import OSEngineHelper 
     35from query import QueryTag 
     36from os_engine_helper import OSEngineHelper 
     37 
    3738if not mimetypes.inited: 
    3839    mimetypes.init() 
     
    7374        return None                 
    7475     
    75     ''' 
    76     def generateURLPath(self, ospath): 
    77         """ 
    78             Generate the proper URL path, before the parameters, for the Opensearch:URL tag. 
    79             This method is supposed to be overridden by classes extending OSREsponse             
    80             @param ospath: same value of OSEngine.path 
    81             @return the default implementation return ospath.  
    82         """ 
    83         return ospath 
    84     '''     
    85      
    8676    def getDescription(self, ospath): 
    8777        reqDoc = self.osRequest.getDescription(ospath) 
  • mauRepo/CedaMarkup/trunk/ceda_markup/opensearch/os_request.py

    r8369 r8375  
    3333from xml.etree.ElementTree import Element, SubElement, tostring 
    3434from xml.dom import minidom 
    35 from ceda_markup.opensearch.os_engine import get_mimetype 
    36 from ceda_markup.opensearch.osquery import URL_REL_DEFAULT, URL_INDEX_OFFSET_DEFAULT,\ 
     35from os_engine import get_mimetype 
     36from osquery import URL_REL_DEFAULT, URL_INDEX_OFFSET_DEFAULT,\ 
    3737    URL_PAGE_OFFSET_DEFAULT 
    3838 
     
    7777        self.query = query 
    7878        self.responses = responses 
     79        self.os_syndacation_right = None 
     80        self.os_adult_content = True 
    7981 
    8082        if os_description: 
     
    103105            self.os_syndacation_right = os_syndacation_right             
    104106             
    105         if os_adult_content and os_adult_content not in ['false', 'FALSE', '0', 'no', 'NO']: 
    106             self.os_adult_content = True                         
     107        if os_adult_content and os_adult_content in ['false', 'FALSE', '0', 'no', 'NO']: 
     108            self.os_adult_content = False                         
    107109             
    108110        self.os_image = os_image 
     
    169171         
    170172        for item in self.responses:             
    171             url = self._buildTemplateURL(top, item.extension, self.query.rel, self.query.indexOffset, self.query.pageOffset, ospath) 
    172             #self.oshelper.assignNamespacePrefix(url)     
    173              
     173            self._buildTemplateURL(top, item.extension, self.query.rel, self.query.indexOffset, self.query.pageOffset, ospath) 
    174174         
    175175        reparsed = minidom.parseString(tostring(top)) 
  • mauRepo/CedaMarkup/trunk/ceda_markup/template/atom.py

    r8369 r8375  
    3131@author: Maurizio Nagni 
    3232''' 
    33 from ceda_markup.template.osresponse import OSResponse 
     33from osresponse import OSResponse 
    3434 
    3535class OSAtomResponse(OSResponse): 
Note: See TracChangeset for help on using the changeset viewer.