[web2py] Re: Form field manipulation questions
On Monday, January 9, 2017 at 11:47:05 PM UTC-8, Dave S wrote: > > Now I'm trying to use > jQuery("fieldx").blur(function {jQuery("fieldy").focus()}); > to control which field in the form the user goes to after completing > fieldx. This works great unless I try to set a blur function on fieldy; it > thinks fieldy is blurring as soon as I set focus on it. Annoying, to say > the least. (Testing in Chrome, so far) > > Suggestions? > > I seem to have solved this by, in the fieldy copy of this, replacing blur() with focusout(). I've only changed the one field so far, but I will probably do the other(s) as well. /dps -- 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: Password Recovery Not Sending (lazyT object being passed to GAE?)
Thanks, this helped, i am now using my own function to send the password reset email. On Friday, March 31, 2017 at 2:51:03 PM UTC+2, Jacinto Parga wrote: > > Yes, still unresolved. > > I did a workaround for the request_reset_password: > > def user(): > if request.args(0)=='request_reset_password': > redirect(URL('default','myrequestpass')) > return dict(form=auth()) > > def myrequestpass(): > form = SQLFORM.factory( > Field('u_email', requires =[IS_EMAIL(error_message='Wrong email'), > IS_IN_DB(db, 'auth_user.email', error_message='Address not in DB')]), > table_name='solicitar_pass') > if form.process().accepted: > user = db(db.auth_user.email==form.vars.u_email).select().first() > session.flash = 'Comprueba tu correo '+str(user.first_name) > u_passwd = str(hex(int(time.time([2:] > user.update_record(password=CRYPT()(u_passwd.encode('utf8'))[0]) > mensaje=' Retrieve your password Temporal password > : '+ u_passwd +' Login with the temporal password > and set your new password in this link :https://yoursite.com/user/login?_next=/user/change_password";>Change > Password'' > mail.send(to=[form.vars.u_email], > subject='Change your password, follow this link', > message=mensaje) > redirect(URL('default','index')) > elif form.errors: > response.flash = 'Wrong Email address' > return dict(form=form) > > > But anyway the lazyT found is an annoying error width, for instance: auth. > settings.auth_two_factor_enabled = True > > > El jueves, 30 de marzo de 2017, 8:13:06 (UTC+2), Karoly Kantor escribió: >> >> As the issue is still unresolved, i have unchecked the "no action needed" >> flag on this topic. Any help would be appreciated. Thank you. >> >> On Thursday, March 30, 2017 at 6:33:07 AM UTC+2, Karoly Kantor wrote: >>> >>> This issue still seems to be unsolved. I have a fresh installation on >>> GAE, reset password emails fail due to "need string or buffer, lazyT >>> found" >>> >>> Is there something I can do? >>> >>> Thanks. >>> >>> On Friday, July 29, 2016 at 7:49:14 AM UTC+2, webm...@trytha.com wrote: I just uploaded an updated version of web2py to my server, replacing a much older version (likely 2.12.2), and now it won't send password recovery emails. The error in the logs is: Mail.send failure:coercing to Unicode: need string or buffer, lazyT found This suggests to me that somehow a string is not properly being passed. I gather that lazyT has something to do with the built-in translation capabilities of web2py? Probably don't need to be translating email addresses (though I guess it could be trying to translate the recovery message). Either way, GAE wants nothing to do with it. How can I fix this? >>> -- 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: Questions about production environment / large applications
Thanks for the great reply Jim... On Wed, Apr 5, 2017 at 4:31 PM, Jim S wrote: > Here is a quick list of reasons why we host > > 1. Data sync - we sync data to/from a number other platforms that we host > here as well, HR/Payroll (MS SQL), Accounting/Inventory (AS/400), Product > Development (Pervasive). Would be slower if we were syncing to the cloud > and we get killed on bandwidth charges. > 2. Availability - we are in a relatively (not terribly) remote area. We > have fiber to our building but we did lose it for about 1/2 a day twice in > the past year. Our local users take priority over remote so we are willing > to live with this. > 3. Private Control - as you mentioned, we do like to retain control over > our data. We have backups and replicate to a couple of our remote sites. > 4. Cost uncertainty - last time I looked at moving to a cloud > infrastructure it was hard to pin down exact costs. My concerns were with > our synchronization programs and what kind of bandwidth we'd be charged > for. But, it has been a while since I've researched any of those options > and of course things could have changed. > > So many new container technologies out there that we could benefit from > but we haven't made the jump yet. Walking that thin like between sticking > with a stable environment and newer bleeding edge technologies. > > -Jim > > > >> @Jim >> >> Do you do this more for private control of your app(s) and data or for >> efficiency? >> What were your considerations to go this route instead of cloud >> infrastructure like AWS/Pytnonanywhere/Heroku/etc ? >> >> On Tuesday, April 4, 2017 at 8:38:31 AM UTC-5, Jim S wrote: >>> >>> The advantages would be more processing power and separation of duties. >>> In our environment, we have: >>> >>> * database server (MySQL) >>> * Load balancer (haproxy) >>> * Multiple webservers running nginx/uwsgi/web2py >>> * Redis server for caching >>> >>> By separating the database server from the webserver we can then scale >>> up for more web traffic by adding more webservers. The load balancer >>> server just handles routing traffic to the least used webserver. All >>> servers run on Ubuntu on different VMs under VMWare ESXi. >>> >>> This is a mildly complicated environment and definitely not necessary >>> for all installations. If you're newer to deploying web applications then >>> keeping everything on one piece of hardware may make more sense. >>> >>> When you say you have a large multiuser application, how many users do >>> you typically have? Any idea how many transactions per second? >>> >>> -Jim >>> >>> >>> >>> On Tuesday, April 4, 2017 at 8:30:09 AM UTC-5, Áureo Dias Neto wrote: Are the advantages of using mysql on another server? Or does this solution vary from my hardware? 2017-04-04 10:22 GMT-03:00 Jim S : > Take a look here http://web2py.com/books/d > efault/chapter/29/06/the-database-abstraction-layer#Connecti > on-strings--the-uri-parameter- > > Then, for MySQL, change the localhost in the connectstring to the name > of your database server. You also have to make sure that MySQL is set to > allow remote connections from the user you are connecting with. Check out > this link on how to do that: > > http://stackoverflow.com/questions/23733734/how-to-enable- > remote-access-of-mysql-in-centos > > -Jim > > > On Tuesday, April 4, 2017 at 8:07:55 AM UTC-5, Áureo Dias Neto wrote: >> >> How to migrate data from sqlite to mysql or postgre? >> I tried to migrate the data to mysql using the workbench, but it did >> not work .. >> >> And, how would this question the database on another server? How does >> the connection work? >> > -- > 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+un...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- > 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 a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/web2py/tpzYF1Rh0kY/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http:/
[web2py] "Show_if" and Field Validation
I appreciate the new "show_if" attribute for Fields but I wonder if its action could be enhanced by one change... When I have a form with optional fields, I would like to set a validator on the field's value should it be supplied. I can always set it to IS_EMPTY_OR(blah) but this isn't strictly correct for my validation. I want to REQUIRE this validation if the field is displayed, but I want the validation IGNORED if the field is not displayed. In fact, the validation should always be ignored if the field is empty, since the user will never even see the error if it should fail validation! This might be as simple as emptying out the "requires" attribute if the "show_if" causes the field to be visible. But I don't change core code -- I don't want the hassle of departing from the stock distro of web2py. Other ideas? -- Joe -- 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] web2py behind IIS - 404 File or Directory Not Found.
Have been struggling with web2py behind IIS installation on AWS for a couple of days now and getting nowhere. The best I am able to produce is a 404 error message. I've tried two completely clean installations from scratch, followed the web2py book documentation to the letter, and still no go. Any ideas what I should be checking? -- 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] use memcache
Tried to learn about memcache, create new web2py app from admin *Situation 1 :* *models/db.py * ## memcache put on top of models/db.py # cache from gluon.contrib.memcache import MemcacheClient *memcache_servers = ['127.0.0.1:11211']* *#memcache_servers = ['192.168.0.99:11211']* cache.memcache = MemcacheClient(request, memcache_servers) cache.ram = cache.disk = cache.memcache # session from gluon.contrib.memdb import MEMDB session.connect(request, response, db = MEMDB(cache.memcache) ) *Access :* https://server/a/appadmin/ccache *Error Traceback :* cache.ram.initialize() AttributeError: 'MemcacheClientObj' object has no attribute 'initialize' *Question 1 :* Is it normal or not about the traceback? *Question 2 :* Is it possible to use memcache on another machine? tried before but not cached on another server, perhaps i missed something if it possible, any hints? *Situation 2 :* *In terminal linux :* *# Display the current memory cache state* memcached-tool 127.0.0.1:11211 display *Result : * # Item_Size Max_age Pages Count Full? Evicted Evict_Time OOM 8 480B40s 1 1 yes000 *# Flush memcached* echo 'flush_all' | nc localhost 11211 *Question :* Why after i flushed memcache, the web2py cache is still stored in memcache? already tried to stop the web2py rocket server too, but same result, is it normal or not? *Situation 3 :* Modified already built web2py app to use memcache *Error Traceback :* format = lambda r: '%s - %s - %s' % (r.name, r.supplier.name, r.classification) ) AttributeError: 'long' object has no attribute 'name' *solution 1 : * clean from web2py admin page, relogin, access the error page, the error gone *solution 2 : * modified the code into format = lambda r: '%s - %s' % (r.supplier.name, r.classification) ) *Question :* why the same code is running well without using memcache? Thanks and Best Regards, stifan -- 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] TABLE and TBODY helpers add TR innapropriately
I am trying to build a table from a joined set of db tables and need to do quite a bit of processing to make the links and buttons in each row. Making the code readable is important to me so I do not want to put one giant long line of code to do everything and make it impossible for another person to make changes without breaking it for hours on end. I am not sure a one-liner is possible with all the looping anyway. So what I do is build up each row in a loop and concatenate the strings together. I then build the thead and tbody and stick it all in a table using the TABLE helper. The TABLE helper and the TBODY helper both see that I do not have the TR helper as inputs and so it adds the making my table incorrect. I also tried putting the THEAD and TBODY inside the TABLE helper directly, but the TBODY does the same thing and still screws it up. Is there any way to suppress the TR requirement, or fix it to see that my XML object passed contains the required instead of assuming that since I didn't use the helper it is needed? I dug around in the code a bit to see if I could find it and make a change, but alas I am just a hack and all I could find in the code was the TABLE class and not where any of the code actually does anything. If someone could point me to that code I would have a look at it. Is there some other way to workaround this still using the helpers that doesn't involve building the entire thing in one giant hodge podge of code that is impossible to read? Here is my python in the controller that builds the table HTML: #these three lines are static, but in my code the looping that builds them is pretty complex eventually with form elements, javascript, and links htmlrows="row 1 descrow 1 linka" htmlrows+="row 2 descrow 2 linkb" htmlrows+="row 3 descrow 2 linkc" htmltablehead=XML(THEAD(TR(TH('Column 1'),TH('links'),TH('column 3' htmltablebody=XML(TBODY(XML(htmlrows))) htmltable=XML(TABLE(XML(htmltablehead),XML(htmltablebody),_class="pure-table pure-table-bordered")) and then finally in the view I have this: {{=XML(htmltable)}} This is the output of the table and the orange and red are screwing up the rendering by the browser. Column 1 links column 3 row 1 descrow 1 linka row 2 descrow 2 linkb row 3 descrow 2 linkc -- 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: web2py behind IIS - 404 File or Directory Not Found.
I've now compared my installation against a known good installation. All the various parameters and installed routines are the same, but still getting the 404 message. Anybody have any thoughts about what it might be or what I should be looking at? On Thursday, April 6, 2017 at 3:12:51 PM UTC-6, weheh wrote: > > Have been struggling with web2py behind IIS installation on AWS for a > couple of days now and getting nowhere. The best I am able to produce is a > 404 error message. I've tried two completely clean installations from > scratch, followed the web2py book documentation to the letter, and still no > go. Any ideas what I should be checking? > -- 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: TABLE and TBODY helpers add TR innapropriately
Yeah sometimes it's not a good idea to mix XML made stuff with the other helpers, namely the TABLE helper tries to be convenient and put stuff that you give it to him inside TDs if they aren't yet. If you really have to use XML and TABLE use TAG to turn it into web2py helpers: htmlrows="row 1 descrow 1 linka" htmlrows+="row 2 descrow 2 linkb" htmlrows+="row 3 descrow 2 linkc" htmltablehead=THEAD(TR(TH('Column 1'),TH('links'),TH('column 3'))) htmltablebody=TBODY(TAG(XML(htmlrows))) htmltable=TABLE(htmltablehead, htmltablebody,_class="pure-table pure-table-bordered") {{=htmltable}} Also, notice that you don't need to be putting everything inside XML. Don't forget you can always just generate this whole thing in a string and simply call XML in the end. Finally, wouldn't all this HTML building be better off in a view and simply not using helpers? -- 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: TABLE and TBODY helpers add TR innapropriately
> > Here is my python in the controller that builds the table HTML: > > #these three lines are static, but in my code the looping that builds them > is pretty complex eventually with form elements, javascript, and links > htmlrows="row 1 descrow 1 > linka" > htmlrows+="row 2 descrow 2 > linkb" > htmlrows+="row 3 descrow 2 > linkc" > Why can't you instead do something like this: tablerows = [] for i in something: tablerows.append(TR(...)) tbody = TBODY(tablerows) > htmltablehead=XML(THEAD(TR(TH('Column 1'),TH('links'),TH('column 3' > htmltablebody=XML(TBODY(XML(htmlrows))) > htmltable=XML(TABLE(XML(htmltablehead),XML(htmltablebody),_class="pure-table > pure-table-bordered")) > Note, when you have actual HTML helper objects (e.g., your THEAD object), there is no need to wrap them in XML() before passing them to other helper objects. Also, if for some reason you feel you really need to build the rows as raw HTML markup, then there isn't really much point in using the TBODY and TABLE helpers anyway -- they're each just a single HTML tag, which you might as well just write in raw HTML yourself. 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: TABLE and TBODY helpers add TR innapropriately
> > htmltablebody=TBODY(TAG(XML(htmlrows))) > Probably you meant TAG(htmlrows) (i.e., without the XML()), but even that I do not think will work (TAG() will not return a list of TR objects but a parent TAG object). However, this should work: htmltablebody = TBODY(CAT(XML(htmlrows))) But as noted in my other response, there are better options. 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: web2py behind IIS - 404 File or Directory Not Found.
Now I'm wondering if the wfastcgi.py 3.0.0 that I downloaded is somehow not compatible with some of the python2.7 modules in the flow. On Thursday, April 6, 2017 at 7:48:44 PM UTC-6, weheh wrote: > > I've now compared my installation against a known good installation. All > the various parameters and installed routines are the same, but still > getting the 404 message. Anybody have any thoughts about what it might be > or what I should be looking at? > > On Thursday, April 6, 2017 at 3:12:51 PM UTC-6, weheh wrote: >> >> Have been struggling with web2py behind IIS installation on AWS for a >> couple of days now and getting nowhere. The best I am able to produce is a >> 404 error message. I've tried two completely clean installations from >> scratch, followed the web2py book documentation to the letter, and still no >> go. Any ideas what I should be checking? >> > -- 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.