I made a mistake in the code I sent.
When you override the init method you need to make sure that you call the superclasses
init method for everything to work properly.
When I told you to just add:
> __init__(self):
> self.MenuColor="#C0C0C0":
I left out that you need to continue the init as follows
__init__(self):
self.MenuColor="#C0C0C0":
SidebarPage.__init__(self)
The error you got is due to SidebarPage not callining its init method.
Don't edit the sidebar page from WebKit. Make a simple subclass right away - like
SitePage or BasePage or something, This way you
can update to a new version and inherit any changes to SidebarPage
You can send me the code and I'll take a look, but I'm gone for Thanksgiving Wed
morning.
Sorry for the incomplete thought.
I'll send you some of my pages off the list
-Aaron
----- Original Message -----
From: "Aleksandar Kacanski" <[EMAIL PROTECTED]>
To: "Aaron Held" <[EMAIL PROTECTED]>
Sent: Monday, November 19, 2001 6:08 PM
Subject: Re: [Webware-discuss] rewrite sidebar from servlet
> I understand that I can redefine methods inheret
> from the SidebarPage.
> It kills me the fact that I spent coutles time
> figuring mechanics between request in servlets.
> I tried same approach as you mentioned at the end
> but that resulted with a error below.
> So:
> if Example imports WebKit.SidebarPage<--Page
> that still doesn't mean that I can't setup
> constructor in Example:
> __init__(self):
> self.MenuColor="#C0C0C0":
>
> I can expend on __init__(self) in SideBarPage
> but if I add
> __init__(self):
> self.MenuColor="#C0C0C0"
>
> and try to invoke it via in Welcome page
> def __init__(self):
> self.MenuColor="#FFFFFF")
>
> error is generated:
> _methodForRequestType
>
> So I still don't understand mechanics of servlet
> requests and what can be redefined and from
> where.
>
> Traceback (most recent call last):
> File "WebKit/Application.py", line 348, in
> dispatchRequest
> self.handleGoodURL(transaction)
> File "WebKit/Application.py", line 496, in
> handleGoodURL
> self.respond(transaction)
> File "WebKit/Application.py", line 617, in
> respond
> transaction.respond()
> File "WebKit/Transaction.py", line 93, in respond
> self._servlet.respond(self)
> File "WebKit/HTTPServlet.py", line 37, in respond
> method =
> self._methodForRequestType[trans.request().method()]
> AttributeError: Welcome instance has no attribute
> '_methodForRequestType'
>
>
> --- Aaron Held <[EMAIL PROTECTED]> wrote:
> > Any servlet that is based on SidebarPage will
> > have the Sidebar methods. You can override the
> > entire method
> >
> > (SitePage is based on SidebarPage)
> >
> > from SitePage import SitePage
> > class SecurePage(SitePage):
> > '''
> > This is the baseclass for all the pages on the
> > site that require you be be avalid user.
> > it inherits from SitePage
> > '''
> > def __init__(self):
> > SitePage.__init__(self)
> >
> > def writeSidebar(self):
> > self.startMenu()
> > self.menuItem('Log out','Logout')
> >
> > if I want the sidebae from SitePage also I can
> > add
> > SitePage.writeSidebar(self)
> > etc....
> >
> > If you just want a minor to chage then define a
> > SitePage based on SideBar something like so:
> >
> > from BasePage import BasePage
> >
> > class SitePage(BasePage):
> > def __init__(self):
> > self.MenuColor="#FF00FF"
> >
> > def writeSidebar(self):
> > self.writeln('<font color="%s">' %
> > self.MenuColor)
> >
> > In the pages where you want the color to change
> > redefine self.MenuColor (You do not need to
> > redefine the writeSidebar method here.
> >
> > from SitePage import SitePage
> >
> > class NewPage(SitePage):
> > def __init__(self):
> > self.MenuColor="#C0C0C0"
> >
> >
> >
> >
> > ----- Original Message -----
> > From: "Aleksandar Kacanski"
> > <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, November 19, 2001 3:30 PM
> > Subject: [Webware-discuss] rewrite sidebar from
> > servlet
> >
> >
> > > Hello All,
> > > how do I go about changing a
> > SidebarSections
> > > within the servlet. Example would be changing
> > a
> > > link or color in specific link under
> > > SidebarSections.
> > > I am fine if the call is originating from the
> > > ExamplePage or SidebarPage, but I am unable
> > to
> > > overwrite method within servlet like Welcome.
> > > In essence I want to overwrite a link color
> > on
> > > the WebwareEmailMenu when I click on it
> > without
> > > defaulting to HTML body args.
> > >
> > > Thanks
> > > /s
> > >
> > >
> >
> __________________________________________________
> > > Do You Yahoo!?
> > > Find the one for you at Yahoo! Personals
> > > http://personals.yahoo.com
> > >
> > >
> > _______________________________________________
> > > Webware-discuss mailing list
> > > [EMAIL PROTECTED]
> > >
> >
> https://lists.sourceforge.net/lists/listinfo/webware-discuss
> >
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Find the one for you at Yahoo! Personals
> http://personals.yahoo.com
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss