Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes
MoinMoin.error.Error Class Reference
Inheritance diagram for MoinMoin.error.Error:
Inheritance graph

List of all members.

Public Member Functions

def __init__
def __unicode__
def __str__
def __getitem__

Public Attributes


Detailed Description

Base class for moin moin errors

Use this class when you raise errors or create sub classes that
may be used to display non ASCII error message.

Standard errors work safely only with strings using ascii or
unicode. This class can be used safely with both strings using
config.charset and unicode.

You can init this class with either unicode or string using
config.charset encoding. On output, the class will convert the string
to unicode or the unicode to string, using config.charset.

When you want to render an error, use unicode() or str() as needed.

Definition at line 14 of file

Constructor & Destructor Documentation

def MoinMoin.error.Error.__init__ (   self,
Initialize an error, decode if needed

@param message: unicode, str or object that support __unicode__
    and __str__. __str__ should use config.charset.

Reimplemented in MoinMoin.error.CompositeError.

Definition at line 31 of file

00032     def __init__(self, message):
00033         """ Initialize an error, decode if needed
00035         @param message: unicode, str or object that support __unicode__
00036             and __str__. __str__ should use config.charset.
00037         """
00038         self.message = message

Member Function Documentation

def MoinMoin.error.Error.__getitem__ (   self,
Make it possible to access attributes like a dict 

Definition at line 53 of file

00054     def __getitem__(self, item):
00055         """ Make it possible to access attributes like a dict """
00056         return getattr(self, item)

Here is the caller graph for this function:

Return encoded message 

Definition at line 46 of file

00047     def __str__(self):
00048         """ Return encoded message """
00049         if isinstance(self.message, unicode):
00050             return self.message.encode(config.charset)
00051         else:
00052             return str(self.message)

Return unicode error message 

Definition at line 39 of file

00040     def __unicode__(self):
00041         """ Return unicode error message """
00042         if isinstance(self.message, str):
00043             return unicode(self.message, config.charset)
00044         else:
00045             return unicode(self.message)

Member Data Documentation

Definition at line 37 of file

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