Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Private Attributes
MoinMoin.userprefs.UserPrefBase Class Reference
Inheritance diagram for MoinMoin.userprefs.UserPrefBase:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def create_form
def handle_form
def allowed
def make_form
def make_row

Public Attributes

 request
 name
 title

Private Attributes

 _
 _table

Detailed Description

    Base class for Settings objects

    To get a new page in the wiki settings, create
    a new 'userprefs' plugin and in it declare a class
    named 'Settings' that inherits from this class.

Definition at line 18 of file __init__.py.


Constructor & Destructor Documentation

def MoinMoin.userprefs.UserPrefBase.__init__ (   self,
  request 
)
    Initialise a settings object. This should set the
    object's title (which is displayed in the list of
    possible settings)

Reimplemented in MoinMoin.userprefs.prefs.Settings, MoinMoin.userprefs.oid.Settings, MoinMoin.userprefs.suid.Settings, MoinMoin.userprefs.changepass.Settings, MoinMoin.userprefs.notification.Settings, and MoinMoin.userprefs.oidserv.Settings.

Definition at line 26 of file __init__.py.

00026 
00027     def __init__(self, request):
00028         '''
00029             Initialise a settings object. This should set the
00030             object's title (which is displayed in the list of
00031             possible settings)
00032         '''
00033         self.request = request
00034         self._ = request.getText
00035         self.name = None
00036         self.title = 'No name set'


Member Function Documentation

    Not all preferences are applicable to all users,
    this method is called to determine whether the
    title should be listed or not and whether
    submissions are accepted.

Reimplemented in MoinMoin.userprefs.notification.Settings, MoinMoin.userprefs.changepass.Settings, MoinMoin.userprefs.suid.Settings, and MoinMoin.userprefs.oidserv.Settings.

Definition at line 60 of file __init__.py.

00060 
00061     def allowed(self):
00062         '''
00063             Not all preferences are applicable to all users,
00064             this method is called to determine whether the
00065             title should be listed or not and whether
00066             submissions are accepted.
00067         '''
00068         return self.request.user and self.request.user.valid

    This method should return HTML code for at least
    one form. Each created form *must* contain the
    hidden fields
      * action: set to "userprefs"
      * handler: set to the plugin name
    It can additionally contain the hidden field
    'sub' set to the plugin name if the plugin needs
    multiple forms (wizard-like.)

Reimplemented in MoinMoin.userprefs.prefs.Settings, MoinMoin.userprefs.oid.Settings, MoinMoin.userprefs.notification.Settings, MoinMoin.userprefs.oidserv.Settings, and MoinMoin.userprefs.suid.Settings.

Definition at line 37 of file __init__.py.

00037 
00038     def create_form(self):
00039         '''
00040             This method should return HTML code for at least
00041             one form. Each created form *must* contain the
00042             hidden fields
00043               * action: set to "userprefs"
00044               * handler: set to the plugin name
00045             It can additionally contain the hidden field
00046             'sub' set to the plugin name if the plugin needs
00047             multiple forms (wizard-like.)
00048         '''
00049         raise NotImplementedError

def MoinMoin.userprefs.UserPrefBase.handle_form (   self,
  request 
)
    When any of the created forms is submitted and the
    hidden fields are set correctly (see create_form)
    this method will be invoked to handle the user's
    input. Note that GET requests are also handed to
    this method, so if you require POST check that.

Definition at line 50 of file __init__.py.

00050 
00051     def handle_form(self, request):
00052         '''
00053             When any of the created forms is submitted and the
00054             hidden fields are set correctly (see create_form)
00055             this method will be invoked to handle the user's
00056             input. Note that GET requests are also handed to
00057             this method, so if you require POST check that.
00058         '''
00059         raise NotImplementedError

def MoinMoin.userprefs.UserPrefBase.make_form (   self,
  explanation = None 
)
    To have a consistent UI, use this method for most
    preferences forms and then call make_row(). See
    existing plugins, e.g. changepass.py.

Definition at line 69 of file __init__.py.

00069 
00070     def make_form(self, explanation=None):
00071         '''
00072             To have a consistent UI, use this method for most
00073             preferences forms and then call make_row(). See
00074             existing plugins, e.g. changepass.py.
00075         '''
00076         action = self.request.page.url(self.request)
00077         _form = html.FORM(action=action)
00078         _form.append(html.INPUT(type="hidden", name="action", value="userprefs"))
00079         _form.append(html.INPUT(type="hidden", name="handler", value=self.name))
00080 
00081         self._table = html.TABLE(border="0")
00082 
00083         # Use the user interface language and direction
00084         lang_attr = self.request.theme.ui_lang_attr()
00085         _form.append(html.Raw('<div class="userpref"%s>' % lang_attr))
00086         para = html.P()
00087         _form.append(para)
00088         if explanation:
00089             para.append(explanation)
00090 
00091         para.append(self._table)
00092         _form.append(html.Raw("</div>"))
00093 
00094         return _form

Here is the caller graph for this function:

def MoinMoin.userprefs.UserPrefBase.make_row (   self,
  label,
  cell,
  kw 
)
   Create a row in the form table.

Definition at line 95 of file __init__.py.

00095 
00096     def make_row(self, label, cell, **kw):
00097         '''
00098            Create a row in the form table.
00099         '''
00100         self._table.append(html.TR().extend([
00101             html.TD(**kw).extend([html.B().append(label), '   ']),
00102             html.TD().extend(cell),
00103         ]))

Here is the caller graph for this function:


Member Data Documentation

Reimplemented in MoinMoin.userprefs.oid.Settings, and MoinMoin.userprefs.oidserv.Settings.

Definition at line 80 of file __init__.py.


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