Hello,
Working my way thru the wiki app demo in the online manual... I kept
getting a weird error like this:
Traceback (most recent call last):
> File "gluon/restricted.py", line 205, in restricted
> File "E:\web2py\applications\mywiki\controllers/default.py", line 31, in
> <module>
> TypeError: requires_login() takes exactly 1 argument (2 given)
>
>
whenever I attempted to access any of the views for this app. Only on line
31 of the controller 'default.py', right before 'def documents():'.
Here is the code listing from the 'trouble ticket':
"edit an existing wiki page"
> this_page = db.page(request.args(0)) or redirect(URL('index'))
> form = crud.update(db.page, this_page, next = URL('show',
> args=request.args))
> return dict(form=form)
>
> @auth.requires_login
>
> def documents():
> "browse & edit all documents attached to a given page"
> page = db.page(request.args(0)) or redirect(URL('index'))
> db.document.page_id.default = page.id
>
>
I went back thru the code several times, and I couldn't seem to find
anything specifically wrong that jumped out at me...
...but when I commented out line 31 entirely - everything began working.
Eh?!?
Could someone explain to me why that one line, right there, would cause
things to break when the decorator is used elsewhere in the same controller
'default.py' several times with no problems?
There are any number of things I don't fully understand yet, but most of
them 'just work' so I've kept moving on, learning as I go. This one has me
kinda stumped - I don't *think* its a typo on my part, though thats
certainly the most likely cause. If it is, I'm not seeing it though, at
least not right there in the section of code the trouble ticket
high-lighted.
TIA,
Monte