Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes
MimetypesRegistry.mime_types.smi_mimetypes.SharedMimeInfoHandler Class Reference
Inheritance diagram for MimetypesRegistry.mime_types.smi_mimetypes.SharedMimeInfoHandler:
Inheritance graph
[legend]
Collaboration diagram for MimetypesRegistry.mime_types.smi_mimetypes.SharedMimeInfoHandler:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def startElement
def endElement
def characters

Public Attributes

 mimes

Static Public Attributes

 current = None
 collect_comment = None

Private Attributes

 __comment_buffer
 __comment_lang

Detailed Description

Definition at line 9 of file smi_mimetypes.py.


Constructor & Destructor Documentation

Definition at line 14 of file smi_mimetypes.py.

00014 
00015     def __init__(self):
00016         ContentHandler.__init__(self)
00017         self.mimes = []


Member Function Documentation

Definition at line 54 of file smi_mimetypes.py.

00054 
00055     def characters(self, contents):
00056         if self.collect_comment:
00057             self.__comment_buffer.append(contents)

Definition at line 45 of file smi_mimetypes.py.

00045 
00046     def endElement(self, name):
00047         if self.collect_comment and name in ('comment',):
00048             self.collect_comment = False
00049             lang = self.__comment_lang
00050             comment = u''.join(self.__comment_buffer)
00051             if not comment:
00052                 comment = self.current['type']
00053             self.current['comments'][lang] = comment

Definition at line 18 of file smi_mimetypes.py.

00018 
00019     def startElement(self, name, attrs):
00020         if name in ('mime-type',):
00021             current = {'type': attrs['type'],
00022                        'comments': {},
00023                        'globs': [],
00024                        'aliases': []}
00025             self.mimes.append(current)
00026             self.current = current
00027             return
00028         if name in ('comment',):
00029             # If no lang, assume 'en'
00030             lang = attrs.get('xml:lang', 'en')
00031             if lang not in ('en',):
00032                 # Ignore for now.
00033                 return
00034             self.__comment_buffer = []
00035             self.__comment_lang = lang
00036             self.collect_comment = True
00037             return
00038         if name in ('glob',):
00039             globs = self.current['globs']
00040             globs.append(attrs['pattern'])
00041             return
00042         if name in ('alias',):
00043             aliases = self.current['aliases']
00044             aliases.append(attrs['type'])


Member Data Documentation

Definition at line 33 of file smi_mimetypes.py.

Definition at line 34 of file smi_mimetypes.py.

Definition at line 12 of file smi_mimetypes.py.

Definition at line 11 of file smi_mimetypes.py.

Definition at line 16 of file smi_mimetypes.py.


The documentation for this class was generated from the following file: