Back to index

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

List of all members.

Public Member Functions

def __init__
def __str__
def __repr__
def __cmp__
def __hash__
def name
def major
def minor
def normalized
def urlsafe
def edit

Public Attributes

 id
 mimetypes
 extensions
 binary
 globs
 icon_path

Static Public Attributes

tuple security = ClassSecurityInfo()
tuple extensions = ()
tuple globs = ()

Private Attributes

 __name__

Static Private Attributes

tuple __implements__ = (IMimetype,)

Detailed Description

Definition at line 14 of file MimeTypeItem.py.


Constructor & Destructor Documentation

def MimetypesRegistry.MimeTypeItem.MimeTypeItem.__init__ (   self,
  name = '',
  mimetypes = None,
  extensions = None,
  binary = None,
  icon_path = '',
  globs = None 
)

Definition at line 22 of file MimeTypeItem.py.

00022 
00023                  binary=None, icon_path='', globs=None):
00024         if name:
00025             self.__name__ = self.id = name
00026         if mimetypes is not None:
00027             self.mimetypes = mimetypes
00028         if extensions is not None:
00029             self.extensions = extensions
00030         if binary is not None:
00031             self.binary = binary
00032         if globs is not None:
00033             self.globs = globs
00034         self.icon_path = icon_path or guess_icon_path(self)


Member Function Documentation

Definition at line 41 of file MimeTypeItem.py.

00041 
00042     def __cmp__(self, other):
00043         if IMimetype.isImplementedBy(other):
00044             other = other.normalized()
00045         return not (other in self.mimetypes)

Definition at line 46 of file MimeTypeItem.py.

00046 
00047     def __hash__(self):
00048         return hash(self.name())

Here is the call graph for this function:

Definition at line 38 of file MimeTypeItem.py.

00038 
00039     def __repr__(self):
00040         return "<mimetype %s>" % self.mimetypes[0]

Definition at line 35 of file MimeTypeItem.py.

00035 
00036     def __str__(self):
00037         return self.normalized()

Here is the call graph for this function:

def MimetypesRegistry.MimeTypeItem.MimeTypeItem.edit (   self,
  name,
  mimetypes,
  extensions,
  icon_path,
  binary = 0,
  globs = None,
  REQUEST = None 
)
edit this mime type

Definition at line 82 of file MimeTypeItem.py.

00082 
00083              binary=0, globs=None, REQUEST=None):
00084         """edit this mime type"""
00085         # if mimetypes and extensions are string instead of lists,
00086         # split them on new lines
00087         if isinstance(mimetypes, basestring):
00088             mimetypes = [mts.strip() for mts in mimetypes.split('\n')
00089                          if mts.strip()]
00090         if isinstance(extensions, basestring):
00091             extensions = [mts.strip() for mts in extensions.split('\n')
00092                           if mts.strip()]
00093         if isinstance(globs, basestring):
00094             globs = [glob.strip() for glob in globs.split('\n')
00095                      if glob.strip()]
00096         self.__name__ = self.id = name
00097         self.mimetypes = mimetypes
00098         self.globs = globs
00099         self.extensions = extensions
00100         self.binary = binary
00101         self.icon_path = icon_path
00102         if REQUEST is not None:
00103             REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main')
00104 
00105 InitializeClass(MimeTypeItem)
00106 

Here is the call graph for this function:

Here is the caller graph for this function:

return the major part of the RFC-2046 name for this mime type 

Definition at line 55 of file MimeTypeItem.py.

00055 
00056     def major(self):
00057         """ return the major part of the RFC-2046 name for this mime type """
00058         return self.normalized().split('/', 1)[0]

Here is the call graph for this function:

return the minor part of the RFC-2046 name for this mime type 

Definition at line 60 of file MimeTypeItem.py.

00060 
00061     def minor(self):
00062         """ return the minor part of the RFC-2046 name for this mime type """
00063         return self.normalized().split('/', 1)[1]

Here is the call graph for this function:

The name of this object 

Definition at line 50 of file MimeTypeItem.py.

00050 
00051     def name(self):
00052         """ The name of this object """
00053         return self.__name__

Here is the caller graph for this function:

return the main RFC-2046 name for this mime type

e.g. if this object has names ('text/restructured', 'text-x-rst')
then self.normalized() will always return the first form.

Definition at line 65 of file MimeTypeItem.py.

00065 
00066     def normalized(self):
00067         """ return the main RFC-2046 name for this mime type
00068 
00069         e.g. if this object has names ('text/restructured', 'text-x-rst')
00070         then self.normalized() will always return the first form.
00071         """
00072         return self.mimetypes[0]
    

Here is the caller graph for this function:

Return a url safe version of the normalized version of this
mime type.

Definition at line 74 of file MimeTypeItem.py.

00074 
00075     def urlsafe(self):
00076         """Return a url safe version of the normalized version of this
00077         mime type.
00078         """
00079         return urllib.quote(self.normalized())

Here is the call graph for this function:


Member Data Documentation

tuple MimetypesRegistry.MimeTypeItem.MimeTypeItem.__implements__ = (IMimetype,) [static, private]

Definition at line 16 of file MimeTypeItem.py.

Definition at line 24 of file MimeTypeItem.py.

Definition at line 30 of file MimeTypeItem.py.

Definition at line 18 of file MimeTypeItem.py.

Definition at line 28 of file MimeTypeItem.py.

Definition at line 19 of file MimeTypeItem.py.

Definition at line 32 of file MimeTypeItem.py.

Definition at line 33 of file MimeTypeItem.py.

Definition at line 24 of file MimeTypeItem.py.

Definition at line 26 of file MimeTypeItem.py.

tuple MimetypesRegistry.MimeTypeItem.MimeTypeItem.security = ClassSecurityInfo() [static]

Definition at line 15 of file MimeTypeItem.py.


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