[web2py] rewrite url using routes.py
HI, can I rewrite url using routes.py? where, url repesented by domain name. I tried to follow routes.example.py but it didn't work routes_in = (('.*:/favicon.ico', '/examples/static/favicon.ico'), ('.*:/robots.txt', '/examples/static/robots.txt'), (('http://www.mydomain.com/init/news/index/0/14', '/ sonn'))) please help. Thanks
[web2py] Re: get value of an combo box (select tag)
I write a combo box to select all table in the database I want to get tabe name after select I could get the table name if i use form to click submit button, but now I want get table without form?? in section http://web2py.com/book/default/section/5/2, OPTION, SELECT information is not enough for me to do On 23 Tháng Ba, 16:12, tandnk50 wrote: > Hi all, > anyone show me how to I get selected value of combo box ?? > thank you very much -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] get value of an combo box (select tag)
Hi all, anyone show me how to I get selected value of combo box ?? thank you very much -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: about syntax in web2py
ok, I solved my problem :) , I missed a ) thank you On 19 Tháng Ba, 20:51, tandnk50 wrote: > ok, this is my action code. I want import data > > def read_xls(): > exec('import applications.%s.modules.xlrd as xlrd' % > request.application) > import os > path=os.path.join > (request.folder,'private','a_dummy_file_name.xls') > book = xlrd.open_workbook(path) > sh = book.sheet_by_index(0) > table=request.vars['select'] > students={} > field=len(db[table].fields)-1 > if (sh.ncols <> field): > response.flash='select table again' > redirect(URL(r=request,f='view_xls')) > > for col,field in enumerate(db[table].fields): > for row in range(sh.nrows): > if (row==0): > db[table].insert(field=sh.cell_value(row,col)) > table_id[str(col)]=db[table].id > continue > db(db[table].id==table_id[str(col)] > [table].insert(field=sh.cell_value(row,col)) > students=db().select(db[table].ALL) > > return dict(students=studens) > > On 19 Tháng Ba, 20:47, DenesL wrote: > > > > > Can you show the action's whole source?. > > > On Mar 19, 9:38 am, tandnk50 wrote: > > > > I'm sorry . > > > But my above code writeen in a action, the 'return dict()' is for the > > > action > > > > On 19 Tháng Ba, 20:34, DenesL wrote: > > > > > return may only occur syntactically nested in a function definition, > > > > you don't have one. > > > > > On Mar 19, 9:06 am, tandnk50 wrote:> I wrote > > > > statements but invalid syntax and i don't know the problem, > > > > > for example : > > > > > def func(): > > > > for i in range(3): > > > > > > for j in range(2): > > > > > if i>1 : > > > > > print i > > > > > else: > > > > > print j > > > > > return dict() (or any statement ( eg, print 'hello')..) > > > > > > but invaliad syntax at return ... > > > > > ?? > > > > > how do i fix ? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: about syntax in web2py
ok, this is my action code. I want import data def read_xls(): exec('import applications.%s.modules.xlrd as xlrd' % request.application) import os path=os.path.join (request.folder,'private','a_dummy_file_name.xls') book = xlrd.open_workbook(path) sh = book.sheet_by_index(0) table=request.vars['select'] students={} field=len(db[table].fields)-1 if (sh.ncols <> field): response.flash='select table again' redirect(URL(r=request,f='view_xls')) for col,field in enumerate(db[table].fields): for row in range(sh.nrows): if (row==0): db[table].insert(field=sh.cell_value(row,col)) table_id[str(col)]=db[table].id continue db(db[table].id==table_id[str(col)] [table].insert(field=sh.cell_value(row,col)) students=db().select(db[table].ALL) return dict(students=studens) On 19 Tháng Ba, 20:47, DenesL wrote: > Can you show the action's whole source?. > > On Mar 19, 9:38 am, tandnk50 wrote: > > > > > I'm sorry . > > But my above code writeen in a action, the 'return dict()' is for the > > action > > > On 19 Tháng Ba, 20:34, DenesL wrote: > > > > return may only occur syntactically nested in a function definition, > > > you don't have one. > > > > On Mar 19, 9:06 am, tandnk50 wrote:> I wrote > > > statements but invalid syntax and i don't know the problem, > > > > for example : > > > > def func(): > > > for i in range(3): > > > > > for j in range(2): > > > > if i>1 : > > > > print i > > > > else: > > > > print j > > > > return dict() (or any statement ( eg, print 'hello')..) > > > > > but invaliad syntax at return ... > > > > ?? > > > > how do i fix ? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] Re: about syntax in web2py
I'm sorry . But my above code writeen in a action, the 'return dict()' is for the action On 19 Tháng Ba, 20:34, DenesL wrote: > return may only occur syntactically nested in a function definition, > you don't have one. > > On Mar 19, 9:06 am, tandnk50 wrote:> I wrote > statements but invalid syntax and i don't know the problem, > > for example : > > def func(): > for i in range(3): > > > for j in range(2): > > if i>1 : > > print i > > else: > > print j > > return dict() (or any statement ( eg, print 'hello')..) > > > but invaliad syntax at return ... > > ?? > > how do i fix ? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] about syntax in web2py
I wrote statements but invalid syntax and i don't know the problem, for example : for i in range(3): for j in range(2): if i>1 : print i else: print j return dict() (or any statement ( eg, print 'hello')..) but invaliad syntax at return ... ?? how do i fix ? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.