Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String format error in default.py after updating to web2py trunk #60

Closed
spametki opened this issue May 1, 2013 · 1 comment
Closed

Comments

@spametki
Copy link
Contributor

spametki commented May 1, 2013

I think it is related to this change in web2py:
http://code.google.com/p/web2py/source/detail?r=a942e058c684987c211f13739b32f6308941f521

I updated web2py and accessing a book's index (via the menu) throws a format error in default.py line no. 101

I fixed the book error by using an int 0 by default for the chapter number instead of the "0" string:

diff --git a/controllers/default.py b/controllers/default.py
index 594eab2..c363439 100644
--- a/controllers/default.py
+++ b/controllers/default.py
@@ -94,7 +94,7 @@ def calc_date(now=request.utcnow.date()):
     return now.strftime(format)

 def chapter():
-    book_id, chapter_id = request.args(0), request.args(1,cast=int,default='0')
+    book_id, chapter_id = request.args(0), request.args(1, cast=int, default=0)
     subfolder = get_subfolder(book_id)
     info = cache.ram('info_%s' % subfolder, lambda: get_info(subfolder), time_expire=TIME_EXPIRE)
     chapters = cache.ram('chapters_%s' % subfolder, lambda: get_chapters(subfolder), time_expire=TIME_EXPIRE)
@mdipierro
Copy link
Collaborator

fixed by Alan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants