Diez,

Sorry for sounding abrupt I am just getting frustrated trying to do a basic
thing. I did make the change as you suggested
and now I get the following error. What is puzzling is that the error is
saying that it excepts one parameter and I am passing 2.
I have attached both my controller.py, and my kid file

Thanks for your help

Rohan
500 Internal error

The server encountered an unexpected condition which prevented it from
fulfilling the request.

Page handler: <bound method Root.default of
<deceptive.controllers.Root object at 0x0168F5F0>>
Traceback (most recent call last):
  File 
"c:\python25\lib\site-packages\cherrypy-2.3.0-py2.5.egg\cherrypy\_cphttptools.py",
line 121, in _run
    self.main()
  File 
"c:\python25\lib\site-packages\cherrypy-2.3.0-py2.5.egg\cherrypy\_cphttptools.py",
line 264, in main
    body = page_handler(*virtual_path, **self.params)
  File "<string>", line 3, in default
  File 
"c:\python25\lib\site-packages\TurboGears-1.0.4.2-py2.5.egg\turbogears\controllers.py",
line 344, in expose
    *args, **kw)
  File "<string>", line 5, in run_with_transaction
  File 
"c:\python25\lib\site-packages\TurboGears-1.0.4.2-py2.5.egg\turbogears\database.py",
line 356, in so_rwt
    retval = func(*args, **kw)
  File "<string>", line 5, in _expose
  File 
"c:\python25\lib\site-packages\TurboGears-1.0.4.2-py2.5.egg\turbogears\controllers.py",
line 359, in <lambda>
    mapping, fragment, args, kw)))
  File 
"c:\python25\lib\site-packages\TurboGears-1.0.4.2-py2.5.egg\turbogears\controllers.py",
line 386, in _execute_func
    output = errorhandling.try_call(func, *args, **kw)
  File 
"c:\python25\lib\site-packages\TurboGears-1.0.4.2-py2.5.egg\turbogears\errorhandling.py",
line 72, in try_call
    return func(self, *args, **kw)
  File "C:\Python25\Lib\Deceptive\deceptive\controllers.py", line 22, in default
    return self.index(pagename)
  File "<string>", line 3, in index
  File 
"c:\python25\lib\site-packages\TurboGears-1.0.4.2-py2.5.egg\turbogears\controllers.py",
line 339, in expose
    *args, **kw)
  File "<string>", line 5, in _expose
  File 
"c:\python25\lib\site-packages\TurboGears-1.0.4.2-py2.5.egg\turbogears\controllers.py",
line 359, in <lambda>
    mapping, fragment, args, kw)))
  File 
"c:\python25\lib\site-packages\TurboGears-1.0.4.2-py2.5.egg\turbogears\controllers.py",
line 386, in _execute_func
    output = errorhandling.try_call(func, *args, **kw)
  File 
"c:\python25\lib\site-packages\TurboGears-1.0.4.2-py2.5.egg\turbogears\errorhandling.py",
line 72, in try_call
    return func(self, *args, **kw)
TypeError: index() takes exactly 1 argument (2 given)







On Feb 6, 2008 11:20 AM, Diez B. Roggisch <[EMAIL PROTECTED]> wrote:

> On Wednesday 06 February 2008 16:41:08 Rohan Perera wrote:
> > Diez,
> >
> > thanks for getting back to me so in other word in the controller method
> do
> > the followiing
> > *def index( ): remove the parameter
> >
> > *In my template I have the following code:
> > <p><a href="entertext?">View complete page list</a></p>
> >
> >
> > However I am getting the following error below. I don't understand how I
> am
> > passing a parameter. Can someone
> > out there explain to me the basics of creating templates.
>
> You don't need explained how to do templates - basic python is required
> first...
>
> You removed ALL parameters from index - which is of course wrong, it's an
> instance-method and needs a self-parameter as first argument. Like this:
>
>
> ...
>   @expose(...)
>   def index(self):
>       ...
>
>
>
> Diez
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Attachment: page.kid
Description: Binary data

import logging
import re
import CheckDeceptive_Turbo as check

import cherrypy
from docutils.core import publish_parts
from sqlobject import SQLObjectNotFound

import turbogears
from turbogears import controllers, expose,validate,redirect

import json
from model import Page

log=logging.getLogger("deceptive.controllers")

wikiwords=re.compile(r"\b([A-Z]\w+[A-Z]+\w+)")

class Root(controllers.RootController):
    @expose()
    def default(self,pagename):
        return self.index(pagename)

    
    @expose(template="deceptive.templates.page")
    #Loading Wiki pages From Database
    def index(self,pagename="FrontPage"):
        try:
           page=Page.byPagename(pagename)
        except SQLObjectNotFound:
           redirect("/notfound",pagename=pagename)
        content=publish_parts(page.data,writer_name="html")["html_body"]
        content=wikiwords.sub(r'<a href="\1">\1</a>',content)
        return dict(page=page, data=content)
    

        
    @expose(template='deceptive.templates.edit')
    def edit(self,pagename):
        page=Page.byPagename(pagename)
        return dict(page=page)

    @expose()
    def save(self,pagename,data):
        page=Page.byPagename(pagename)
        page.data=data
        turbogears.flash("Changes Saved!")
        redirect("/"+pagename)
        
    @expose(template='deceptive.templates.edit')    
    def validate(self,pagename,data):
        page=Page.byPagename(pagename)
        page.data=data
        check.ValidateText(data)
        turbogears.flash("Changes Saved!")
        redirect("/"+pagename)

    @expose(template='deceptive.templates.edit')
    def notfound(self,pagename):
        page=Page(pagename=pagename,data="")
        return dict(page=page)

    @expose(template='deceptive.templates.entertext')
    def index(self):
         redirect("/"+"entertext")
  
   

Reply via email to