Home | Trees | Indices | Help |
|
---|
|
1 # copyright 2006-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. 2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr 3 # 4 # This file is part of logilab-mtconverter. 5 # 6 # logilab-mtconverter is free software: you can redistribute it and/or modify it 7 # under the terms of the GNU Lesser General Public License as published by the 8 # Free Software Foundation, either version 2.1 of the License, or (at your 9 # option) any later version. 10 # 11 # logilab-mtconverter is distributed in the hope that it will be useful, but 12 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 14 # for more details. 15 # 16 # You should have received a copy of the GNU Lesser General Public License along 17 # with logilab-mtconverter. If not, see <http://www.gnu.org/licenses/>. 18 """base transformation objects""" 19 20 __docformat__ = "restructuredtext en" 21 2224 """a transform is converting some content in a acceptable MIME type 25 into another MIME type 26 """ 27 name = None 28 inputs = () 29 output = None 30 input_encoding = None 31 output_encoding = None 3254 5534 self.__dict__.update(kwargs) 35 if not getattr(self, 'name', None): 36 self.name = self.__class__.__name__3739 """convert the given data structure into transform output's mime type 40 41 :param trdata: `TransformData` 42 :rtype: `TransformData` 43 """ 44 # this is not true when transform accept wildcard 45 #assert trdata.mimetype in self.inputs 46 trdata.data = self._convert(trdata) 47 trdata.mimetype = self.output 48 if self.output_encoding: 49 trdata.encoding = self.output_encoding 50 return trdata5157 """A chain of transforms used to transform data""" 58 59 inputs = ('application/octet-stream',) 60 output = 'application/octet-stream' 61 name = None 6210764 list.__init__(self, *args) 65 if name is not None: 66 self.name = name 67 if args: 68 self._update()69 74 78 82 86 90 9496 self.inputs = self[0].inputs 97 self.output = self[-1].output 98 for i in range(len(self)): 99 if hasattr(self[-i-1], 'output_encoding'): 100 self.output_encoding = self[-i-1].output_encoding 101 break 102 else: 103 try: 104 del self.output_encoding 105 except: 106 pass
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Mar 14 19:07:58 2016 | http://epydoc.sourceforge.net |