Changeset 8375 for mauRepo/CedaMarkup
- Timestamp:
- 21/06/12 11:00:24 (9 years ago)
- Location:
- mauRepo/CedaMarkup/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
mauRepo/CedaMarkup/trunk
- Property svn:ignore
-
old new 8 8 9 9 .pydevproject 10 11 ceda_markup.egg-info
-
- Property svn:ignore
-
mauRepo/CedaMarkup/trunk/ceda_markup/__init__.py
r8373 r8375 1 ''' 2 BSD Licence 3 Copyright (c) 2012, Science & Technology Facilities Council (STFC) 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without modification, 7 are 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 18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 22 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 23 OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 29 Created on 21 Jun 2012 30 31 @author: Maurizio Nagni 32 ''' 33 1 34 __version__ = '0.0.1' 35 36 def 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 32 32 ''' 33 33 from xml.etree.ElementTree import Element, SubElement 34 from ceda_markup import extendElement 34 35 35 36 class Entry(object): … … 103 104 if hasattr(self, 'author'): 104 105 if isinstance(self.author, list): 105 e ntry.extend(self.author)106 extendElement(entry, self.author) 106 107 else: 107 108 entry.append(self.author) … … 109 110 if hasattr(self, 'contributor'): 110 111 if isinstance(self.contributor, list): 111 e ntry.extend(self.contributor)112 extendElement(entry, self.contributor) 112 113 else: 113 114 entry.append(self.contributor) … … 126 127 if hasattr(self, 'category'): 127 128 if isinstance(self.category, list): 128 e ntry.extend(self.category)129 extendElement(entry, self.category) 129 130 else: 130 131 entry.append(self.category) -
mauRepo/CedaMarkup/trunk/ceda_markup/opensearch/os_engine.py
r8369 r8375 33 33 34 34 import mimetypes 35 from ceda_markup.opensearch.query import QueryTag 36 from ceda_markup.opensearch.os_engine_helper import OSEngineHelper 35 from query import QueryTag 36 from os_engine_helper import OSEngineHelper 37 37 38 if not mimetypes.inited: 38 39 mimetypes.init() … … 73 74 return None 74 75 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 OSREsponse80 @param ospath: same value of OSEngine.path81 @return the default implementation return ospath.82 """83 return ospath84 '''85 86 76 def getDescription(self, ospath): 87 77 reqDoc = self.osRequest.getDescription(ospath) -
mauRepo/CedaMarkup/trunk/ceda_markup/opensearch/os_request.py
r8369 r8375 33 33 from xml.etree.ElementTree import Element, SubElement, tostring 34 34 from xml.dom import minidom 35 from ceda_markup.opensearch.os_engine import get_mimetype36 from ceda_markup.opensearch.osquery import URL_REL_DEFAULT, URL_INDEX_OFFSET_DEFAULT,\35 from os_engine import get_mimetype 36 from osquery import URL_REL_DEFAULT, URL_INDEX_OFFSET_DEFAULT,\ 37 37 URL_PAGE_OFFSET_DEFAULT 38 38 … … 77 77 self.query = query 78 78 self.responses = responses 79 self.os_syndacation_right = None 80 self.os_adult_content = True 79 81 80 82 if os_description: … … 103 105 self.os_syndacation_right = os_syndacation_right 104 106 105 if os_adult_content and os_adult_content notin ['false', 'FALSE', '0', 'no', 'NO']:106 self.os_adult_content = True107 if os_adult_content and os_adult_content in ['false', 'FALSE', '0', 'no', 'NO']: 108 self.os_adult_content = False 107 109 108 110 self.os_image = os_image … … 169 171 170 172 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) 174 174 175 175 reparsed = minidom.parseString(tostring(top)) -
mauRepo/CedaMarkup/trunk/ceda_markup/template/atom.py
r8369 r8375 31 31 @author: Maurizio Nagni 32 32 ''' 33 from ceda_markup.template.osresponse import OSResponse33 from osresponse import OSResponse 34 34 35 35 class OSAtomResponse(OSResponse):
Note: See TracChangeset
for help on using the changeset viewer.