Custom Error Pages.

"Mark DeLaFranier" <[email protected]> Mon, 21 Mar 2005 12:15:43 -0500
Newsgroups gmane.comp.web.wiki.moin.devel
Message-ID <[email protected]>
This is a multi-part message in MIME format.

------=_NextPart_000_000E_01C52E0F.B64A7FD0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset="US-ASCII"

Hi all, this is my first post so forgive me if this is not the correct
address.
 
I have recently started using the MoinMoin Wiki with lots of success.  I am
looking at making a few adjustments on the server side for additional
functionality.  One item that I would like to do is write a custom error
page for when a user is denied read access.  This is just one example.  The
idea could easily be extended to allow wiki system administrators to define
custom pages for various form of errors on the server.
 
I am new to python as well.
 
This is my idea:
 
1. User can define a page called "AclPages" which is a parent for all Acl
related messages.
2. User can then define a page called "AclPages/ReadErrorPage".  The
contents could be what ever the sytem administrator wishes, for example mine
says:
 
{{{
1. Please ensure that you are logged onto the wiki.  You are logged on if
you user name appears in the upper right hand corner.  Else please login
2. Your account has not been granted the necessary privedlges.  Please see
AccessInfo for further details.
}}}
 
I started to modify the Page.py as follows:
 
            request.write("<strong>%s</strong><br>" % _("You are not allowed
to view this page."))
 
            #no_read_page = Page(self, pagename)
            #no_read_page = Page(request, "AclPages/ReadErrorPage",
format_args=pi_formatargs, do_cache=do_cache)
 
            #no_read_page.formatter = self.formatter
            #no_read_page.send_page_content(request, Parser, body,
format_args=pi_formatargs, do_cache=do_cache)
 
I was wondering if somebody has some suggestions?
 
Thanks
Mark

------=_NextPart_000_000E_01C52E0F.B64A7FD0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset="US-ASCII"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.2900.2180" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial size=3D2>Hi =
all, this is my=20
first post so forgive me if this is not the correct =
address.</FONT></SPAN></DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial size=3D2>I have =
recently=20
started using the MoinMoin Wiki with lots of success.&nbsp; I am looking =
at=20
making a few adjustments on the server side for additional =
functionality.&nbsp;=20
One item that I would like to do is write a custom error page for when a =
user is=20
denied read access.&nbsp; This is just one example.&nbsp; The idea could =
easily=20
be extended to allow wiki system administrators to define custom pages =
for=20
various form of errors on the server.</FONT></SPAN></DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial size=3D2>I am =
new to python=20
as well.</FONT></SPAN></DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial size=3D2>This =
is my=20
idea:</FONT></SPAN></DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial size=3D2>1. =
User can define a=20
page called "AclPages" which is a parent for all Acl related=20
messages.</FONT></SPAN></DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial size=3D2>2. =
User can then=20
define a page called "AclPages/ReadErrorPage".&nbsp; The contents could =
be what=20
ever the sytem administrator wishes, for example mine =
says:</FONT></SPAN></DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial=20
size=3D2>{{{</FONT></SPAN></DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial size=3D2>1. =
Please ensure=20
that you are logged onto the wiki.&nbsp; You are logged on if you user =
name=20
appears in the upper right hand corner.&nbsp; Else please=20
login</FONT></SPAN></DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial size=3D2>2. =
Your account has=20
not been granted the necessary privedlges.&nbsp; Please see AccessInfo =
for=20
further details.</FONT></SPAN></DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial=20
size=3D2>}}}</FONT></SPAN></DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial size=3D2>I =
started to modify=20
the Page.py as follows:</FONT></SPAN></DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;=20
request.write("&lt;strong&gt;%s&lt;/strong&gt;&lt;br&gt;" % _("You are =
not=20
allowed to view this page."))</FONT></SPAN></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;=20
#no_read_page =3D Page(self,=20
pagename)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;=20
#no_read_page =3D Page(request, "AclPages/ReadErrorPage",=20
format_args=3Dpi_formatargs, do_cache=3Ddo_cache)</FONT></SPAN></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;=20
#no_read_page.formatter =3D=20
self.formatter<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;=20
#no_read_page.send_page_content(request, Parser, body,=20
format_args=3Dpi_formatargs, do_cache=3Ddo_cache)</FONT></SPAN></DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial size=3D2>I was =
wondering if=20
somebody has some suggestions?</FONT></SPAN></DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial=20
size=3D2>Thanks</FONT></SPAN></DIV>
<DIV><SPAN class=3D252050817-21032005><FONT face=3DArial=20
size=3D2>Mark</FONT></SPAN></DIV></BODY></HTML>

------=_NextPart_000_000E_01C52E0F.B64A7FD0--



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click