[web2py] admin interface wrong on 2.8.2
hey everyone, got web2py 2.8.2 working on apache and centos. fixed under https://groups.google.com/forum/#!topic/web2py/DexgEESPk38 however, i mentioned that admin interface is all messed up. my admin interface is not right though. the cool interface for admin is missing like the pull-downs and stuff. i just get straight html text without the java scripting side of it. am i missing another js file that i should copy? it does work with the "python web2py.py" interface, but not with apache. so what would be the difference in that? thanx again, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] login crash under 2.8.2
hey everyone, thanx for the help on my prior posts, things are moving along. i now get a crash when i try to login under the application, the traceback is: Traceback (most recent call last): File "/opt/web-apps/web2py/gluon/main.py", line 479, in wsgibase session._try_store_in_cookie_or_file(request, response) File "/opt/web-apps/web2py/gluon/globals.py", line 1089, in _try_store_in_cookie_or_file return self._try_store_in_file(request, response) File "/opt/web-apps/web2py/gluon/globals.py", line 1096, in _try_store_in_file or self._unchanged(response)): File "/opt/web-apps/web2py/gluon/globals.py", line 1041, in _unchanged session_pickled = cPickle.dumps(self) File "/usr/lib/python2.6/copy_reg.py", line 84, in _reduce_ex dict = getstate() TypeError: 'NoneType' object is not callable none of this points to my code, so i believe it is in web2py. or, do i have to adjust something in my code to compensate for the update. i have cleared all sessions and copied the web2py.js appadmin.html and appadmin.py into my applications and made the appropriate changes in apache config files as per my prior two tickets. ok, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: login crash under 2.8.2
oh, btw, the above does not happen under "python web2py.py" but only under the apache umbrella. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: login crash under 2.8.2
yes it was/is with 2.8.2, but running only under apache, it is fine with "python web2py" AND i did erase all session files, as in "rm -rf sessions/*" which is a hard remove in linux. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: login crash under 2.8.2
any ideas on this exception and trace? a little anxious about it because my site is essentially offline. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: login crash under 2.8.2
does anyone else have this problem, or is it only me? is there at least acknowledgement that is is a problem, or is my sanity not in check? should i change my programming approach in some way or am i missing a handler or loading of a handler? just waiting on some expert advice. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: login crash under 2.8.2
hey leonel, i am still here. watching and waiting. no worries. i did try the sessions delete and the pyc delete under gluon but the exception does return rather immediately. i am not as good as tracing through code as you, but it does seem like a hard one. sorry for being the messenger. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] splitting fields from one table across two functions/views
hey everyone, so i have a main form/view that shows all but three of the fields from a single table. and then i am designing another form/view to show the other three. the other three are text fields so that the user can write paragraphs, so showing those three on a full form makes sense. anyway, i digress. i am using SQLFORM with "sform.process(onvalidation=chk_worksheet0).accepted:" under the controller function and "{{=sform.custom.begin}}" ... "{{=sform.custom.widget.field_names}}"... under the view. so, if i modify the any of the three in the second form, and then submit, the values are properly updated and stored in the database. the application then goes back to the main form and show the other data fine. however, if i go back into the second form, the one with only the three, the data i originally put in is then gone. i sql'ed the three fields, and the data does disappear. weird and why? i tried a few things to get it to work but i am not sure why the application is just erasing the data when i go back into that second form. it only erases the data of the three fields and not the other fields. the main thing i tried was the fields option on SQLFORM, but that didn't seem to work. suggestions? lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: login crash under 2.8.2
sorry i dropped off the map for a while. my server had a hard hardware crash and i have been managing its replacement. i think the processor or motherboard went bad because the memory and HD are testing out ok. i actually decided to goto amazon's EC2 and i am using centos 6,4 under that. it is super fast. i went back to web2py 2.4.6 and got my apps running again. i ordered an NAS to use as my fileserver in my home and replace that section of the server that crashed. the good thing about the EC2 is that i can copy my OS instance to another, then upgrade web2py and then test it separately without bringing down my main OS and site. so once i get my other bug fixed in the other thread, then i can work on this upgrade problem more. is it really wrong or unstable to have web2py work under apache and mod_wsgi? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: login crash under 2.8.2
oh yeah, i forgot to mention. i am running multiple domain names and i am using VirtualHost under apache to redirect to the proper web2py application. could that be the problem? i am using the session as files, i like that better then the DB option because, well, i just like it because it is more direct from a developer point of view to just access the file directly if need be. wouldn't it be faster also? anyway, i didn't understand all of that business with the __getstate__ and such. that is way deep for me without knowing much more about the inner workings of python. not that i am adverse to learning them, i am just not that intimate with python yet. so i will have a learning curve with this bug and thread. On Monday, December 23, 2013 8:00:16 AM UTC-5, Leonel Câmara wrote: > > No it's not wrong to use apache and wsgi, although there are better > options if you use Linux, in my experience there's only a problem if you're > running it on ms windows and you have more than one web2py instance as they > share the same embedded mod_wsgi. > does apache under centos do such a thing? run multiple web2py instances while sharing the same mod_wsgi? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: splitting fields from one table across two functions/views
ok, here is the snippets of code: @auth.requires_login() def worksheet0(): chkSession() msg = "" cidi = args_to_int(0) #case id tCase = db.cases tSheet = db.case_worksheets sCase = db(tCase.id==cidi).select().first() now = datetime.datetime.utcnow() if not sCase or (now > (sCase.modified_date + datetime.timedelta(days=7))): #prompt to update case information every 90 days redirect(URL(f="case", args=[cidi])) sidi = args_to_int(1) #sheet id aidi = args_to_int(2) #action id if sidi: """ commented for now; tried to leave out the 3 text fields but it didn't make a difference uflds = [] flds = tSheet.fields for f in flds: if (f[:4] <> 'mtn_'): uflds.append(f) #return '%s' % uflds """ sform = SQLFORM(tSheet, record=sidi, buttons=[INPUT(_type='submit', _name='submit', _value='Save Worksheet', _style="width:410px;"), INPUT(_type='submit', _name='mtn_modify', _value='Save Worksheet and View Motion to Modify', _style="width:410px;"), INPUT(_type='submit', _name='summary', _value='Save Worksheet and View Analysis Summary', _style="width:410px;")]) sform.vars.case_id = sCase.id #tried to include the 3 fields in the form to ensure the data won't get lost, but it still does sform.vars.mtn_introduction = sform.vars.mtn_introduction sform.vars.mtn_body = sform.vars.mtn_body sform.vars.mtn_closing = sform.vars.mtn_closing setstyles(sform, 700, "Save Worksheet") if sform.process(onvalidation=chk_worksheet0).accepted: if sform.vars.submit: response.flash = "Worksheet Information Updated" elif sform.vars.mtn_modify: sidi = sform.vars.id #makes sure an appended record id gets to the summary session.flash = "Worksheet Information Saved & Updated" redirect(URL(f="worksheet0a", args=[sCase.id,sidi])) elif sform.vars.summary: sidi = sform.vars.id #makes sure an appended record id gets to the summary session.flash = "Worksheet Information Saved & Updated" redirect(URL(f="summary", args=[sCase.id,sidi])) elif sform.errors: response.flash = "Worksheet Errors" try: if sform: pass except: sform = "" slist = db(tSheet.case_id==cidi).select(orderby=~tSheet.input_date) return dict(sCase=sCase, slist=slist, sform=sform, msg=msg) def chk_worksheet0(f): v = f.vars v.sheet_name = v.sheet_name[:32] v.sheet_notes = v.sheet_notes[:256] #tried to make sure the three fields were included in the verification just to ensure the data doesn't get lost, but it still does v.mtn_introduction = v.mtn_introduction v.mtn_body = v.mtn_body v.mtn_closing = v.mtn_closing return f @auth.requires_login() def worksheet0a(): chkSession() cidi = args_to_int(0) #case id sidi = args_to_int(1) #sheet id if cidi and sidi: tCase = db.cases tSheet = db.case_worksheets sCase = db(tCase.id==cidi).select().first() sSheet = db(tSheet.id==sidi).select().first() sform = SQLFORM(tSheet, record=sidi, fields=['id','mtn_introduction','mtn_body','mtn_closing'], formstyle="divs") setstyles(sform, 700, "Save Worksheet and Return to Main") if sform.process().accepted: session.flash = "Motion to Modify Updated" redirect(URL(f="worksheet0", args=[sCase.id,sSheet.id])) elif sform.errors: response.flash = "Worksheet Errors" return dict(sCase=sCase, sSheet=sSheet, sform=sform) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: splitting fields from one table across two functions/views
so let me explain the above code a little. two views, two worksheets, via controller functions worksheet0 and worksheet0a. if you go into worksheet0a and modify the data any of the three text fields, the data is stored fine in the DB after you press the SUBMIT which displays "Save Worksheet and Return to Main". if you go into the main worksheet, worksheet0, and modify or not its field data, and press any of the three SUBMIT buttons, the data from the worksheet0a is wiped from the DB. those three fields are mtn_introduction, mtn_body, and mtn_closing. ok. i hope the code reveals the problem in my approach. thanx in advance and have a great day. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: splitting fields from one table across two functions/views
yes, i thought those lines did absolutely nothing, however, when the simplest most stripped down code doesn't work and you start adding code in the hope something will provide a solution. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: login crash under 2.8.2
ok, so centos 6x is the way to go for the most stable, reliable, etc., in excellence of computing? that is what you are saying, because i really love centos and have been using it for years. but i have been doubting my httpd.conf setups for a while because all of those settings and then add in VirtualHosts and it gets pretty mind boggling. so i really really appreciate a proof of my config files and let me know what could be unstable. so here they are as attachments. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: splitting fields from one table across two functions/views
ok, so i wrote a new application and did the minimum to strip away the other code and things i am doing to prove that this behaviour is quite odd. i wrote this under web2py 2.4.6. here is the added code for a default *db.py*: #begin db = DAL('postgres://postgres:passwd@localhost/test', pool_size=29) db.define_table('test1', Field('master_id', 'integer', required=IS_NOT_EMPTY()), Field('input_date', 'datetime', writable=False, readable=False, requires=NE, default=datetime.datetime.today()), Field('s1', length=16), Field('i1', 'integer'), Field('s2', length=16), Field('i2', 'integer'), format = '%(id)s, %(master_id)s') #end where the table is emulating a detail table of a master and must store the master_id reference. here is the code added to a default *default.py* file: #begin def test1a(): try: tidi = mcp.request_to_int(request.args[0]) #test id except: tidi = None tTest = db.test1 #sTest = db(tTest.id==tidi).select().first() now = datetime.datetime.utcnow() sform = SQLFORM(tTest, record=tidi, fields=['id', 'master_id', 's1', 'i1']) sform.vars.master_id = 1 sform.vars.input_date = sform.vars.input_date #return HTML(BODY("tidi: %s" % tidi, BR(), "now: %s" % now, BR(), "%s" % sform)) if sform.process(onvalidation=chk_test1a).accepted: response.flash = "TEST1a Updated" elif sform.errors: response.flash = "TEST1a Errors" slist = db(tTest.id>0).select(orderby=tTest.id) for i in slist: i.input_date = A(i.input_date, _href=URL(f="test1a", args=[i.id])) return dict(slist=slist, sform=sform) def chk_test1a(f): v = f.vars v.s1 = v.s1[:16] return f def test1b(): try: tidi = mcp.request_to_int(request.args[0]) #test id except: tidi = None tTest = db.test1 #sTest = db(tTest.id==tidi).select().first() now = datetime.datetime.utcnow() sform = SQLFORM(tTest, record=tidi, fields=['id', 'master_id', 's2', 'i2']) sform.vars.master_id = 1 #return HTML(BODY("tidi: %s" % tidi, BR(), "now: %s" % now, BR(), "%s" % sform)) if sform.process(onvalidation=chk_test1b).accepted: response.flash = "TEST1b Updated" elif sform.errors: response.flash = "TEST1b Errors" slist = db(tTest.id>0).select(orderby=tTest.id) for i in slist: i.input_date = A(i.input_date, _href=URL(f="test1b", args=[i.id])) return dict(slist=slist, sform=sform) def chk_test1b(f): v = f.vars v.s2 = v.s2[:16] return f #end and here is the code for the *test1a.html* view file: #begin {{left_sidebar_enabled=right_sidebar_enabled=False}} {{extend 'layout.html'}} {{=A("Goto test1b", _href=URL(f="test1b"))}} {{=slist}} {{=A("Add New Record", _href=URL(f="test1a"))}} {{=sform.custom.begin}} {{=sform.custom.widget.id}} S1:{{=sform.custom.widget.s1}} I1:{{=sform.custom.widget.i1}} {{=sform.custom.submit}} {{if sform.errors: =sform.errors pass}} {{=sform.custom.end}} {{=sform}} #end and similarly here is the code for the *test1b.html* view file: #begin {{left_sidebar_enabled=right_sidebar_enabled=False}} {{response.subsubtitle = "TEST1b"}} {{extend 'layout.html'}} {{=A("Goto test1a", _href=URL(f="test1a"))}} {{=slist}} {{=A("Add New Record", _href=URL(f="test1b"))}} {{=sform.custom.begin}} {{=sform.custom.widget.id}} S2:{{=sform.custom.widget.s2}} I2:{{=sform.custom.widget.i2}} {{=sform.custom.submit}} {{if sform.errors: =sform.errors pass}} {{=sform.custom.end}} #end which is just the opposite of test1a. try it without the fields option under SQLFORM. you will see the wiping or nulling of the other fields' data. with the fields options, the master_id and input_date don't work right because then those fields are wiped or nulled. i need all of the data to stick and stay no matter which view is running. thanx in advance and hopefully this proves the point. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: login crash under 2.8.2
ok LightDot, just to confirm the tweak i should do for the sake of stability. you are saying that under each VirtualHost i should have a separate WSGIDaemonProcess under it. or, i should remove the WSGIDaemonProcess from the wsgi.conf file and place it under each domains VirtualHost section. is that correct? and if so, are there other options i should include in that line beside what i already have: WSGIDaemonProcess web2py user=apache group=apache thanx in advance and really thank you for the vote of confidence and confirmation on centos. it is great i have been betting on the right horse. lucas On Tuesday, December 24, 2013 9:47:19 AM UTC-5, LightDot wrote: > > Ok, so you're using one mod_wsgi / web2py instance and map virtualhosts > into specific apps within. Looks like a neat solution, but it seems to be > problematic in the same way Leonel is describing for the Windows > environment. Basically, different virtualhosts under the same > WSGIDaemonProcess have issues with sessions... > > We use a separate web2py and a seperate WSGIDaemonProcess for each > virtualhost, that's why we didn't experience problems... > > As for centos - sure, I think it's a great choice. Any good RHEL > derivative, for that matter. We've been using Scientific Linux 6 and CentOS > 2, 3 and 5 before that. RHEL derivatives do a great job for us. I'm not > saying other distros aren't suitable, it's just that these tick all the > boxes for us. > > Regards > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] db select of certain id
how would you syntax this out properly? qGrp = db(db.auth_group.id in (4,6)).select() so i only want to pull records with the id of 4 and 6. thanx in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: db select of certain id
very sweet, thanx anthony, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] login_onaccept redirect and _next in URL
hey everyone, under db.py i have: auth.settings.login_onaccept = check_login auth.settings.register_onaccept = check_login def check_login(form): redirect(URL(c="default", f="onlogin")) return and then under default, the onlogin function, checks the status of the subscription and displays the terms of use before allowing the user to go any deeper. there is one function that i want users to be logged in to use, so i decorate it with "@auth.requires_login()" and of course it brings the user to the login screen if then aren't. however, this one function does not require the status and terms of use stuff. after login, the function can just run. so, how can i know under the check_login function that either the _next was in the URL or something in the session or something to let me know that the link to this decorated function was pressed by the user so i can redirect properly? thanx in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: login_onaccept redirect and _next in URL
ok, i answered my own question. under the check_login function, i was able to access the request.env.query_string to see the next, after login, URL and i was able to redirect appropriately. sweet. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] convert dict to gluon.dal.Row
hey everyone, what is the best way to convert a dict with appropriate key names to a row of a table? thanx in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] outer join? i guess
hey everyone, ok i have a table of companies: db.define_table('companys', Field('company_name', length=128, requires=NE, comment='Legal Name of the Company or Entity.'), etc...) and the auth_user table with the added field: db.define_table( auth.settings.table_user_name, ... Field('company_id', db.companys, requires=IS_EMPTY_OR(IS_IN_DB(db, db.companys.id, '%(company_name)s %(telephone)s %(zip)s')), writable=False, readable=False), etc...) i would like a join that selects the company of the auth.user_id and any company that doesn't have a user associated to it at all, i.e., company_id==None. i thought this was just a simple outer join, like tUser = db.auth_user tCmp = db.companys db().select(tUser.id, tUser.email, tCmp.ALL, orderby=tCmp.company_name, left=tUser.on((tCmp.id==tUser.company_id) & (tUser.id==auth.user.id))) but i get those companies that also have a company_id, it just Nones the tUser fields. so i tried many many variations to try and get the right return, but i am out of ideas. i also found that this returns a different result then the above: db(tCmp.id>0).select(tUser.id, tUser.email, tCmp.ALL, orderby=tCmp.company_name, left=tUser.on((tCmp.id==tUser.company_id) & (tUser.id==auth.user.id))) but why? anyway, if anyone could help me get the right select statement, i would be grateful, thanx in advance. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: outer join? i guess
ok, i got lucky. this seems to work perfectly: db((tUser.id==auth.user.id) | (tUser.id==None)).select(tCmp.ALL, orderby=tCmp.company_name, left=tUser.on((tCmp.id==tUser.firm_id))) but honestly, i have no idea why it works. can someone explain this to me? it is almost like the left condition, without the db(), pulls all companies regardless whether there is a user affiliation or not, the the db() section filters that further. is that logic correct or not? lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: outer join? i guess
ah, nice. didn't know that. now i read it in the manual, and the db._lastsql makes it even a bit easier after the statement has run to compare to the output also. sweet. thanx for the tip. learned a new little thing. and after seeing the SQLs for all the different wanderings i did, things are much clearer now. thanx again. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] auth_group/membership auto assign and disable sign up?
hello one and all, i set up three records under auth_group, Developer, Administrator, and Personnel. a few questions. i want to disable the "Sign Up" option under the "Log In" submenu. how do i remove that option? and i want anyone with Administrator right to be able to create new login users. in which case, when he does, how do i direct web2py code to default the new login to assign that new member, under auth_member to the group_id of 3, which is Personnel? thank you in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: auth_group/membership auto assign and disable sign up?
i don't understand the myconf.take function. can you explain that? is it new to web2py? lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: auth_group/membership auto assign and disable sign up?
oh, ok, yes, a config file, i get it. nice. i might use that new feature now. thank you for that. lucas On Wednesday, November 4, 2015 at 11:26:40 PM UTC-5, 黄祥 wrote: > > oopss, sorry, my bad. > the recent web2py version is adapted appconfig to store configuration like > (db uri, smtp server n login, form styling, auth config like my example, > meta, etc), you can see it in models/db.py > e.g. > *models/db.py* > from gluon.contrib.appconfig import AppConfig > ## once in production, remove reload=True to gain full speed > myconf = AppConfig(reload = True) > > so, the example i gave you before is return an error if you didn't define > myconf > > best regards, > stifan > > > On Thursday, November 5, 2015 at 11:19:34 AM UTC+7, lucas wrote: >> >> i don't understand the myconf.take function. can you explain that? is >> it new to web2py? lucas >> >> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] blocking all access but america
hey everyone, what if i wanted to block all users except those originating from one country, say america. i know i can download a IP file of all america IP addresses and have iptables deny all others. but how about a web2py method. any ideas, not necessarily IP based? thanx in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] ajax need to return 4 values
hello one and all, how do i run an ajax function under an onchange of a select where the return 4 values will be going to 4 separate other inputs of type text, select, or textarea? thank you in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: ajax need to return 4 values
ok, i went with qQuery.getJSON. here is how i did it and it works great. JSON trading is cool. just for sharing: under the default controller's function, i have a section where i implement the javascript/jQuery code via an onchange of a select input. the select input is meant to prepopulate with some options and if the user chooses an option then it grabs the values via the jQuery.getJSON from a separate function (below) under default: #bos...template tTGroup = db.task_group tTTemplate = db.task_template jq_template = """jQuery.getJSON('%s/ajaxTemplate', { template_id: jQuery('#task_template').val() }).done( function(t) { jQuery('#task_task').val(t.task); jQuery('#task_task_group_id').val(t.task_group_id); jQuery('#task_recurring').val(t.recurring); jQuery('#task_time_spent_required').prop('checked', t.time_spent_required); jQuery('#task_directive_notes').html(t.directive_notes); }); """ % ('/cs/default') qTemplate = db((tTTemplate.id>0) & (tTTemplate.task_group_id==tTGroup.id)).select(orderby=tTTemplate.task) s = SELECT(OPTION("", _value=""), _id='task_template', _class='generic-widget', _name='template_ID', _onchange=XML(jq_template)) for t in qTemplate: s.append(OPTION("%s (%s)" % (t.task_template.task, t.task_group.task_group), _value="%i" % t.task_template.id)) frm[0].insert(1, TR(TD(LABEL("Task Template:", _id='task_template__label'), _class='w2p_fl'), TD(s, _class='w2p_fw'), TD("Choosing will overwrite certain fields.", _class='w2p_fc'), _id='task_template__row')) #eos...template under controller default: def ajaxTemplate(): id = int(request.vars.template_id) return response.json(db(tTTemplate.id==id).select().first()) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] how to SQLFORM via ajax?
alright, so in a view i have: {{block head}} function clk_form(tidi) { if (tidi != 0) { jQuery('div#form').css('display','block'); ajax('/cs/default/ajaxTask?tidi='+tidi, [], 'form'); } else { jQuery('div#form').css('display','none'); jQuery('div#form').html(''); } return false; } {{end}} New Task No Form where i am trying to pull in the form asynchronously and that part works fine when i press the New Task link/button. and under the controller i have: def ajaxTask(): try: tidi = int(request.vars.tidi) except: tidi = 0 frm = None if tidi and (tidi <> 0): if (tidi == -1): tidi = None frm = SQLFORM(tTask, record=tidi, showid=False, _action=URL(f='ajaxTask', args=[XML('#')])) if frm.process(onvalidation=chk_task).accepted: response.flash = 'Task Added/Updated %i' % (frm.vars.id) #redirect(URL(f='tasks')) elif frm.errors: response.flash = 'Insert/Edit Errors' return frm so, as i said the form pulls up fine and fills in the DIV. but when i submit the form, it all just sort of goes blank. i would like it to commit the insert/edit to the database and then clear the form under the DIV, maybe leave a message of success under the response.flash or the DIV, and leave the rest of the form untouched and unrefreshed. does that make sense? thanx in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: how to SQLFORM via ajax?
hey anthony, thanx for the rapid response. i don't quite get it. will you point in the direction so i can understand the implementation better? thank you. you know, i really love programming in web2py. i have a few years under my belt and it really is an excellent system. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: how to SQLFORM via ajax?
hey anthony, ok, i read the docs you linked me to. still not seeing the details well enough to get me through. sorry, i am thick sometimes. i put in the view: {{block head}} function clk_form(tidi) { if (tidi != 0) { jQuery('div#form').css('display','inline'); } else { jQuery('div#form').css('display','none'); } return false; } {{end}} New Task No Form {{=LOAD(c='default', f='ajaxTask', args=[-1], ajax=True)}} and the function under the controller is pretty basic: def ajaxTask(): try: tidi = int(request.args[0]) except: tidi = 0 frm = None if tidi and (tidi <> 0): if (tidi == -1): tidi = None frm = SQLFORM(tTask, record=tidi, showid=False) return frm so the form loads into the DIV fine. and when i add a new record, it does actually work. however, i can not see how to change the args value of the LOAD function from other areas of the page. you see now i have it hardcoded at -1. so how can i affect that args value from somewhere else in the page and then have it RELOAD the contents of the DIV? thanx in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: how to SQLFORM via ajax?
i don't think any of those videos will answer my question. so how can i affect that args values of the LOAD from somewhere else in the page, without reloading the page, itself, and then have it only RELOAD the contents of the DIV? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: how to SQLFORM via ajax?
thank you anthony, that did it. it is working great. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: exporting to csv
nice job, any idea how to make it a tab delimited file instead of comma? lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: exporting to csv
yes, thank you, that works great. you know i tried to see all of that in the source code api, but i couldn't find the source code api anymore. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] how come i can't TD append?
hello one and all, how come i can't? in_fn = INPUT(_type='text', _name='fn', _value=l.followup_notes, _class='text', _style='text-align: left; width: 100%; height: 16px; padding: 2px;', _rows='1') if completed: in_fn.append(_disabled='disabled') where the error comes in on the last line and is: TypeError: append() got an unexpected keyword argument '_disabled' anyway to make this happen and thank you in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] how come i can't INPUT append?
hello one and all, how come i can't? in_fn = INPUT(_type='text', _name='fn', _value=l.followup_notes, _class='text', _style='text-align: left; width: 100%; height: 16px; padding: 2px;', _rows='1') if completed: in_fn.append(_disabled='disabled') where the error comes in on the last line and is: TypeError: append() got an unexpected keyword argument '_disabled' anyway to make this happen and thank you in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: how come i can't INPUT append?
and you would delete the attribute altogether by? in_fn['_disabled'] = '' or, does that simply set the attribute to empty string? lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] jQuery.ajax
hello one and all, i know this isn't a web2py question, per se. but you'all are very excellent at helping. so i am asking. so i have this code in a javascript section under head: jQuery.ajax({url: "http://web.fscj.edu/Lukacs/misc/fscj.txt";, dataType: "html", method: "GET", timeout: packetTimeout}).done().fail(...) so the ajax always fails. it is just a simple text file on a web server, you can try it, just returns a bit of text. how come ajax doesn't pull it and how can i make it pull it? thanx, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: jQuery.ajax
ok, i think i figured it out. i just had to go with the " /Lukacs/misc/fscj.txt <http://web.fscj.edu/Lukacs/misc/fscj.txt>" part for the url because there are some rules where there are no cross-domain references made. alright, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] best advice on customer/client picklist popup.
hello one and all, this is not web2py directly, but you'all have great advice. say i have 10,000 customers/clients and i don't want to dump them into a select/option input and force the end user to sift through all of those to pick the right client. i would rather have a child popup window with say 3 search inputs to allow the end user to enter 1 to 3 values into those search inputs and have a query button which goes out to the web2py controller and pulls only those clients based on the combination of the 1 to 3 search inputs. the popup shows that subquery list of clients in a nice much shorter table. the user can then click on the link/button next to the one client they want to choose and pass that result back to the parent window to store it in a input variable for when they finally finish the form and hit submit. i would like to do it with the native web2py/jQuery libraries we currently use in web2py v2.12 or v2.13 for maintenance and simplicity. so what is the best and most simple method to do this? thanx in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: best advice on customer/client picklist popup.
oh, i forgot to mention, that i know how to do an ajax query and pass post variable to it using web2py. i don't know the best javascript/jQuery method for creating and displaying the proper HTML code and inputs/buttons/and such, and then pass the result back to the main parent page. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: boolean DAL field giving error under 2.5.1
so, if you add update=False to the field definition, shouldn't the unchecked checkbox put in a value of false in the db? because i am still getting errors upon updating. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: best advice on customer/client picklist popup.
i did a hybrid of the two suggestions, using the current framework. but i did not use the popup option cuz it is just a bit too much. i create a new row in a form table using jQuery. in an text input field i have an onkeyup that points to some javascript that ajax a partial result set from the controller. the result is displayed in the blank row that colspan's the entire width of the table. it shows the client information as a subset list with a button next to each one entry. when the user selects the right client by pressing on that button, the javascript copies the human readable data into the input field, empties the second row, and copies the id into a hidden field. i did the row trick so that multiple client lists can be pulled on the same screen without interfering with the other. anyway, staying on the same page is a better option. thanx for the input and help. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] print landscape
is there anyway to direct the printer to print the webpage in landscape using only HTML, CSS, and/or jQuery, native to our current version of web2py v2.12 or v2.13? thanx in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] input class="integer" interrupt
hey everyone, so under the sqlform.custom.beginsqlform.custom.end with the view, and more specifically, under the sqlform.custom.widget of db type 'integer' where the widget is of class="integer" there is javascript/jQuery code attached to those inputs that only allow digits and the negative sign. that is how i like it to work. on top of that, i would like to add an onkeyup="jfunction()" that if a c key is pressed, it can call out to a javascript/jQuery function i place under the head block, grabs and passes that id of that widget, pulls up a side div in the left_sidebar, and then still runs the javascript/jQuery code that would normally run as if i didn't interrupt it in the first place without the onkeyup event. how can i do that properly? essentially, i want the side div that pops up to be a calculator type that can place its final value back in the original integer input that the c was typed in. make sense? thank you in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: print landscape
the only way i found that works everywhere was to essentially rotate the entire print by 90degrees. on the screen i show it normal, but on the way to the print, i rotate it as in: @media print { div#page { position: relative; height: 900px; width: 710px; margin: auto; padding: 0px; font: 9pt/1.0 'Times New Roman', serif; border: 0px solid black; background-color: black; } div.rt { position: relative; float: none; left: 352px; width: 444px; height: 684px; margin: -222px; padding: 2px; border: 1px solid #555; -webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); -ms-transform: rotate(90deg); -o-transform: rotate(90deg); filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3); } div.top1 { top: 95px; } div.top2 { top: 76px; } } @media screen { div#page { position: relative; height: 690px; width: 901px; margin: auto; padding: 1px; font: 9pt/1.0 'Times New Roman', serif; border: 1px solid #eee; background-color: black; } div.rt { position: relative; width: 444px; height: 684px; margin: 0px; padding: 2px; border: 1px solid #555; background-color: white; } div.top1 { float: left; } div.top2 { float: right; } } where div.rt is the rotated page when it is sent to the printer but not to the screen and div.top1 and div.top2 are two divs embedded within div.rt. very tedious to get right, but i got it to work. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] model define_table select
hello one and all, ok, under the DAL model, say i have a county and zip code table, like, as defined as: db_region.define_table('county', Field('country_id', db_region.country, requires=IS_IN_DB(db_region, db_region.country.id, '%(country)s'), writable=False, readable=False), Field('state_id', db_region.state, requires=IS_IN_DB(db_region, db_region.state.id, '%(state)s'), writable=False, readable=False), Field('county', length=64, requires=NE, comment='county'), ... and db_region.define_table('post', Field('country_id', db_region.country, requires=IS_IN_DB(db_region, db_region.country.id, '%(country)s'), writable=False, readable=False), Field('state_id', db_region.state, requires=IS_IN_DB(db_region, db_region.state.id, '%(state)s'), writable=False, readable=False), Field('county_id', db_region.county, requires=IS_IN_DB(db_region( *db_region.post.state_id==db_region.county.state_id*), db_region.county.id, '%(county)s'), comment='county'), Field('city', length=64, requires=NE, comment='city'), Field('post', length=11, requires=NE, comment='zip or postal code'), see what i am trying to do in the bold? i am trying to limit the counties listed in the subsequent SQLFORM select/options to only those counties that are in the state. when i try to compile i get an error, specifically an AttributeError. any suggestions? thanx in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: model define_table select
yes massimo, that almost worked. as suggested, i first changed it under the db.py model and then set the request.vars.state_id to the state_id variable just before creating and assigning the SQLFORM. it threw back an empty set of counties. so i thought maybe request is reaching that deep into the db.py module. so i changed the request.vars into session, like session.state_id = state_id, and that worked great. i am always amazed of how fast and efficiently i can get things done using web2py. it really is a wonder and wonderful. thanx massimo. lucas On Sunday, March 27, 2016 at 11:17:19 AM UTC-4, Massimo Di Pierro wrote: > > Correction. replace > > IS_IN_DB(db_region(*db_region.post.state_id==db_region.county.state_id*) > > with > > IS_IN_DB(db_region(*db_region.county.state_id == **request.vars.state_id*) > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Fields question
hey everyone, lets say you have a fields definition like: Field('county', db.county, requires=IS_IN_DB(db, db.county.id, '%(county)s: *mcp.o(%(circuit)i)* CIRCUIT')), see in bold, how do you run a function under that string-returned format string? where o is just the function name under the mcp module. thanx in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Fields question
thanx anthony, you're a expert on those lambda functions. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] bug? menu v2.14.3
hello one and all, so i upgraded from v2.12.3 to v2.14.3. i had trouble with the menu going deeper then the level past the first drop down. so i started a new app and only added the bold below under menu.py: response.menu += [ (T('My Sites'), False, URL('admin', 'default', 'site')), (T('This App'), False, '#', [ *(T('test1'), False, '', [('test12', False, URL(f='test12')), ('test13', False, URL(f='test13'))]),* (T('Design'), False, URL('admin', 'default', 'design/%s' % app)), LI(_class="divider"), ... when i run this app, it does show that test1 is further branched with the little arrow and test12 and test13 don't show in its submenu. now in my main app, the branching is fine. so i don't think it is a problem on the server/web2py part, but probably in the static/css or static/js files probably. i'm not exactly sure how those menu work, but i love when they do. so, just informing, let me know. thanx in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] advice: multiple tables on a single form
hello one and all, so i would like to ask advice. i know that you can have multiple SQLFORMS on a single view and with web2py serialization it works fine, for each separate form has a separate submit button. but what if you wanted to merge certain fields from four different tables into a single form and a single view and have a single submit button? what is web2py's best method for doing this? i was thinking manually create a FORM with the fields and then when submitted, parse out the fields to each table. but is there a better way that is less manual or labor intensive? thanx in advance and have a great day, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: advice: multiple tables on a single form
yes, that will work quite well. not perfectly because i do have one table that requires two parallel entries, but this certainly does give an excellent jump start. thanx anthony, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] create single row of field names without values or None values?
hello one and all, i have to create a mock or dummy row from a table. so i want all of the field name without values or None values. then i want to fill in a few of the values and then pass it to a rather complex function for its result. what is the best method to do this? thanx in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: bug? menu v2.14.3
still no one to weigh in on this one? am i the only one? i feel so lonely and i am not sure what to do with myself. sorry, just kidding. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: create single row of field names without values or None values?
ok, so how do i instantiate a Row() object. please include the proper import syntax. thanx lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: create single row of field names without values or None values?
i think i figured it out. should be: from dal import Row ... row = Row() i know basic, but sometimes it is hard what modules to import when reading the API docs. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: how to find and reference field names in tables
ok cool, so now we know how to iterate through the fields of a table. how can we grab or get the db.py default value for each field also? thanx lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: bug? menu v2.14.3
yeah probably, cuz when i upgraded an app, i usually kept the same css and js and such. so i thought i would over write them from example after i copied my old app over. not a good idea. so really, are we getting rid of more than 2 levels in the menu? or is that just temporary? lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] get field default value?
ok cool, so now we know how to iterate through the fields of a table. how can we grab or get the db.py default value for each field also? thanx lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: create single row of field names without values or None values?
"If that import fails in the web2py environment, you may have bigger problems than instantiating a Row. ;-)" what do you mean by that? lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: bug? menu v2.14.3
what could be their reason to get rid of a good function or feature? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] XHR application/json scraping
hello one and all, i am using web2py to scrape a website. so web2py is a client in this case, not so much the server, but it is running on centos and apache. i am trying to scrape a website and at this point, just trying to login. if i trace all of the network traffic in firefox, i will load the login page, clear the transactions, fill out the page and hit the submit button. the first transaction is a POST of type json with is associated request headers, cookies, and parameters (which is of type json). so i try to replicate all of this in firefox network tracing under a web2py (2.14.3) controller using python 2.7 urllib2 with the CookieJar, build_opener, etc., as shown below. i can not for the life of me figure out why when i replicate the firefox tracing, under Part 2, that i get an HTTPError 500. am i missing something? i don't know what else to look for the replicate the environment. perhaps something with the XMLHttpRequest cross-domain thing, but this isn't a cross domain? or, HTTP Authentication, but Part 1 loads fine, but not Part 2? so some advice is appreciated. thanx in advance, lucas #part 1 #establish connection and session cookie... http = urllib2.HTTPHandler(debuglevel=1) https = urllib2.HTTPSHandler(debuglevel=1) cookies = CookieJar() handlers = [http, https, urllib2.HTTPCookieProcessor(cookies)] site = urllib2.build_opener(*handlers) site.addheaders = [('Host', "core.website.com"), ('User-agent', "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Firefox/45.0"), ('Accept', "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"), ('Accept-Language', "en-US,en;q=0.5"), ('Accept-Encoding', "gzip, deflate, br"), ('Connection', "keep-alive")] urllib2.install_opener(site) try: html1 = site.open('https://core.website.com/CoreCms.aspx') except urllib2.HTTPError, e: return HTML(BODY(str(e.code)+": "+str(e))) except urllib2.URLError, e: return HTML(BODY(str(e))) html1.close() #part 2 #replicate the login as from firefox... postdata = {'username':'us...@yahoo.com','password':'passwd'} jsondata = json.dumps(postdata) jsondata = jsondata.encode('utf-8') site.add_header = ('Referer', "https://core.website.com/CoreCms.aspx";) site.add_header = ('X-Requested-With', "XMLHttpRequest") site.add_header = ('Content-Type', "application/json; charset=utf-8") site.add_header = ('Content-Length', len(jsondata)) try: json1 = site.open('https://core.website.com/CoreWebSvc.asmx/InteractiveLogin', jsondata) data = json.loads(json1.read()) return HTML(BODY("%s" % data)) except urllib2.HTTPError, e: return HTML(BODY(c2, BR(), "E1 HTTPError: "+str(e.code)+", "+str(e), BR(), c4)) except urllib2.URLError, e: return HTML(BODY("E2 URLError: "+str(e.code)+", "+str(e))) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: XHR application/json scraping
ok, so after a week of zero success trying everything i can think of, i decided to try using the requests method instead of the above urllib2 method. it worked like a charm and it was less complicated code. i replicated the above method but in requests as shown below. requests is probably doing more blackbox stuff to get that XMLHttpRequest thing to work, but it totally returned a code of 200 and the proper json record as in the firefox tracing. just documenting for others... #part 1 #establish connection and session cookie... s = requests.Session() qh = { } qh['Host'] = "core.duvalclerk.com" qh['User-Agent'] = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Firefox/45.0" qh['Accept-Language'] = "en-US,en;q=0.5" s.headers.update(qh) r1 = s.get('https://core.website.com/CoreCms.aspx', verify=True) sh1 = rpt(r1, 'r1') c1 = r1.cookies['ASP.NET_SessionId'] #part 2 #replicate the login as from firefox... postdata = {'username':'us...@yahoo.com','password':'passwd'} qh['Referer'] = "https://core.website.com/CoreCms.aspx"; qh['X-Requested-With'] = "XMLHttpRequest" qh['Content-Type'] = "application/json; charset=UTF-8" qh['Origin'] = "https://core.website.com"; s.headers.update(qh) r2 = s.post('https://core.website.com/CoreWebSvc.asmx/InteractiveLogin', data=(json.dumps(postdata)).encode('utf-8'), verify=True) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: only static files forbidden on centos 7.4 apache 2.4
alright, well this has me thinking towards a whole new http server. i just might do it very soon, especially since it just a yum/rpm package on centos already. thank you all for your input. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] setup-web2py-nginx-uwsgi-centos7.sh
hello one and all, i have run bash shell script "setup-web2py-nginx-uwsgi-centos7.sh" from under web2py scripts on centos 7.4, web2py 2.16.1, and nginx 1.12.2. and everything is working for a single domain. ssl and comodo certificates are working also. right now, i have all of the configuration under the above bash shell script, the /etc/nginx/nginx.conf file. so i want to setup a second domain, 3rd, that would point to a separate seconddomain.com/app2 application under the web2py install directory. how do i setup a second /etc/nginx/conf.d file, or two under /etc/nginx/conf.d files, one for each domain pointing to the proper domain and web2py application, along with the changes in nginx.conf file? i've read a lot but it is hard to make sense since uWSGI and web2py are in the mix now also. thank you, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] return binary
hey all, this isn't written totally generally but here is a shot. i would like to return the raw binary data for an img src request and have it display properly on the html page. here is my code: the db.py table definition: db.define_table('png', Field('input_date', 'date', comment='format -MM-DD', default=datetime.date.today(), writable=False, readable=False), Field('png', 'blob', comment='which in postgresql 9.1 is a confirmed bytea field type'), format = '%(id)s %(input_date)s') and under default.py controller: def png(): t = TABLE(TR(TD('png record count: '+str(db(db.png.id>0).count()), _colspan='3'))) qry = db(db.png.id>0).select() for q in qry: t.append(TR(TD(q.input_date), TD(IMG(_src=URL('default', 'getbinary', args=['png', q.id, 'png']) return HTML(BODY(t)) def getbinary(): data = db(db[request.args[0]].id==int(request.args[1])).select(db[request.args[0]][request.args[2]]).first() #data = base64.decodestring(data[request.args[2]]) data = data[request.args[2]] response.headers['Content-Type'] = 'image/png' return response.write(data, escape=True) where you can see i experimented with various "things" to try to get it to display properly under the browser. i have a test png in the database and under postgresql it is confirmed to be 5513 bytes long in hex format. can anyone suggest proper working code? i believe the problem is in the getbinary function. thank you in advance. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: return binary
so, i've figured out that the entire blob stream is not being fully retrieved, only 29 of the 5513 bytes are being retrieved: in my debugging: here is an experimental / expanded of the above function::: table, id, field, stream, and d are all working. but the d[field] under stream.write(d[field]) seems to only retrieve 29 bytes of the 5513 total bytes, as verified by the binary file write i have below. def getbinary(): table = db[request.args[0]] id = int(request.args[1]) field = table[request.args[2]] try: stream = StringIO() d = db(table.id==id).select(field).first() stream.write(d[field]) except: return CAT('exception getbinary():', BR(), 'table:', table, type(table), BR(), 'id:', id, type(id), BR(), 'field:', field, type(field)) #data = base64.b64decode(data) #data = data.decode('base64') f = open('/opt/web-apps/web2py/applications/tms/out1.png', 'wb') f.write(stream.getvalue()) f.close() return CAT(type(stream), BR(), stream) response.headers['Content-Type'] = 'image/png' return response.write(data, escape=False) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: return binary
PostGreSQL 9 which stores the png as direct raw non-escaped hex. AND i am trying a direct sql select by using psycopg2 right now. because using the DAL has been annoying. but i'd love to use it if i could. so i'm open to DAL methods. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: return binary
so this is what i got working wonderfully but using psycopg2 directly instead of the DAL. AGAIN, i would love to convert this back to the DAL for seemlessness and grace. def getbinary(): try: c = psycopg2.connect("dbname='tms' host='%s' user='%s' password='%s'" % ('localhost', 'username', 'passwd')) q = c.cursor(cursor_factory=psycopg2.extras.DictCursor) q.execute('select png from png where (id = 1);') data = StringIO(q.fetchone()[0]) c.commit() finally: if ('q' in locals()) and (q is not None): q.close() if ('c' in locals()) and (c is not None): c.close() #bos...optional until eos and here to double check the binary read via a pure file f = open('/opt/web-apps/web2py/applications/tms/out1.png', 'wb') f.write(data.getvalue()) f.close() data.seek(0) #eos response.headers['Content-Type'] = 'image/png' return response.stream(data, 1024) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: return binary
thank you, that would be wonderful. where do I open the ticket? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] IS_IN_SET boolean force to SELECT
hello one and all, i'm using 2.17.2. under the db DAL, i have a boolean field that defaults to a checkbox under SQLFORM.grid. how do i change that under Field to default to a SELECT instead of a INPUT(_type="checkbox")? thank you in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] SQLFORM element(s) (delete or remove)
hello one and all, the API is tough to navigate. so, i'll ask. SQLFORM element and elements is very powerful. along with update, insert, and append. but how do you delete an element, or multiple elements, under an element that you found? thank you in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] DAL unique on multiple fields
hello one and all, is there a DAL level way to impose a constraint on a single table but unique on multiple fields within that single table? thanx in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] DAL unique on multiple fields
I didn't think so, so I was making sure. I added it under onvalidation under the controller. and also added it to the Postgres database as a custom index. thank you for verifying with me. Lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] admin IDE for general use
hello one and all, alright, so I have these seniors in college that need to learn some programming and I want them to use python and web2py as the development platform. I'd like to be able to store and manage their code (text) as a text field under PostgreSQL, but that would be transparent to the students. essentially, I'd like to create a web2py app, allow students to sign up and register and have a basic login, bring them to a default listing of their previous or current code projects, click on a project or start a new project, take them to the IDE, edit and save their code and then run it with the output as standard HTML in another tab or window. to part that I am gray in is how can I insert the code (text) into the admin IDE of web2py from the text field, and then save the updated code back to the text field when they press Cmd-S to save their code? I guess I don't know how to implement the admin IDE outside of actually being a web2py regular admin. please advise, thank you, Lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: admin IDE for general use
ok, I see that CodeMirror is the base editor. is there a web2py api of some sort that would allow us to inject whatever code, from whatever source, and then save and send that updated code to whatever source? so that the entire functionality of our web2py editor is still the same and working even with different set, get, and save methods? Lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: admin IDE for general use
well, I know that web2py is reading a py/txt file and uploading that into CodeMirror when the page is loaded to be edited under admin. then when saved it writes it back to the file to update it. I'd like to get the py/txt from a text field in PostgreSQL table. and then when its saved, it will update that text field in the PG table. can that be done with a web2py object or method that emulates the admin/CodeMirror without having to recreate all of the divs and textareas etc that I see when I inspect the admin code editor under safari or Firefox? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: admin IDE for general use
;).height()+" ___ "+jQuery('footer').height()); editor.setSize(jQuery(window).width() - 36, jQuery(window).height() - ( jQuery('div#form').offset().top + jQuery('div#form').height()) - jQuery( 'footer').height() - 12); }); {{end}} {{=form.custom.begin}} Project Title:{{=form.custom.widget.title }}Share Code?{{=form.custom.widget. share_code}}Save All Description:{{=form.custom. widget.description}} {{=form.custom.dspval.id}} {{=form.custom.dspval. source_code.strip() if (form.custom.dspval.source_code is not None) else "# -*- coding: utf-8 -*-\nimport mcp\n\ndef index():\n\treturn BODY(\"testing 1 2 3\")"}} {{=form.custom.end}} and it is working really nicely. thank you for the help and suggestions and guidance. I hope the code above will help some other professors show the importance and realities of programming in our modern world. Lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: admin IDE for general use
oh, and btw, I have the whole server running off of a $35 Raspberry Pi 3b+, with PostGreSQL 9, Web2Py 2.17.2, and Nginx. I tricked the wifi of my institution to let the raspberry access and even though its a local address, students can access their code and view their results from whatever device in the classroom. cool, right? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] auth_user change field order
hello one and all, i'm using web2py 2.17>. what is the best method to change the field order on the view's user/profile and user/register when adding fields like??? auth.settings.extra_fields['auth_user'] = [ Field('prefix_title', length=4, requires=IS_IN_SET(('Mr.','Ms.','Mrs.','Dr.')), comment='Enter your Name Prefix.'), Field('birthdate', 'date', requires=NE, comment='Enter in Format: "-MM-DD"'), Field('zip', length=9, requires=NE, comment='Your Zip or Postal Code.'), Field('gender', length=6, default='FEMALE', requires=IS_IN_SET(('FEMALE','MALE')), comment='Enter your Gender.'), Field('input_date', 'date', comment="format -MM-DD", requires=NE, default=datetime.date.today(), writable=False, readable=False) ] thank you in advance. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] auth_user automatically lowercase all email fields
hello one and all, i'm using web2py 2.17>. what is the best method to impose and automatically update the email field to all lowercase characters without making the user have to retype the email??? i want web2py to lowercase no matter its a new registration (insert) or profile (update). thank you in advance. lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: auth_user automatically lowercase all email fields
students log into this site i've had. and they type all kinds of crazy stuff. i don't want to preserve what the students type because students are inconsistent when they login. so i want to force it to lowercase so at least i know what is definitely stored in the db. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: auth_user change field order
i tried this before and after auth.define_tables and it had no effect: auth.settings.profile_fields = ['prefix_title', 'first_name', 'last_name', 'gender', 'birthdate', 'zip', 'email'] -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: auth_user change field order
and i also update web2py from 2.17 to 2.18.5, just in case. On Monday, April 8, 2019 at 10:20:27 AM UTC-4, lucas wrote: > > i tried this before and after auth.define_tables and it had no effect: > > auth.settings.profile_fields = ['prefix_title', 'first_name', 'last_name', > 'gender', 'birthdate', 'zip', 'email'] > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] 2.18.5 LI(_class="dropdown-divider") bug?
hey all, I have the following code under menu.py under 2.18.5: response.menu = [ (T('Lectures'), False, URL('default', 'subjects')), (T('Students'), False, URL('default', 'student')), (T('Professors'), False, URL('default', 'professor')), (T('Blog'), False, URL('default', 'blog')), (T('News'), False, URL('default', 'news')) ] if auth.is_logged_in(): response.menu.insert(1, (T('JumpTo:'), False, None, [])) response.menu[1][3].append((T('Classes'), False, None)) response.menu[1][3].append(LI(_class="dropdown-divider")) response.menu[1][3].append((T('Question Pool'), False, None)) web2py is fine until I add the "response.menu[1][3].append(LI(_class="dropdown-divider"))" line in which case the exception is: "IndexError: list index out of range". I can not for the life of me figure out why all the other appends, the appends of the tuples work but the append with the LI bugs like hell. thanx in advance, Lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: 2.18.5 LI(_class="dropdown-divider") bug?
what? I'm using the class attribute, which doesn't have a dash in it. all I'm trying to do is put a separator in the pulled down submenu. On Wednesday, April 10, 2019 at 12:33:34 PM UTC-4, villas wrote: > > See this section of book... > > > http://www.web2py.com/books/default/chapter/29/05/the-views?search=data-#HTML-helpers > > DIV('text', _data-role='collapsible') >> >> will not work because "_data-role" includes a hyphen, which will produce >> a Python syntax error. >> > > Check the solutions suggested. > > > > > On Wednesday, 10 April 2019 03:23:47 UTC+1, lucas wrote: >> >> hey all, >> >> I have the following code under menu.py under 2.18.5: >> >> response.menu = [ >> (T('Lectures'), False, URL('default', 'subjects')), >> (T('Students'), False, URL('default', 'student')), >> (T('Professors'), False, URL('default', 'professor')), >> (T('Blog'), False, URL('default', 'blog')), >> (T('News'), False, URL('default', 'news')) >> ] >> >> if auth.is_logged_in(): >> response.menu.insert(1, (T('JumpTo:'), False, None, [])) >> response.menu[1][3].append((T('Classes'), False, None)) >> response.menu[1][3].append(LI(_class="dropdown-divider")) >> response.menu[1][3].append((T('Question Pool'), False, None)) >> >> web2py is fine until I add the >> "response.menu[1][3].append(LI(_class="dropdown-divider"))" line in which >> case the exception is: "IndexError: list index out of range". I can not >> for the life of me figure out why all the other appends, the appends of the >> tuples work but the append with the LI bugs like hell. >> >> thanx in advance, Lucas >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: 2.18.5 LI(_class="dropdown-divider") bug?
oh yes I agree with you. I think you're referring to the 3 in "response.menu[1][3].append". the list to append to the submenu is the 4th element, so the 3 is correct. On Wednesday, April 10, 2019 at 3:41:08 PM UTC-4, Anthony wrote: > > Indexing is zero-based in Python, so the index of the third element is 2, > not 3. > > Anthony > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: 2.18.5 LI(_class="dropdown-divider") bug?
attached and thank you. and for the record, I've tried everything I can think of the for the past few days. and if it turns out I'm just a dumb butt, then I'm going to be really pissed at myself. lol. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. 50.234.208.211.2019-04-11.07-40-01.f2fcdc5e-c63f-4f08-afbe-dde95110dcfd Description: Binary data
[web2py] Re: 2.18.5 LI(_class="dropdown-divider") bug?
web2py™ Version 2.18.5-stable+timestamp.2019.04.08.04.22.03 Python Python 2.7.5: /usr/bin/uwsgi (prefix: /usr)Traceback 1. 2. 3. 4. 5. 6. 7. 8. Traceback (most recent call last): File "/opt/web2py_apps/web2py_2-18-5/gluon/restricted.py", line 219, in restricted exec(ccode, environment) File "/opt/web2py_apps/web2py_2-18-5/applications/instruct/views/default/index.html", line 62, in File "/opt/web2py_apps/web2py_2-18-5/gluon/html.py", line 807, in __getitem__ return self.components[i] IndexError: list index out of range -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: 2.18.5 LI(_class="dropdown-divider") bug?
alright, so just to be absolutely sure. i copied the layout.html and the default/index.html files from the 2.18.5 welcome app and stuck them in the proper places in my app. i still get the same error. i do NOT get the error if i comment out the separator line, as commented below. here is all of my code in the menu.py file as it stands now with layout.html and index.html being the unmodified default: # -*- coding: utf-8 -*- response.title = "IQa weInstruct:::uLearn" response.menu = [ [T('Lectures'), False, URL('default', 'subjects')], [T('Students'), False, URL('main', 'students'), []], [T('Professors'), False, URL('main', 'professors'), []], [T('Blog'), False, URL('default', 'blog')], [T('News'), False, URL('default', 'news')] ] if auth.is_logged_in(): response.menu[1][0] = T('Student:') response.menu[1][3].append((T('Dashboard'), False, URL('main', 'students'))) #response.menu[1][3].append(A('', _class="divider")) response.menu[1][3].append((T('Assessments'), False, None)) response.menu[1][3].append((T('History'), False, None)) response.menu[1][3].append((T('Join a Class'), False, None)) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: 2.18.5 LI(_class="dropdown-divider") bug?
ok, i tried it without the appends, instead just direct: response.menu[1][3] = [ (T('Dashboard'), False, URL('main', 'students')), A('', _class="divider"), (T('Assessments'), False, None), (T('History'), False, None), (T('Join a Class'), False, None) ] and it still bugs unless the A tag is commented out, then it is fine again. and i agree with you that its expecting a particular structure, but i've used the separator inserts in the past and they've worked fine and i thought the code allowed for the separators in the present form also. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Re: 2.18.5 LI(_class="dropdown-divider") bug?
alright, I fixed it. apparently in old versions of layout.html the =MENU() is used to create the html menu from response.menu. that code has been updated at some web2py version and changed to: {{for _item in response.menu or []:}} {{if len(_item)<4 or not _item[3]:}} {{=_item[0]}} {{else:}} {{=_item[0]}} {{for _subitem in _item[3]:}} {{=_subitem[0 ]}} {{pass}} {{pass}} {{pass}} thanx to Anthony, I rewrote the above code to allow for the insertion divider/separator in the response.menu to: {{for _item in response.menu or []:}} {{if len(_item)<4 or not _item[3]:}} {{=_item[0]}} {{else:}} {{=_item[0]}} {{for _subitem in _item[3]: if (len(_subitem) > 2): =A(_subitem[0], _href=_subitem[2], _class= "dropdown-item") else: =_subitem pass pass}} {{pass}} {{pass}} in which case, the response.menu now looks like: response.menu = [ [T('Lectures'), False, None, []], [T('Students'), False, URL('main', 'students'), []], [T('Professors'), False, URL('main', 'professors'), []], [T('Blog'), False, URL('default', 'blog')], [T('News'), False, URL('default', 'news')] ] if auth.is_logged_in(): response.menu[1][0] = T('Student') response.menu[1][3] = [ (T('Dashboard'), False, URL('main', 'students')), DIV(_class="dropdown-divider"), (T('Assessments'), False, None), (T('History'), False, None), (T('Join a Class'), False, None) ] where the DIV is added with the class to style it nicely, in which in my css file I added: div.dropdown-menu div.dropdown-divider { width: 100%; height: 4px; margin: 3px 0px; background-color: #f0c36d; } and it works perfectly and looks beautifully. thanx to mweissen his suggestion, it worked pretty well also. qed, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: auth_user change field order
ok, i finally found what was wrong. i didn't realize there were two such settings. i was using the profile_fields and testing it on the register screen. so, i have this now under the db.py model: auth.settings.register_fields = ['prefix_title', 'first_name', 'last_name', 'gender', 'birthdate', 'zip', 'email', 'password'] auth.settings.profile_fields = ['prefix_title', 'first_name', 'last_name', 'gender', 'birthdate', 'zip', 'email'] -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] session id under db.py
hey everyone, running 2.18.5. ok under the db.py i have something like: db.define_table('courses', Field('subject_id', db.subjects, requires=IS_IN_DB(db, db.subjects.id, '%(subject)s (%(id)s)'), writable=False, readable=False), Field('user_id', db.auth_user, requires=PROFESSOR, default=(auth.user.id if auth.is_logged_in() else None), writable=False, readable=False), etc... COURSE = IS_IN_DB(db(db.courses.user_id==auth.user_id), db.courses.id, '%(title)s (%(id)s)') db.define_table('lectures', Field('course_id', db.courses, requires=COURSE, writable=False, readable =False), etc... db.define_table('questions', Field('course_id', db.courses, requires=COURSE, writable=False, readable =False), Field('lecture_id', db.lectures, requires=IS_EMPTY_OR(IS_IN_DB(db(db. lectures.course_id==session.course_id), db.lectures.id, '%(title)s (%(course_id)s, %(id)s)'))), etc and under the controller.py, i'll have: def questions(): cidi = mcp.request_to_int(request.args(0), None) #class id qidi = mcp.request_to_int(request.args(1), None) #question id if (cidi is not None): session.course_id = cidi #for subsetting lecture_id in db. qfrm = SQLFORM(db.questions, record=qidi, showid=False) etc... where the select options of lecture_id is always lagging by one, meaning, if cidi is 4 now, lecture_id items are showing for 2, where the 2 was my previous cidi. if i replace the latter line "session.course_id..." with: db.questions.lecture_id.requires = IS_EMPTY_OR(IS_IN_DB(db(db. lectures.course_id==cidi), db.lectures.id, '%(title)s (%(course_id)s, %(id)s)')) then all is good again. i don't remember a lag like this in previous versions. but i could be mistaken. and i'm not sure what to think about this right now. just reporting. thank you in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] FORM other then process & errors
hey one and all, ok, I have standard code under my controller like: gfrm = FORM(db.table1, recode=id) if gfrm.process(onvalidate=chk_ok).accepted: #lots of stuff session.flash = 'Successfully Generated Tests' redirect(URL('tests')) elif gfrm.errors: response.flash = 'Generated Tests Errors' else: response.flash = 'ok' I believe I learned that there are only the process-accepted and errors sections. but I have a condition where its going under the else section where ok is. what are the causes of a FORM going into that area? thank you in advance, Lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/ee4176ef-6b24-4579-9feb-2b45a6f0b9a0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] block entire app
hey one and all, where, in what model or controller, is the best place to place a few lines of code that captures every controller/function call in the entire app and returns a single page with a line of text and link to shuttle the viewers to another website. and what would be those few lines of code also. basically, how to gracefully shutdown an entire app? thank you in advance, lucas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/41a8b725-77fc-45bf-8d91-356745b1e41e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.