Component 0.2 ExamplePage error "...must be called with CPage..."

Richard Boyce <[email protected]>
Newsgroups gmane.comp.python.webware
Message-ID <[email protected]>
Hi,

First, I just want to thank the developers/contributers of Webware for 
their excellent work. I am pretty new to web application development 
having only done small applications in the past. After looking at 
several other platforms in Java and Python I have chosen Webware for 
(what is to me) a fairly large project. I like Webware because it is 
lightweight yet well designed so easy to understand, use, and extend. I 
am also happy to see that there are others are currently active in its 
ongoing development.

Below is a description of a problem with running the Component 0.2 
examples and the fix I found:

- I checked out Component 0.2 from 
http://webwareforpython.org/downloads/Component/Component-0.2.tar.gz and 
experimented with it by creating a symbolic link to its  Example 
subdirectory in a new Webkit (0.91) instance and then adding 
Contexts['Examples'] = 'Examples' in Application.config.

- I then restarted the Webware site and visited it using http://<local 
webware uri>/Examples/ ->This showed the default Webware examples page 
but nothing else.

- When I looked at Main.py in ./Examples I saw the line from 
WebKit.Examples.ExamplePage. I added the following line under the Main 
class definition just so I could play with the examples:

 def respond(self, trans):
        trans.application().forward(trans, '/Login' + 
trans.request().extraURLPath() )

- This led to the following error when I refreshed http://<local webware 
uri>/Examples/ :
....
....

File "/home/codehop-dev/Downloads/LoginKit-0.1/LoginKit/Examples/ExamplePage.py", line 19, in title [edit] <http://marigold.informatics.washington.edu:7000/Admin/EditFile?filename=/home/codehop-dev/Downloads/LoginKit-0.1/LoginKit/Examples/ExamplePage.py&line=19>
    return CPage.title(self)
TypeError: unbound method title() must be called with CPage instance as first argument (got Login instance instead)

- After fiddling awhile I noticed that the ExamplePage class in ./Example did not inherit from CPage so I added it:

class ExamplePage(CPage, WebKitExamplePage):


- This fixed the problem and all the pages in Example worked fine.


Hope it helps,
Richard Boyce







-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.