[web2py] Re: GAE Datastore performance / potential index issue
Reread the GAE Query documentation. Your use case is not the use case that GAE is optimized for. Fetch fewer records per call. Example:'= web2pyChildTableClass = db.ChildTable # gives the web2py Table class theNativeGAEChildTableClass = web2pyChildTableClass._tableobj # magic... into native GAE handle <== This may have changed recently. Somehow get the native handle. nativeChildTableQuery = theNativeGAEChildTableClass.all() nativeChildTableQuery.filter('id =', 25) nativeresults = nativeChildTableQuery.fetch(limit=10) # Just get a few record at a time, using the 'limit' parameter. myGAENativeChild = nativeresults[0] On Monday, April 24, 2017 at 9:15:59 AM UTC-4, Karoly Kantor wrote: > > More info again, still hoping someone can help: > > I tried to replace the DAL query with native app engine code. > > Original DAL: > > query=( > (mydb[record].application == application_id) & > (mydb[record].entity == entity_id) & > (mydb[record].is_deleted == False)) > > result = mydb(query).select() > > Native: > > from google.appengine.ext import ndb > class record(ndb.Expando): > pass > result = > record.query().filter(ndb.GenericProperty('application') == application_id, > ndb.GenericProperty('entity') == entity.id, > ndb.GenericProperty('is_deleted') == False) > > I was hoping this will speed things up, but it did not. It was the same > slowness on the local dev env. On the server, the situation became even > worse: > > "While handling this request, the process that handled this request was > found to be using too much memory and was terminated. " > > Anyway, I still find it unreal that a query of 800 rows can last more than > 20 seconds. > > Ideas are continue to be most welcome. > > -- 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: switch to python 3
I propose a new framework: things2py (Massimo might guess what I am talking about - think hardware and the "T" in IoT). I have bit of code that could jump start it On Friday, November 4, 2016 at 10:34:55 PM UTC-4, saeed mehrabi wrote: > > Hello > When do you want to switch to python 3? > I am waiting impatiently. > best 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/d/optout.
[web2py] Re: Problem running GAE SDK with web2py 2.14.5
I found the fix here: https://code.google.com/p/googleappengine/issues/detail?id=12852 The key step is: You can add a appengine_config.py python file to the root directory of your application with the following contents: import sys sys.platform = 'linux3' On Friday, April 15, 2016 at 10:20:41 AM UTC-4, David Manns wrote: > > This is probably a stupid question. I'm running on Windows 10 with latest > version of Python 2.7.11 and the latest source code version of web2py. > Actually, I downloaded the source code version 2.14.3 and updated via the > admin console to 2.14.4 and then to 2.14.5. > > My application runs fine in the web2py development environment. When I try > to run using the GAE SDK launcher, I get the failure as logged below. Its > my understanding that the source distribution of web2py includes pyDAL and > this is presumably being used when running in the web2py test environment. > I also tried installing pyDAL using pip install pydal, this appeared to > work but made no difference. > > What am I missing? > > 2016-04-15 09:56:21 Running command: "['C:\\Python27\\python.exe', > 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', > '--skip_sdk_update_check=yes', '--port=24080', '--admin_port=8016', > 'C:\\Users\\David\\Google Drive\\My Documents\\Ocsnedb52']" > INFO 2016-04-15 09:56:24,586 devappserver2.py:769] Skipping SDK update > check. > INFO 2016-04-15 09:56:24,773 api_server.py:205] Starting API server > at: http://localhost:55164 > INFO 2016-04-15 09:56:24,779 dispatcher.py:197] Starting module > "default" running at: http://localhost:24080 > INFO 2016-04-15 09:56:24,780 admin_server.py:116] Starting admin > server at: http://localhost:8016 > ERROR2016-04-15 13:56:43,612 wsgi.py:263] > > Traceback (most recent call last): > > File "C:\Program Files > (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 240, > in Handle > > handler = _config_handle.add_wsgi_middleware(self._LoadHandler()) > > File "C:\Program Files > (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 299, > in _LoadHandler > > handler, path, err = LoadObject(self._handler) > > File "C:\Program Files > (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 85, > in LoadObject > > obj = __import__(path[0]) > > File "C:\Users\David\Google Drive\My Documents\Ocsnedb52\gaehandler.py", > line 47, in > > from gluon.settings import global_settings > > File "C:\Users\David\Google Drive\My > Documents\Ocsnedb52\gluon\__init__.py", line 29, in > > "You can also download a complete copy from http://www.web2py.com.; > > RuntimeError: web2py depends on pydal, which apparently you have not > installed. > > Probably you cloned the repository using git without '--recursive' > > To fix this, please run (from inside your web2py folder): > > > > git submodule update --init --recursive > > > > You can also download a complete copy from http://www.web2py.com. > > INFO 2016-04-15 09:56:43,621 module.py:787] default: "GET / HTTP/1.1" > 500 - > > -- 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: Google App Engine Launcher 1.9.34 breaks web2py?
I found the fix here (it is a true Google App Engine SDK issue): https://code.google.com/p/googleappengine/issues/detail?id=12852 The key step is this: You can add a appengine_config.py python file to the root directory of your application with the following contents: import sys sys.platform = 'linux3' On Thursday, March 31, 2016 at 9:10:32 AM UTC-4, Richard wrote: > > https://github.com/blog/2131-git-2-8-has-been-released > > I may be wrong, I think the improvement is in fetch... I thought it was > managing clone recursive... > > Richard > > On Thu, Mar 31, 2016 at 4:04 AM, Tommi Lahtonen> wrote: > >> >> >> On Tuesday, March 29, 2016 at 7:48:07 PM UTC+3, Richard wrote: >>> >>> Git 2.8 will solve that... >>> >>> >> what do you mean? >> >> I tried with git and it does not work any better than the full >> src-package. Same error. >> >> -- >> 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 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: Angularjs calls to web2py rest api
I got angular to call web2py controller methods passing data both ways by using the older web2py approach not using '@... restful' decorators. So in the $http.get I pass the full URL such as 'http://127.0.0.1:8000/ welcome/default/api/auth_user/1' On Tuesday, July 12, 2016 at 6:45:40 AM UTC-4, botass...@gmail.com wrote: > > Hello everyone. > > Can someone explain me how to get data from table using web2py rest api > and angularjs? > I have function api(): > > >1. @request.restful() >2. def api(): >3. response.view = 'generic.json' >4. def GET(*args,**vars): >5. patterns = 'auto' >6. parser = db.parse_as_rest(patterns,args,vars) >7. if parser.status == 200: >8. return dict(content=parser.response) >9. else: >10. raise HTTP(parser.status,parser.error) >11. def POST(table_name,**vars): >12. return db[table_name].validate_and_insert(**vars) >13. def PUT(table_name,record_id,**vars): >14. return db(db[table_name]._id==record_id).update(**vars) >15. def DELETE(table_name,record_id): >16. return db(db[table_name]._id==record_id).delete() >17. return dict(GET=GET, POST=POST, PUT=PUT, DELETE=DELETE) > > > i have defined table: > db.define_table('test', Field('something','text')) > > I understand that i should make angular controller and use $http.get(' > http://127.0.0.1:8000/myapp/default/api/test'), and then put it in > $scope.text = data > which will be called from my view by [[text.content]]. But all samples i > found and all tries i made failed or i just got an empty page. > > please give me an example how to communicate with web2py api by angularjs. > > > -- 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: UPDATED AGENDA! Bay Area web2py meetup (refreshments) -- 12/5/2014, 6:30PM - 9:00PM -- BE THERE!!!
Hi. I am not clear about the Location. 1125 jackson street albany ca 94706 does not seem to be anywhere near North Berkeley Station 1750 Sacramento Street / Berkeley, CA 94702 Please clarify the Meetup location and closest BART station. On Thursday, November 6, 2014 1:48:14 AM UTC-6, weheh wrote: *Massimo Di Pietro, web2py's originator, will attend our own Bay Area* *web2py meetup* to meet, greet and present. Additional talks by Dexter Hadley, of Stanford University and Richard Gordon, of YAKiToMe! will be given. Details follow: Date: *Friday, December 5* Time: *6:30PM to 9:00PM* Location: *1125 Jackson Street, Albany, CA (directly off the Buchanan freeway ramp)* Sponsor: *YAKiToMe.com* (a development-stage web2py-based TTS app) Cost: *Free* RSVP: *please RSVP by replying inline to this post* Parking: Plentiful free parking is readily available directly in front of the meeting room *Agenda: * - 6:30PM to 7:00PM Informal mixer with pizza - 7:00PM to 8:00PM Massimo Di Pierro, Assoc. Prof. High Performance and Scientific Computing, School of Computing, De Paul University, creator of web2py - 8:00PM to 8:30PM Dexter Hadley, Md/PhD, Stanford University Division of Systems Medicine Department of Pediatrics on using web2py to crowd source disease signatures from open functional genomics data - 8:30PM to 9:00PM Richard Gordon, MSEE Stanford University, YAKiToMe.com, on Extreme Off-roading With Web2py -- Lessons Learned Each talk will have some time for QA *Equipment Needs: *We still need a quality digital projector that can plug into a laptop. If you are coming and can lend a working projector for the night, please let me know as it would be much appreciated. Otherwise, I will rent one. If you are giving a presentation, please plan on bringing your own laptop. I will have a Windows laptop available just in case. *Spread The Word*. If you belong to the python user's group in San Francisco or elsewhere in the Bay Area or are a member of a Django, Drupal, Ruby or other web framework user's group, please help spread the word about this meetup. This posting will be the official organizing document for the meetup, so post your questions and comments here. Thanks, and hope to meet a bunch of web2py'ers on December 5! -- 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: UPDATED AGENDA! Bay Area web2py meetup (refreshments) -- 12/5/2014, 6:30PM - 9:00PM -- BE THERE!!!
I will attend. -Dave Lypka. On Thursday, November 6, 2014 1:48:14 AM UTC-6, weheh wrote: *Massimo Di Pietro, web2py's originator, will attend our own Bay Area* *web2py meetup* to meet, greet and present. Additional talks by Dexter Hadley, of Stanford University and Richard Gordon, of YAKiToMe! will be given. Details follow: Date: *Friday, December 5* Time: *6:30PM to 9:00PM* Location: *1125 Jackson Street, Albany, CA (directly off the Buchanan freeway ramp)* Sponsor: *YAKiToMe.com* (a development-stage web2py-based TTS app) Cost: *Free* RSVP: *please RSVP by replying inline to this post* Parking: Plentiful free parking is readily available directly in front of the meeting room *Agenda: * - 6:30PM to 7:00PM Informal mixer with pizza - 7:00PM to 8:00PM Massimo Di Pierro, Assoc. Prof. High Performance and Scientific Computing, School of Computing, De Paul University, creator of web2py - 8:00PM to 8:30PM Dexter Hadley, Md/PhD, Stanford University Division of Systems Medicine Department of Pediatrics on using web2py to crowd source disease signatures from open functional genomics data - 8:30PM to 9:00PM Richard Gordon, MSEE Stanford University, YAKiToMe.com, on Extreme Off-roading With Web2py -- Lessons Learned Each talk will have some time for QA *Equipment Needs: *We still need a quality digital projector that can plug into a laptop. If you are coming and can lend a working projector for the night, please let me know as it would be much appreciated. Otherwise, I will rent one. If you are giving a presentation, please plan on bringing your own laptop. I will have a Windows laptop available just in case. *Spread The Word*. If you belong to the python user's group in San Francisco or elsewhere in the Bay Area or are a member of a Django, Drupal, Ruby or other web framework user's group, please help spread the word about this meetup. This posting will be the official organizing document for the meetup, so post your questions and comments here. Thanks, and hope to meet a bunch of web2py'ers on December 5! -- 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 and post data
I believe you can use the restful decorator to accept only a POST In the following example, 'mymethod' is not a real python method - it is just a logical concept for convenience. Use this URL: /myapp/mycontroller/api/mymethod fields will be a convenient dict of data converted from urlencoded name=value pairs that were sent in the POST. mycontroller.py --- @request.restful() def api(): # Input data format (from browser): headers: { 'Content-Type': 'application/x-www-form-urlencoded' } def POST(methodname, **fields): if not (methodname in ['mymethod']): raise HTTP(400) : # your business logic here... I trust I have explained this correctly... On Monday, November 24, 2014 12:56:51 PM UTC-6, محمد رشاد wrote: Hi all Thank you for this helpful group I'm new in web2py and python, I have an application that has a function called ws That function has an page called check which accepts user inputs by this token = request.vars.token, it works and accept the inputs that come using POST and GET http methods. What I want is to accept the POST methods only and refuse the GET ones, who to do that? Thank you -- 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 ajax call and Angularjs
var mypersistdict = {}; mypersistdict['myvar'] = 'myvalue'; var myurlencodeddata = $.param(mypersistdict); // ref: http://stackoverflow.com/questions/19254029/angularjs-http-post-does-not-send-data $http({ method: 'POST', url: ''http://myweb2pyuri', data: myurlencodeddata , headers: { 'Content-Type': 'application/x-www-form-urlencoded' } // GOTCHA: web2py methods NOT marked restful expect urlencoded vars, NOT JSON which Angular usually sends, so override with headers here... }). success(function (data1, status, headers, config) { // this callback will be called asynchronously // when the response is available debugger; }). error(function (data1, status, headers, config) { // called asynchronously if an error occurs // or server returns response with an error status. debugger; }); I have not tried marking my web2py method as restful yet. I am guessing that the restful method will then expect the JSON encoding and then the header override here will not be needed. On Tuesday, September 16, 2014 1:39:02 PM UTC-5, piero crisci wrote: I am testing angularjs with web2py. In my web2py i have some ajax call that store the html code into a dialog box. Now i would like to insert in html code from the callback some angularjs code. But because ajax call is not into angular module , the code is not running. The angular MVC work instead properly into main pages. Anyone is trying the same thing or got some hints for me?. I cannot find any examples of how use web2py ajax (or jquer ajax) with angularjs -- 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 meetup Bay Area
I will try to attend. But will it be during a week day? or possibly weekend? On Thursday, September 18, 2014 10:06:11 PM UTC-5, Dave S wrote: On Monday, September 15, 2014 11:39:04 PM UTC-7, ghufran syed wrote: I am new to web2py, but would be interested in attending, thank you for taking the initiative to set something up! I can vouch that it is worth meeting Massimo and getting his perspective in person. /dps On Thursday, September 11, 2014 9:24:53 AM UTC-7, weheh wrote: Thanks for the replies. I went to a meetup last night for the Bay Area python group (not the Bay Area Piggies group), which is one of the largest if not the largest python group in the North Bay. I also looked into setting up a more permanent meetup group for web2py. Here are my conclusions and reasonings about how to go forward with a web2py meetup. We should leverage the existing python group(s) (including Piggies) to spread knowledge of web2py. The python meetup is a large, established group with the necessary infrastructure to organize meetups. I think it will be hard (for me) to start a web2py group from scratch right now because it requires connections to big and interested internet companies with adequate facilities and a willingness to host the meetup. I spoke to the organizers of the python meetup regarding having a web2py session. They were open and receptive to the idea. Some of them remembered Massimo's talk a couple of years ago. One of the organizers volunteered to me that there was some negative sentiment surrounding web2py in the python community, but when I dug deeper, it seemed to be rumor and innuendo, nothing concrete. Seems like the usual controversy that has dogged web2py since day 1 for reasons that are beyond me. Therefore, Massimo, if you're out here in November, let's have you do a short tutorial on web2py (30 to 45 minutes). Then I, and hopefully someone else (Jonathan, Joe?), can give testimonial talks on what we like about web2py and give concrete examples/demos of how we use it for enterprise-grade solutions. I am prepared to put together some examples of cool things you can do with components, rpc calls, multiple forms on one page, etc. The testimonial talks should also be 30 to 45 minutes so that in total, there would be more talks by web2py users than Massimo. This will lend greater credibility to the information exchange and be more convincing that there is, indeed, a movement. I would also use the occasion to poll the gathering to see if there's enough interest to start our own web2py meetup group. The organizers said that if I wanted to drive such a meetup for the python group that they might also invite competing frameworks to give talks, like Django or Flask. That's possible, but I think if we have enough web2py-user speakers we can probably get the full 2 hours for web2py talks. That, in my opinion, would be preferable. Let me know what you think. Massimo, if you're here in November, there's enough time to organize something great for that time frame. -- 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: GAE NDB is there a problem with using belongs on an id field?
It looks like GAE has the 'Projection Query' feature to allow selecting a subset of columns / properties: https://developers.google.com/appengine/docs/python/datastore/projectionqueries On Friday, August 29, 2014 11:18:00 PM UTC-5, Massimo Di Pierro wrote: This should work, can you please open a ticket? Mind that it is pointless to select columns/fields on GAE since it always fetches them all. On Friday, 29 August 2014 18:37:07 UTC-5, Russ King wrote: I am struggling to use belongs on GAE+NDB it appears that: quests = db(db.question.level.belongs([1])).select(db.question.id,db.question.level) is valid however quests = db(db.question.id.belongs([1])).select(db.question.id, db.question.level) generates an error along the lines of type 'exceptions.AttributeError' type object 'question' has no attribute '__key__' is this because the key field is different from the other fields and is there some sort of workaround to retrieve a set of records from a list of keys or am I missing something Regards Russ -- 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 + AngularJS: routes
I did not put a folder name such as your projects/. I kept the html paths flat. I converted the Angular Store sample to web2py + Angular: This worked for me: var storeApp = angular.module('AngularStore', ['ngRoute', 'angularTreeview']). config(['$routeProvider', function($routeProvider) { $routeProvider. when('/store', { templateUrl: 'store.htm', controller: storeController }). when('/products/:productSku', { templateUrl: 'product.htm', controller: storeController }). when('/cart', { templateUrl: 'shoppingCart.htm', controller: storeController }). otherwise({ redirectTo: '/store' }); }]); No need to specify index.html anywhere in the routing. I had a controller angularStore.py and so all the htmls (including index.html) are in folder: views/angularStore On Friday, August 15, 2014 11:59:29 AM UTC-5, Najtsirk wrote: OK, but how do I configure AngularJS routes? For example: App.config(['$routeProvider', function ($routeProvider) { $routeProvider. when('/', { templateUrl: 'index.html', controller: 'IndexCtrl' }). when('/projects', { templateUrl: 'projects/index.html', controller: 'ProjektiCtrl' }) }]); How can I get routes to the partiapl templates right? Let's say that partial template for '/projects' is in views/projects/index.html directory. What is the right 'templateUrl' for this template? Best, Kristjan On Friday, 15 August 2014 02:58:51 UTC+2, dlypka wrote: in the Views folders as usual. But then I also had to make controller functions for each .html. For example: def jqplot(): # This method is necessary to allow views/home/jqplot.html to be rendered response.delimiters = ('{[',']}') return dict() On Thursday, August 14, 2014 3:41:19 PM UTC-5, Najtsirk wrote: Hello, i have problem with Web2py and AngularJS regarding routes. Where should be partial .html files of specific routes stored? In static folder? Best, Kristjan -- 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 + AngularJS: routes
I based my webapp on the web2py welcome app sample and I just use its login functionality. To get that to work with Angular, I copied layout.html to layout_angular.html and in layout_angular.html I changed all {{ }} to {[ ]} and I put that call response.delimiters = ('{[',']}') I showed you in the controller to change the web2py template delimiter to {[ ]}. In my opinion it is best to change the web2py delimiter, and leave angular as {{ }} because so many angular code snippets are being used and very little new web2py templates are needed in the angular version of web2py. Also in gluon/tools.py I tweaked the login code. I copied web2py_ajax.html to web2py_ajax_angular.html. I changed web2py_ajax_angular.html and index.html for all {{ }} to {[ ]} In layout_angular.html I made it use bootstrap 3. In index.html I changed it to use layout_angular.html and web2py_ajax_angular.html. After doing all that, then the regular web2py menu strip with the login drop down works. but =MENU messes up so remote the =MENU call from laytout_angular.html Instead, just below where =MENU was, put a standard Bootstrap 3 menu html fragment based on ul class=nav navbar-nav such as: ul class=nav navbar-nav li a href=/init/default/indexHome/a /li li a href=/init/about/about_usAbout US/a /li li a href=/init/about/helpHelp/a /li /ul In your style.css you can modify menu bar item colors by adding these css snippets; .navbar .nav li a { background-color: black; color:greenyellow; } /* set hover and focus */ .navbar .nav li a:focus, .navbar .nav li a:hover { background-color: gray; color: white; } /* set active item to darkgreen */ .navbar .nav .active a, .navbar .nav .active a:hover, .navbar .nav .active a:focus { background-color: lightgreen; color: black; } /* set font color and background of the project name (brand) */ .navbar .brand { background-color: orange; color: navy; } Good luck. On Saturday, August 16, 2014 9:29:32 AM UTC-5, Najtsirk wrote: Cool. How did you manage to get authentication working? Did you do it on a separate, non Angular url, like 'default/user'? Did you manage to get it with Angular? Best, Kristjan On Saturday, 16 August 2014 15:28:52 UTC+2, dlypka wrote: I did not put a folder name such as your projects/. I kept the html paths flat. I converted the Angular Store sample to web2py + Angular: This worked for me: var storeApp = angular.module('AngularStore', ['ngRoute', 'angularTreeview']). config(['$routeProvider', function($routeProvider) { $routeProvider. when('/store', { templateUrl: 'store.htm', controller: storeController }). when('/products/:productSku', { templateUrl: 'product.htm', controller: storeController }). when('/cart', { templateUrl: 'shoppingCart.htm', controller: storeController }). otherwise({ redirectTo: '/store' }); }]); No need to specify index.html anywhere in the routing. I had a controller angularStore.py and so all the htmls (including index.html) are in folder: views/angularStore On Friday, August 15, 2014 11:59:29 AM UTC-5, Najtsirk wrote: OK, but how do I configure AngularJS routes? For example: App.config(['$routeProvider', function ($routeProvider) { $routeProvider. when('/', { templateUrl: 'index.html', controller: 'IndexCtrl' }). when('/projects', { templateUrl: 'projects/index.html', controller: 'ProjektiCtrl' }) }]); How can I get routes to the partiapl templates right? Let's say that partial template for '/projects' is in views/projects/index.html directory. What is the right 'templateUrl' for this template? Best, Kristjan On Friday, 15 August 2014 02:58:51 UTC+2, dlypka wrote: in the Views folders as usual. But then I also had to make controller functions for each .html. For example: def jqplot(): # This method is necessary to allow views/home/jqplot.html to be rendered response.delimiters = ('{[',']}') return dict() On Thursday, August 14, 2014 3:41:19 PM UTC-5, Najtsirk wrote: Hello, i have problem with Web2py and AngularJS regarding routes. Where should be partial .html files of specific routes stored? In static folder? Best, Kristjan -- 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: Python upgrade
Maybe just try rebooting you machine. On Thursday, August 14, 2014 10:44:21 AM UTC-7, Richard wrote: Good evening, I did upgrade python from 2.7.4 to 2.7.8. on my development laptop and encounter a 'basic' issue. In a controller I call create_mgt_sys(form_add_entity.vars.id, com) Which is defined as: def create_mgt_sys(id_new_entity, com): .. Now web2py/python come with error : type 'exceptions.TypeError' create_mgt_sys() takes exactly 2 arguments (0 given) Does anybody has a clu on the cause of this? Richard D -- 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 + AngularJS: routes
in the Views folders as usual. But then I also had to make controller functions for each .html. For example: def jqplot(): # This method is necessary to allow views/home/jqplot.html to be rendered response.delimiters = ('{[',']}') return dict() On Thursday, August 14, 2014 3:41:19 PM UTC-5, Najtsirk wrote: Hello, i have problem with Web2py and AngularJS regarding routes. Where should be partial .html files of specific routes stored? In static folder? Best, Kristjan -- 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] Delete Query Not Working
you might need to db.commit() after the delete(). versioning might be doing a commit() for you. On Tuesday, July 15, 2014 9:05:09 AM UTC-5, samurai wrote: No, I hadn''t. But it worked on turning it on. Thanks But I don't get it. Record versioning just creates an archived db for the modifications done. So how this feature being disabled is restricting me from deleting a record ?? *Shubham Jain* 3rd Year, Software Engg Delhi Technological University(Formerly DCE). On Mon, Jul 14, 2014 at 5:14 PM, lyn2py lyn...@gmail.com javascript: wrote: Did you turn on versioning? Can you post a traceback? On Friday, July 11, 2014 3:21:14 PM UTC+8, samurai wrote: As both Manuele and Leonel said, I changed it to args(0). But no use. It was still not working. I actually changed a bit and now I am getting 'd' by get.vars. def pro_del(): d = request.get_vars.d db(db.products.product_id == d).delete() session.flash = Product Deleted redirect(URL('default','index')) #return locals() Now also everything is working fine except the delete query. Note: I am redirecting and appending the vars by using a javascript function on the view side. If it has to do something with this problem. -- 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/7_0Vvdx6Unw/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com javascript:. 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 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: Using DAL inside a thread
Perhaps the Scheduler can help. On Saturday, July 5, 2014 11:47:39 AM UTC-5, Wonton wrote: Hello! As I commented in other post ( https://groups.google.com/forum/#!topic/web2py/ZbEndj2H-fk) I have problems using APNSWrapper feedback service sending push notifications. While I wait for an answer I've thought a possible solution to my problem. This solution consists in: 1. I'm going to send push notifications to a series of device tokens. 2. For the current device token I mark it as wrong in the database. 3. I send the push notifications. 4.1. If the token is wrong the push notification is not sent and APNSWrapper fails and the loop of tokens is broken. 4.2. If the token is right the push notification is sent. 5. I mark that token as right in the database. This way I can check the database and remove all tokens marked with wrong. The problem is that I'm executing this loop not in the main thread and I'm having lots of problems: crashes, error for database connection closed, etc... This is my code: ifcPushnotifications.py (is a module) push_thread = threading.Thread(target=__sendPushToUsersInBackground, args =(users, db)) push_thread.start() def __sendPushToUsersInBackground(users, db): wrapper = APNSNotificationWrapper('mycert.pem', False) for user in users: _tokenRow = db(db.push_notifs_table.userId == user['id']) _tokenRow.update(status='wrong') __sendPushToUser(user) _tokenRow.update(status='right') If user's token is wrong __sendPushToUser fails and the loop leaves its execution, so in the database it should be 'wrong'. My problem is that all 3 lines related to database (2 updates and the query) fail randomly, sometimes crashes, sometimes returns an error of closed database and do nothing, etc... So, how could I use my database inside a thread so I can avoid this errors? Thank you very much and kind 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/d/optout.
[web2py] Can the Scheduler run in stand alone gluon outside of web2py?
If so, please outline what to put in the mainline code to start it up. Thanks. -- 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] Which pure python DB or BTree (like ZODB) is best to modify the Scheduler to use pure-python code?
I am interested to deploy the Scheduler in gluon in a non web app, separate from the web2py web scaffolding, in pure python environments which may not have any SQL database installed or accessible.SQLite needs a platform-dependent installer so is unsuitable. Does the DAL have any support for a pure python DB that can work with the Scheduler instead of a SQL database, With some Scheduler and/or DAL hacking, will ZODB do the trick? -- 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] any upcoming web2py get together?
I would like to visit the Chicago area and meet the web2py team (Massimo and co.). I have a very interesting (even inspiring) web2py story to tell. I will then bring other (major corporate) associates on a follow up trip. Is it possible? When, where? -- 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] FYI: DAL accepts a variety of connection strings based on the underlying driver
FYI. Although few if any examples are documented, it is possible to for example to connect to Microsoft SQLExpress this way connStr = ( r'Driver={SQL Server};' + r'Server=(local)\SQLEXPRESS;' + r'Database=MyDB;' + r'Trusted_Connection=Yes;' ) dalstring = 'mssql://' + connStr db = DAL(dalstring) So you can put 'mssql:' followed by any connection string which is acceptable to pyodbc. The web2py book only gives this connection string example: mssql://username:password@localhost/test Likely the same is also true for the other DAL connection types for whatever driver the type uses. NOTE: You have to download,and run the pyodbc Windows Installer from https://code.google.com/p/pyodbc/downloads/list -- 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: Apache import module failure
May you are missing __init__.py in one of your folders. It needs that special file to mark the folder as having modules allowed for import. On Wednesday, August 14, 2013 9:37:58 AM UTC-5, mr...@rethinkrobotics.com wrote: Hi, I have a pretty straight forward app (AppBuilder in the log below) with a custom module (RosBridgeClient in the log below) which resides under modules, and is used by the controllers. Everything works fine using the built in server. However, once I move over to apache , it fails to import my module: [Wed Aug 14 06:15:25 2013] [error] ERROR:web2py:Traceback (most recent call last): [Wed Aug 14 06:15:25 2013] [error] File /usr/share/web2py/gluon/restricted.py, line 212, in restricted [Wed Aug 14 06:15:25 2013] [error] exec ccode in environment [Wed Aug 14 06:15:25 2013] [error] File /usr/share/web2py/applications/AppBuilder/controllers/status.py, line 3, in module [Wed Aug 14 06:15:25 2013] [error] from applications.AppBuilder.modules.RosBridgeClient import * [Wed Aug 14 06:15:25 2013] [error] File /usr/share/web2py/gluon/custom_import.py, line 100, in custom_importer [Wed Aug 14 06:15:25 2013] [error] return NATIVE_IMPORTER(name, globals, locals, fromlist, level) [Wed Aug 14 06:15:25 2013] [error] ImportError: No module named applications.AppBuilder.modules.RosBridgeClient [Wed Aug 14 06:15:25 2013] [error] Now the wacky thing is I can fix the issue by running the built in server once on the same deployed source tree, and then apache works just fine. There was a similar issue reported here: https://groups.google.com/forum/#!topic/web2py/77fGO9CSVbo, but with no apparent resolution on how to fix it. Does anyone have any ideas on what the issue might be, and how I can resolve this without running the built in server first? Thanks, Matt -- --- 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: sharing my d3.js experiments with web2py community
Hi Margaret: OK I played with your samples. Great technology. I would like to see such effects overlayed onto an existing page. - Dave Lypka. On Saturday, August 10, 2013 7:47:00 PM UTC-5, greaneym wrote: Hi there, I am sharing my experiments with D3.js this week. It's Geek Week, according to Google and I tried some animations with svg and images. These are at htttps://github.com/greaneym/d3anim I tried adding them to the slices page but it didn't look like that worked. Also, please add a female avatar (generic) picture in the registration page (that would be nice). Margaret -- --- 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: deployment to google app engine did not include my static files
The app.yaml sample for python 2.7 on GAE has always been wrong. The regular expression accidentally omits all static files that are in subfolders below static. I had to revert that regular expression part back to the pre 2.7 app.yaml example. The all the static subfolders were back again in the deployment. On Tuesday, August 13, 2013 9:15:57 AM UTC-5, Massimo Di Pierro wrote: email it to me please or post a patch on github. On Monday, 12 August 2013 19:03:59 UTC-5, Luca wrote: Shall I post a working app.yaml (minus confidential details) that works with threadsafe=True? Let me know if this would help. Luca On Sunday, August 4, 2013 12:12:16 PM UTC-7, davedigerati wrote: as you can see from here: http://sportssquaresonline.appspot.com/ it did upload most of the static files, specifically 30, but the ones I added, both images and a css file, it did not. any idea why??? deployed both through the web2py admin feature and the GAE Launcher -- --- 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: Values in request.vars persist/doubled when form submitted after unexpected logout/session deletion
Use request.post_vars instead of request.vars. Other postings discuss this issue. On Tuesday, August 6, 2013 9:21:06 PM UTC-5, Lamps902 wrote: I have a controller function which is protected by a standard authentication decorator (@auth.requires_login()). The function presents a page containing some forms (which contain a bunch of INPUT( _type = 'hidden', ...) and one INPUT(_type = 'image', ...), which presents the submission button). If a session terminates in a non-standard way (cookies deleted in browser, logout is clicked and directed to a new tab, etc.), the page with the forms is still present on screen, and if one of the forms is clicked, the login prompt is presented. After the user logs in, the form is processed as usual. However, if the user clicks on the form again, the values submitted by the new form will be appended to the corresponding values already present in request.vars, making a two-item list for each var. That is, something like: request.vars.action = action1 request.vars.item = 24 will turn into request.vars.action = action1 action1 request.vars.item = 24 24 Why are the new values appending to the old, instead of overwriting them? What's the recommended way to deal with this situation? Thank you. -- --- 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: Quoting in export_to_csv_file() / import_from_csv_file()
I was able to import rows which have minimal quotes, using the default import settings. Here is a sample row which worked for me: Atlanta,4214,GANGV19175,GANGV1917,S2C1,437,RBS6601W,15-B Gainesville_3C,F3,NRCSGAJTCRBR12,Yes,Yes,Yes,Yes,No,Yes,Yes,Yes,CXP9018350/1_R10A/1,IP,Yes,Yes,Yes,Yes,Yes,FALSE,Yes,454,325,454,Yes,CXP9014711/7_R10CA24,Yes,2013-06-06 10:06:46 On Wednesday, July 10, 2013 4:40:59 PM UTC-5, Wes Hall wrote: After using import_from_csv_file(), additional quotes are showing up in the db. Should I be using some different quoting in export_to_csv_file() or is this an inherent problem with specifying filter_out in in the model, or am I completely off the mark? Exporting db = 2.4.6 Importing db = 2.5.1 Table definition db.define_table('evaluation', Field('form', type='text', label=T('Evaluation form')), Field('results', type='text', label=T('JSON results')), auth.signature, format='%(form)s', migrate=settings.migrate) db.evaluation.results.filter_in = lambda obj, dumps=dumps: dumps(obj) db.evaluation.results.filter_out = lambda txt, loads=loads: loads(txt) Export db.export_to_csv_file(open('test.csv', 'w')) (Excerpt from test.csv) 89,se2,{u'name': u'Good User', u'answers': {u'q1': u'5', u'comment1': uThis answer should've had an apostrophe.}, u'email': u'...@mail.comjavascript: '},auth fields Import db.import_from_csv_file(open('test.csv', 'r')) MySQL row.results from within current application on original and new db {name: Good User, answers: {q1: 5, comment1: This answer should've had an apostrophe.}, email: u...@mail.com javascript:} MySQL row.results from import on new db (note the new enclosing double quotes) {u'name': u'Good User', u'answers': {u'q1': u'5', u'comment1': u\This answer should've had an apostrophe.\}, u'email': u'...@mail.comjavascript: '} This all leads to the following error: evaluation.results['name']), TypeError: string indices must be integers -- --- 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: Can we disable creation of non-Auth sessions somehow?
Can you show how you configured routes.py for it? Thanks. On Monday, May 6, 2013 11:31:29 AM UTC-5, Andriy wrote: Ok, thanks. I`ve put robots.txt in /static and configured routes.py for it. -- --- 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: package import
Every folder all the way down within modules and its child folders needs to have a __init__.py file. You are probabaly missing one somewhere there, On Wednesday, March 20, 2013 5:35:36 AM UTC-5, Phillipp Schmidt wrote: Hi. Could you post the error traceback of the import error? Here is the traceback. My current workaround is to put the package in the web2py site-packages, but it would be great to include it in modules, so I can share the application without telling people to include tablib in their web2py site-packages. Traceback (most recent call last): File /home/philsch/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/philsch/web2py/applications/sblink/controllers/default.py http://127.0.0.1:8001/admin/default/edit/sblink/controllers/default.py, line 88, in module File /home/philsch/web2py/gluon/globals.py, line 193, in lambda self._caller = lambda f: f() File /home/philsch/web2py/applications/sblink/controllers/default.py http://127.0.0.1:8001/admin/default/edit/sblink/controllers/default.py, line 47, in render import applications.sblink.modules.tablib as tablib File /home/philsch/web2py/gluon/custom_import.py, line 96, in custom_importer return NATIVE_IMPORTER(name, globals, locals, fromlist, level) File applications/sblink/modules/tablib/__init__.py, line 3, in module from tablib.core import ( File /home/philsch/web2py/gluon/custom_import.py, line 83, in custom_importer return base_importer(pname, globals, locals, fromlist, level) File applications/sblink/modules/tablib/core.py, line 15, in module from tablib import formats File /home/philsch/web2py/gluon/custom_import.py, line 83, in custom_importer return base_importer(pname, globals, locals, fromlist, level) File applications/sblink/modules/tablib/formats/__init__.py, line 6, in module from . import _csv as csv File /home/philsch/web2py/gluon/custom_import.py, line 96, in custom_importer return NATIVE_IMPORTER(name, globals, locals, fromlist, level) File applications/sblink/modules/tablib/formats/_csv.py, line 6, in module from tablib.compat import is_py3, csv, StringIO File /home/philsch/web2py/gluon/custom_import.py, line 83, in custom_importer return base_importer(pname, globals, locals, fromlist, level) File applications/sblink/modules/tablib/compat.py, line 43, in module import tablib.packages.xlwt as xlwt File /home/philsch/web2py/gluon/custom_import.py, line 77, in custom_importer raise ImportError, 'Cannot import module %s' % str(e) ImportError: Cannot import module 'tablib' -- --- 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: simple customize layout
No I believe this is a major issue in web2py css structure. I believe web2py css should not be globally changing attributes of standard html tags. It causes these kinds of rendering problems when one tries to use some standard web components such as a calendar. For example, standard web2py.css interferes with tags used in the rainforest popup calendar. Perhaps all of the login widgets and so on in web2py should be changed to use specific classes to get their css attributes. To get the rainforest calendar to render properly, I made this experiment: In layout.html I had to do this response.files.append(URL('static','css/web2py_lean.css')) # standard web2py.css interferes with tags used in rainforest popup calendar #response.files.append(URL('static','css/bootstrap.min.css')) --- commented out where in web2py_lean.css I deleted all the global tag changes at the top of the file such as a {text-decoration:none; white-space:nowrap} a:hover {text-decoration:underline} a.button {text-decoration:none} h1,h2,h3,h4,h5,h6 {margin:0.5em 0 0.25em 0; display:block; font-family:Helvetica} h1 {font-size:4.00em} h2 {font-size:3.00em} h3 {font-size:2.00em} h4 {font-size:1.50em} h5 {font-size:1.25em} h6 {font-size:1.12em} th,label {font-weight:bold; white-space:nowrap;} td,th {text-align:left; padding:2px 5px 2px 5px} th {vertical-align:middle; border-right:1px solid white} td {vertical-align:top} form table tr td label {text-align:left} p,table,ol,ul {padding:0; margin: 0.75em 0} p {text-align:justify} ol, ul {list-style-position:outside; margin-left:2em} li {margin-bottom:0.5em} span,input,select,textarea,button,label,a {display:inline} img {border:0} blockquote,blockquote p,p blockquote { font-style:italic; margin:0.5em 30px 0.5em 30px; font-size:0.9em} i,em {font-style:italic} strong {font-weight:bold} small {font-size:0.8em} code {font-family:Courier} textarea {width:100%} video {width:400px} audio {width:200px} input[type=text],input[type=password], On Wednesday, March 20, 2013 8:23:56 AM UTC-5, Anthony wrote: You can just use your simple layout and then include whatever you need from web2py (e.g., web2py.css, etc.). You may need to edit the web2py CSS files (or copy the parts you need into your own CSS files) if you only need some of the styling (e.g., for the grid). Anthony On Wednesday, March 20, 2013 8:53:50 AM UTC-4, 黄祥 wrote: already included in head (copy from layout.html) : script src={{=URL('static','js/modernizr.custom.js')}}/script !-- include stylesheets -- {{ response.files.append(URL('static','css/web2py.css')) response.files.append(URL('static','css/bootstrap.min.css')) response.files.append(URL('static','css/bootstrap-responsive.min.css')) response.files.append(URL('static','css/web2py_bootstrap.css')) }} {{include 'web2py_ajax.html'}} it's seems it was my css that cause an error. i create my simple css layout through http://www.cssportal.com is there any way to easily create simple layout for web2py? thank you so much for your detail explaination, anthony -- --- 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: Scheduler: new plugin cs_plugin_monitor
Is there a way to stretch (resize) each column? I also suggest using jqgrid, from plugin_wiki I suppose. jqgrid also can do tree-style parent-child expandable subrows which would be very nice to have. A row with a tree style plus sign would indicate the task finished (a child task_run row is available). I rolled my own status view recently using SolidTable, but I plan to change to jqgrid. I'll post something when I can. On Sunday, February 24, 2013 7:28:11 AM UTC-6, Niphlod wrote: spoilers here https://www.dropbox.com/sh/gynhv3yvhnrw5is/YvtgRkIrlL On Saturday, February 23, 2013 10:17:22 PM UTC+1, Niphlod wrote: Not until beta at least... Graphs need a better look :-P -- --- 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: Not to open a can of worms ... about web2py.com
The web2py site has its own distinctive look which is very clever. Occasional tweaks are good, but let it follow its current course. Not so sure what that new banner background image (vertical lines) is about though... On Friday, March 15, 2013 4:10:04 PM UTC-5, stefaan wrote: Should it be done? No. -- --- 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: Status of workflow functionality
Workflow typically stores its state in very complex sql tables. If something goes wrong the tables are easily corrupted and then it is very hard to fix. (brittle) Also if the table design evolves, it is hard to migrate. This is my experience with Microsoft Workflow for Windows. I believe an entity database will help when it becomes more feasible. On Tuesday, March 12, 2013 5:15:58 AM UTC-5, Ramos wrote: If i knew howto and have time i would create a workflow as a service. This way i centralize all my rules for every app in a single app. If i have 40 apps in my company it would be easy to manage all rules from all apps. Is this a good way to go? 2013/3/12 Cliff Kachinske cjk...@gmail.com javascript: Workflow is not a winning proposition. If you're working with a small business they can't afford the t time it takes to do a decent job. If it's a large company they can afford a big time solution with all the bells and whistles. It's too ready to get tied up in the rocket science that the full time workflow specialists have created. -- --- 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 javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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] How to TERMINATE a RUNNING Scheduler Task?
I need a way to terminate a specific Scheduled Task while it is RUNNING. I tried using Admin Database Admin to update the scheduler_task.stop_time to a time close to now while it was running. But the task continued for several more minutes and COMPLETED its normal 5 minute run. The task calls time.sleep(300) to make it run for 5 minutes. I guess the Scheduler is not looking at the db values every 3 seconds. Is it just checking the in memory task object properties? Is there a way to update the in memory object properties of a task while it is running? Thanks. -- --- 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: How to TERMINATE a RUNNING Scheduler Task?
Thanks for the quick reply. I suppose a workaround is to have a separate worker for each task. The I can TERMINATE the worker. A suggestion: can you suggest some standard python scaffolding to include in each task function to make it listen for a kill signal / message? On Monday, March 11, 2013 3:05:21 PM UTC-5, Niphlod wrote: once the task is inserted you should not change it's values unless its in the QUEUED status (technically the ASSIGNED works too, but it's NOT recommended). there's no way for the scheduler to terminate a specific task once the task is started, unless you KILL the worker (setting the worker to TERMINATE will kill the worker as soon as the RUNNING task is finished). PS: if you need to execute a task n times, use the repeat argument. using time.sleep(something) in a task has the side-effect of NOT returning to the main loop to execute potentially new QUEUED tasks (every scheduler process is allowed to process a single task at a time). if you need to limit the time the task runs, use the timeout parameter. If something is not clear please ask. On Monday, March 11, 2013 8:04:52 PM UTC+1, dlypka wrote: I need a way to terminate a specific Scheduled Task while it is RUNNING. I tried using Admin Database Admin to update the scheduler_task.stop_time to a time close to now while it was running. But the task continued for several more minutes and COMPLETED its normal 5 minute run. The task calls time.sleep(300) to make it run for 5 minutes. I guess the Scheduler is not looking at the db values every 3 seconds. Is it just checking the in memory task object properties? Is there a way to update the in memory object properties of a task while it is running? Thanks. -- --- 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: How to TERMINATE a RUNNING Scheduler Task?
timeout does not handle the case where it is discovered that the task needs to be stopped ASAP due to a business condition. For example the remote server may have limited connections available so if a task runs into trouble, the process needs to be killed ASAP to release the precious remote connection. That is the case in my application. Even with a while loop, there will have to be a way get the win32 process id of the python task for a given worker so the right one can be killed. Looks like a better solution is for the task to have its own manager thread that can listen for kill requests. i.e. the scheduler tasks need to be written using a standard piece of scaffolding code to provide fine-grained task management. On Monday, March 11, 2013 3:27:35 PM UTC-5, Niphlod wrote: having a single worker for each task can be daunting (well, you could wrap web2py.py -K appname in a never-ending loop so it's restarted as soon as it gets killed) #!/bin/sh while true do web2py/web2py.py -K yourapp echo 'killed, restarting in a bit' sleep 2 done but I'm curious about your use-case. Why do you need to terminate a RUNNING task (that can't be accomplished using the timeout parameter)? On Monday, March 11, 2013 9:18:48 PM UTC+1, dlypka wrote: Thanks for the quick reply. I suppose a workaround is to have a separate worker for each task. The I can TERMINATE the worker. A suggestion: can you suggest some standard python scaffolding to include in each task function to make it listen for a kill signal / message? On Monday, March 11, 2013 3:05:21 PM UTC-5, Niphlod wrote: once the task is inserted you should not change it's values unless its in the QUEUED status (technically the ASSIGNED works too, but it's NOT recommended). there's no way for the scheduler to terminate a specific task once the task is started, unless you KILL the worker (setting the worker to TERMINATE will kill the worker as soon as the RUNNING task is finished). PS: if you need to execute a task n times, use the repeat argument. using time.sleep(something) in a task has the side-effect of NOT returning to the main loop to execute potentially new QUEUED tasks (every scheduler process is allowed to process a single task at a time). if you need to limit the time the task runs, use the timeout parameter. If something is not clear please ask. On Monday, March 11, 2013 8:04:52 PM UTC+1, dlypka wrote: I need a way to terminate a specific Scheduled Task while it is RUNNING. I tried using Admin Database Admin to update the scheduler_task.stop_time to a time close to now while it was running. But the task continued for several more minutes and COMPLETED its normal 5 minute run. The task calls time.sleep(300) to make it run for 5 minutes. I guess the Scheduler is not looking at the db values every 3 seconds. Is it just checking the in memory task object properties? Is there a way to update the in memory object properties of a task while it is running? Thanks. -- --- 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: How to TERMINATE a RUNNING Scheduler Task?
Well the functions to terminate will still have be manually initiated by an operator clicking a button. And no workflow type of suspending / resuming a long running task is needed. And no workflow designer and no workflow Activity classes such as State Activities needed. Managers just need to know the tasks can be terminated anytime. Meanwhile I am installing my Scheduler app on the corporate server tonight and the Manager will be pleased will what it does so far. Thanks. On Monday, March 11, 2013 4:58:38 PM UTC-5, Niphlod wrote: ok, seems more a goal of a workflow engine than a task queue, but I'll see what can be done. On Monday, March 11, 2013 10:54:10 PM UTC+1, dlypka wrote: a supervsior may decide to kill a task started by one of his team members. On Mon, Mar 11, 2013 at 4:50 PM, Niphlod nip...@gmail.com wrote: business condition like it seems a poor design to have a task, than watch it and if it hangs for some reason kill it abruptly not based on task started a while ago PS: are you on windows ? signal management on win poses a lot of limitations. On Monday, March 11, 2013 10:27:17 PM UTC+1, dlypka wrote: timeout does not handle the case where it is discovered that the task needs to be stopped ASAP due to a business condition. For example the remote server may have limited connections available so if a task runs into trouble, the process needs to be killed ASAP to release the precious remote connection. That is the case in my application. Even with a while loop, there will have to be a way get the win32 process id of the python task for a given worker so the right one can be killed. Looks like a better solution is for the task to have its own manager thread that can listen for kill requests. i.e. the scheduler tasks need to be written using a standard piece of scaffolding code to provide fine-grained task management. On Monday, March 11, 2013 3:27:35 PM UTC-5, Niphlod wrote: having a single worker for each task can be daunting (well, you could wrap web2py.py -K appname in a never-ending loop so it's restarted as soon as it gets killed) #!/bin/sh while true do web2py/web2py.py -K yourapp echo 'killed, restarting in a bit' sleep 2 done but I'm curious about your use-case. Why do you need to terminate a RUNNING task (that can't be accomplished using the timeout parameter)? On Monday, March 11, 2013 9:18:48 PM UTC+1, dlypka wrote: Thanks for the quick reply. I suppose a workaround is to have a separate worker for each task. The I can TERMINATE the worker. A suggestion: can you suggest some standard python scaffolding to include in each task function to make it listen for a kill signal / message? On Monday, March 11, 2013 3:05:21 PM UTC-5, Niphlod wrote: once the task is inserted you should not change it's values unless its in the QUEUED status (technically the ASSIGNED works too, but it's NOT recommended). there's no way for the scheduler to terminate a specific task once the task is started, unless you KILL the worker (setting the worker to TERMINATE will kill the worker as soon as the RUNNING task is finished). PS: if you need to execute a task n times, use the repeat argument. using time.sleep(something) in a task has the side-effect of NOT returning to the main loop to execute potentially new QUEUED tasks (every scheduler process is allowed to process a single task at a time). if you need to limit the time the task runs, use the timeout parameter. If something is not clear please ask. On Monday, March 11, 2013 8:04:52 PM UTC+1, dlypka wrote: I need a way to terminate a specific Scheduled Task while it is RUNNING. I tried using Admin Database Admin to update the scheduler_task.stop_time to a time close to now while it was running. But the task continued for several more minutes and COMPLETED its normal 5 minute run. The task calls time.sleep(300) to make it run for 5 minutes. I guess the Scheduler is not looking at the db values every 3 seconds. Is it just checking the in memory task object properties? Is there a way to update the in memory object properties of a task while it is running? Thanks. -- --- 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/7-ZOS_In8IU/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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: [newbee] - JqGrid - To get back the valor of a field
Perhaps get the id using that technique then use jquery('#myhiddenfieldid').val(id) store it in a hidden input field so the post back will then send it back to the web2py server code when you can easily access it. Or send it back right away using an ajax() call. On Tuesday, March 5, 2013 12:19:45 PM UTC-6, open...@gmail.com wrote: Hi, I am newbee on Web2py, I am exploring it. I installed the jqGrid_plugin that works fine. But now I should like to get back the id of the record or the valor of a field but it is a JQuery that I don't know. I did this code: h1It is my table /h1 div class=tab id=t {{=plugin_jqgrid(db.image,columns=['id','titre'],height=300)}} /div script jQuery('.tab').click(function(){jQuery('.tab').hide()}) /script I have found the link to the jqGrid Demo but I don't understand how to adapt this code I found, in web2py. There is maybe a special way : jQuery(#a1).click( function(){ var id = jQuery(#list5).jqGrid('getGridParam','selrow'); if (id) { var ret = jQuery(#list5).jqGrid('getRowData',id); alert(id=+ret.id+ invdate=+ret.invdate+...); } else { alert(Please select row);} Somebody can help me or give to me some links to read, Regards, Bruno -- --- 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: Unable to import from modules folder?
I ran into similar problems when I tried to install a plugin. I suggest that web2py be changed to create the __init__.py files automatically in all modules folders after it unpacks a plugin. I think the plugin system also needs to support subfolders in the modules folder. Does not look like it handles modules subfolders. On Sunday, March 3, 2013 11:26:12 AM UTC-6, Alec Taylor wrote: YAY! - Just figured out the problem. Looks like there was no '__init__.py' file in my application root directory (web2py/applications/mynewapp). Now that I've put one there; importing works :D On Mon, Mar 4, 2013 at 4:25 AM, Alec Taylor alec.t...@gmail.comjavascript: wrote: Confirmed that the alternate suggested syntax doesn't work (same error); and that a blank '__init__.py' file is present in my modules directory. On Mon, Mar 4, 2013 at 4:10 AM, Niphlod nip...@gmail.com javascript: wrote: why don't you use the simplest form from foo_module import Foo ? PS: check that there's an __init__.y in the modules folder. If you want to use appname.modules.foo_module path, you need to check for the __init__.py also in the applications directory. On Sunday, March 3, 2013 6:03:19 PM UTC+1, Alec Taylor wrote: My app has default routes; so I can't figure out why I can't import. I created the app mynewapp as a new simple app; then copied over the views + default models from the latest welcome app. In the modules directory I put foo_module.py, containing: #!/usr/bin/env python # coding: utf8 class Foo: def foo(): return 'bar' --- In controllers/mynewapp I put: from applications.mynewapp.modules.foo_module import Foo # also tried # from foo_module import Foo And received this error type 'exceptions.ImportError' No module named mynewapp.modules.foo_module --- How do I import functions and/or classes from /modules to my controllers? Thanks for all suggestions, Alec Taylor -- --- 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 javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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: Returning a token for Android app authentication
If you mimic the same http traffic that a browser would generate, then of course you will get all the normal web2py functionality such as the session. The web2py session is usually stored in the database which means it can store a large amount of data without the size limits of cookie storage. And it will persist between requests. On Friday, January 4, 2013 6:19:14 PM UTC-6, Mark Li wrote: Would it be necessary to connect to the same web2py session? To my understanding, connecting to the same session would be necessary if the session contained Auth information indicating whether or not a user was logged in. However, using auth.login_bare(), I only return a token on login success, and the Auth information is never stored in session. Only the token would be used to check whether or not a user was authenticated, as this info is not stored in session. The login/authentication from Android would only be used for API calls, and not for browsing the site. In the 'tokens' table, there would be information about the user that would be similar to the Auth info stored in session. When the token is passed to web2py, it would return the same information that would normally be stored in session about the user. Thanks again for your help and checking my logic, I'm still pretty new to this! On Thursday, January 3, 2013 7:57:45 PM UTC-8, dlypka wrote: But are you reconnecting to the same web2py session on each request? On Thursday, January 3, 2013 3:20:01 PM UTC-6, Mark Li wrote: I reviewed your code again and looked into the source code for web2py to see how web2py deals with session login cookies. For what I want to accomplish, I believe I have found a method which does not involved changing web2py source code. It's simpler and more straight forward for me to wrap my head around (also not having to worry about storing cookies in the app). Please let me know if there's anything important I am missing or security flaws that I should consider. 1. Embed webview into native Android app, using auth.login_bare to authenticate. 2. On login success, return a token of similar format to web2py's session cookies. 3. Store this token in the database (in a table named 'tokens'), and send back to Android app as a cookie 4. For every request to my web service that requires authentication, send the token as a cookie and have the receiving API controller function extract the cookie/token. If the token is currently in the db.tokens, then the user has been authenticated and the request returns the appropriate data. 5. On logout/password change, delete the issued tokens for this user from db.tokens, so the same token can't be used to authenticate for future api calls. On Tuesday, January 1, 2013 10:33:26 PM UTC-8, dlypka wrote: I was not precisely calling from a native Android or native IOS app. I was using a PhoneGap client, which is different. It is looks like a web browser but is not a browser client. PhoneGap can only use HTML5 storage unless you write a native Android / IOS PhoneGap extension/plugin. So my technique will work from almost any client platform, even from a Windows native client app for example as long as it uses HTTP. Also, in my tracing of how web2py handles the client connection, I believe I found a few wrinkles in the sequence of events which needed to be handled specially in this case where the client is not a web browser. In your particular case, if you have cookies in the native client, then that is one less problem to solve, You probably just have to mimic the HTTP messages that a browser would send. On Tuesday, January 1, 2013 5:19:50 PM UTC-6, Mark Li wrote: Thanks for the responses, and Happy New Years to you guys too! dlypka, for your cookieless solution, it assumes that the client app can't store/extract tokens? In the Google Android link above, it says that both Android and iOS can read and extract the tokens/cookies. So when the Android app calls the Web2py app, wouldn't it just pass in the cookie/token and have Web2py verify it as it Web2py normally verifies session login cookies? On Tuesday, January 1, 2013 9:07:16 AM UTC-8, Massimo Di Pierro wrote: :-) On Tuesday, 1 January 2013 10:45:47 UTC-6, dlypka wrote: Yes it is my New Year's Resolution to make time to put it in a Slice. On Tuesday, January 1, 2013 10:35:49 AM UTC-6, Massimo Di Pierro wrote: Perhaps this should go in a web2pyslice? On Monday, 31 December 2012 21:28:04 UTC-6, dlypka wrote: I developed a solution for this. I posted it here: https://groups.google.com/forum/?fromgroups=#!topic/web2py/YVYQHRJmcos Happy New Year! On Monday, December 31, 2012 4:38:40 PM UTC-6, Mark Li wrote: I am currently trying to authenticate users on an Android app to my Web2py application. I am not comfortable implementing this on my own without some guidance/advice, as I'm worried about the security
[web2py] Re: RESTful authentication with web2py?
Try these 2 threads https://groups.google.com/forum/?fromgroups=#!topic/web2py/YVYQHRJmcos -- This is my PhoneGap to web2py experiment https://groups.google.com/forum/?fromgroups=#!topic/web2py/-QPh73Ge2tk -- Native Android to web2py discussion On Saturday, January 5, 2013 7:07:27 AM UTC-6, Alec Taylor wrote: How do I set the registration key on registration; or do I need to manually process the form and do it that way? The concept is to be able to grab data statelessly, i.e.: curl -X GET http://localhost/api/my_profile.json?token=stored in REST client from previous login or register Any suggestions on how to do this would be appreciated. Thanks, Alec Taylor --
[web2py] Re: Returning a token for Android app authentication
But are you reconnecting to the same web2py session on each request? On Thursday, January 3, 2013 3:20:01 PM UTC-6, Mark Li wrote: I reviewed your code again and looked into the source code for web2py to see how web2py deals with session login cookies. For what I want to accomplish, I believe I have found a method which does not involved changing web2py source code. It's simpler and more straight forward for me to wrap my head around (also not having to worry about storing cookies in the app). Please let me know if there's anything important I am missing or security flaws that I should consider. 1. Embed webview into native Android app, using auth.login_bare to authenticate. 2. On login success, return a token of similar format to web2py's session cookies. 3. Store this token in the database (in a table named 'tokens'), and send back to Android app as a cookie 4. For every request to my web service that requires authentication, send the token as a cookie and have the receiving API controller function extract the cookie/token. If the token is currently in the db.tokens, then the user has been authenticated and the request returns the appropriate data. 5. On logout/password change, delete the issued tokens for this user from db.tokens, so the same token can't be used to authenticate for future api calls. On Tuesday, January 1, 2013 10:33:26 PM UTC-8, dlypka wrote: I was not precisely calling from a native Android or native IOS app. I was using a PhoneGap client, which is different. It is looks like a web browser but is not a browser client. PhoneGap can only use HTML5 storage unless you write a native Android / IOS PhoneGap extension/plugin. So my technique will work from almost any client platform, even from a Windows native client app for example as long as it uses HTTP. Also, in my tracing of how web2py handles the client connection, I believe I found a few wrinkles in the sequence of events which needed to be handled specially in this case where the client is not a web browser. In your particular case, if you have cookies in the native client, then that is one less problem to solve, You probably just have to mimic the HTTP messages that a browser would send. On Tuesday, January 1, 2013 5:19:50 PM UTC-6, Mark Li wrote: Thanks for the responses, and Happy New Years to you guys too! dlypka, for your cookieless solution, it assumes that the client app can't store/extract tokens? In the Google Android link above, it says that both Android and iOS can read and extract the tokens/cookies. So when the Android app calls the Web2py app, wouldn't it just pass in the cookie/token and have Web2py verify it as it Web2py normally verifies session login cookies? On Tuesday, January 1, 2013 9:07:16 AM UTC-8, Massimo Di Pierro wrote: :-) On Tuesday, 1 January 2013 10:45:47 UTC-6, dlypka wrote: Yes it is my New Year's Resolution to make time to put it in a Slice. On Tuesday, January 1, 2013 10:35:49 AM UTC-6, Massimo Di Pierro wrote: Perhaps this should go in a web2pyslice? On Monday, 31 December 2012 21:28:04 UTC-6, dlypka wrote: I developed a solution for this. I posted it here: https://groups.google.com/forum/?fromgroups=#!topic/web2py/YVYQHRJmcos Happy New Year! On Monday, December 31, 2012 4:38:40 PM UTC-6, Mark Li wrote: I am currently trying to authenticate users on an Android app to my Web2py application. I am not comfortable implementing this on my own without some guidance/advice, as I'm worried about the security of the login information becoming jeopardized. I am following the guideline for authentication outlined by Google here: https://developers.google.com/accounts/docs/MobileApps Another outline of what how I'm trying to accomplish Authentication outlined here: http://stackoverflow.com/questions/7358715/authentication-model-for-android-application The first step, and my question, is how I would generate a token to return to the Android app after the user has successfully logged in. It is suggested that this token be in the same format to what Web2py uses for session login cookies, except with a 'mobile' flag indicating the token can only be used for API calls, and doesn't have the short lifespan of a browser session. Any help would be greatly appreciated, as I haven't read too much about authentication to web2py from an Android app. --
[web2py] Re: Returning a token for Android app authentication
Yes it is my New Year's Resolution to make time to put it in a Slice. On Tuesday, January 1, 2013 10:35:49 AM UTC-6, Massimo Di Pierro wrote: Perhaps this should go in a web2pyslice? On Monday, 31 December 2012 21:28:04 UTC-6, dlypka wrote: I developed a solution for this. I posted it here: https://groups.google.com/forum/?fromgroups=#!topic/web2py/YVYQHRJmcos Happy New Year! On Monday, December 31, 2012 4:38:40 PM UTC-6, Mark Li wrote: I am currently trying to authenticate users on an Android app to my Web2py application. I am not comfortable implementing this on my own without some guidance/advice, as I'm worried about the security of the login information becoming jeopardized. I am following the guideline for authentication outlined by Google here: https://developers.google.com/accounts/docs/MobileApps Another outline of what how I'm trying to accomplish Authentication outlined here: http://stackoverflow.com/questions/7358715/authentication-model-for-android-application The first step, and my question, is how I would generate a token to return to the Android app after the user has successfully logged in. It is suggested that this token be in the same format to what Web2py uses for session login cookies, except with a 'mobile' flag indicating the token can only be used for API calls, and doesn't have the short lifespan of a browser session. Any help would be greatly appreciated, as I haven't read too much about authentication to web2py from an Android app. --
[web2py] Re: Returning a token for Android app authentication
I was not precisely calling from a native Android or native IOS app. I was using a PhoneGap client, which is different. It is looks like a web browser but is not a browser client. PhoneGap can only use HTML5 storage unless you write a native Android / IOS PhoneGap extension/plugin. So my technique will work from almost any client platform, even from a Windows native client app for example as long as it uses HTTP. Also, in my tracing of how web2py handles the client connection, I believe I found a few wrinkles in the sequence of events which needed to be handled specially in this case where the client is not a web browser. In your particular case, if you have cookies in the native client, then that is one less problem to solve, You probably just have to mimic the HTTP messages that a browser would send. On Tuesday, January 1, 2013 5:19:50 PM UTC-6, Mark Li wrote: Thanks for the responses, and Happy New Years to you guys too! dlypka, for your cookieless solution, it assumes that the client app can't store/extract tokens? In the Google Android link above, it says that both Android and iOS can read and extract the tokens/cookies. So when the Android app calls the Web2py app, wouldn't it just pass in the cookie/token and have Web2py verify it as it Web2py normally verifies session login cookies? On Tuesday, January 1, 2013 9:07:16 AM UTC-8, Massimo Di Pierro wrote: :-) On Tuesday, 1 January 2013 10:45:47 UTC-6, dlypka wrote: Yes it is my New Year's Resolution to make time to put it in a Slice. On Tuesday, January 1, 2013 10:35:49 AM UTC-6, Massimo Di Pierro wrote: Perhaps this should go in a web2pyslice? On Monday, 31 December 2012 21:28:04 UTC-6, dlypka wrote: I developed a solution for this. I posted it here: https://groups.google.com/forum/?fromgroups=#!topic/web2py/YVYQHRJmcos Happy New Year! On Monday, December 31, 2012 4:38:40 PM UTC-6, Mark Li wrote: I am currently trying to authenticate users on an Android app to my Web2py application. I am not comfortable implementing this on my own without some guidance/advice, as I'm worried about the security of the login information becoming jeopardized. I am following the guideline for authentication outlined by Google here: https://developers.google.com/accounts/docs/MobileApps Another outline of what how I'm trying to accomplish Authentication outlined here: http://stackoverflow.com/questions/7358715/authentication-model-for-android-application The first step, and my question, is how I would generate a token to return to the Android app after the user has successfully logged in. It is suggested that this token be in the same format to what Web2py uses for session login cookies, except with a 'mobile' flag indicating the token can only be used for API calls, and doesn't have the short lifespan of a browser session. Any help would be greatly appreciated, as I haven't read too much about authentication to web2py from an Android app. --
[web2py] Re: Returning a token for Android app authentication
I developed a solution for this. I posted it here: https://groups.google.com/forum/?fromgroups=#!topic/web2py/YVYQHRJmcos Happy New Year! On Monday, December 31, 2012 4:38:40 PM UTC-6, Mark Li wrote: I am currently trying to authenticate users on an Android app to my Web2py application. I am not comfortable implementing this on my own without some guidance/advice, as I'm worried about the security of the login information becoming jeopardized. I am following the guideline for authentication outlined by Google here: https://developers.google.com/accounts/docs/MobileApps Another outline of what how I'm trying to accomplish Authentication outlined here: http://stackoverflow.com/questions/7358715/authentication-model-for-android-application The first step, and my question, is how I would generate a token to return to the Android app after the user has successfully logged in. It is suggested that this token be in the same format to what Web2py uses for session login cookies, except with a 'mobile' flag indicating the token can only be used for API calls, and doesn't have the short lifespan of a browser session. Any help would be greatly appreciated, as I haven't read too much about authentication to web2py from an Android app. --
[web2py] Re: wxpython app using web2py username and password
Another patch: In login_cookieless(), after: session.person_email=rows[0].email insert this following line: session._try_store_in_db(request, response) # save changes to the session On Sunday, November 25, 2012 7:41:00 AM UTC-6, dlypka wrote: Sample controller code: (This is not production quality code. It is meant only to suggest an approach to use). def isloggedin_cookieless0(self): request,response,session,cache,T,db=self._globals() retIsLoggedIn = False person_id = session.person_id retIsLoggedIn = True if person_id else False if retIsLoggedIn: resmsg = T(OK) else: resmsg = T(Not Logged In) return (retIsLoggedIn, resmsg) def isloggedin_cookieless(self): request,response,session,cache,T,db=self._globals() session_id_tuple0 = response.session_id # example 'None:d602d501-877d-42aa-9b52-0e58a91b8336' session_tuple_split = session_id_tuple0.split(':') session_record_id = session_tuple_split[0] session_guid = session_tuple_split[1] if session_record_id == 'None': session_record_id_fromweb2py = response.session_record_id else: session_record_id_fromweb2py = int(session_record_id) if 'cred' in request.post_vars: basic_cred = request.post_vars.cred if not basic_cred[:6].lower() == 'basic ': basic_cred = 'basic ' + basic_cred if not basic_cred or not basic_cred[:6].lower() == 'basic ': user = None pwd = None else: import base64 (user, pwd) = base64.b64decode(basic_cred[6:]).split(':') pwdcrypt=CRYPT()(pwd)[0] rows=db(db.person.email==user)\ (db.person.password==pwdcrypt).select() if rows: session.person_id=rows[0].id retIsLoggedIn, resmsg = self.isloggedin_cookieless0() result = '{ IsLoggedIn: %s, session_record_id_fromweb2py:%s, session_guid_fromweb2py:%s,resmsg: %s}' % (retIsLoggedIn, session_record_id_fromweb2py, session_guid, resmsg) # Use this if called from xmlHttpRequest in Javascript response.headers['Content-Type'] = 'application/jsonp' response.headers['Access-Control-Allow-Origin'] = '*' # CORS response.view = 'generic.jsonp' # Using python code in file init/views/generic.jsonp to leave data unescaped return result def login_cookieless(self): request,response,session,cache,T,db=self._globals() resmsg = T(Invalid login credentials) retIsLoggedIn, resmsg = self.isloggedin_cookieless0() if retIsLoggedIn: resmsg = T(Already Logged In) if (not retIsLoggedIn) and (request.is_https or (request.client=='127.0.0.1')): basic_cred = request.post_vars.cred if not basic_cred or not basic_cred[:6].lower() == 'basic ': user = None pwd = None else: import base64 (user, pwd) = base64.b64decode(basic_cred[6:]).split(':') pwdcrypt=CRYPT()(pwd)[0] rows=db(db.person.email==user)\ (db.person.password==pwdcrypt)\ (db.person.registration_key=='').select() if rows: retIsLoggedIn = True session.person_id=rows[0].id session.person_name=rows[0].name session.person_email=rows[0].email ressessioncookiename = response.session_id_name sessiontuplesplit = response.session_id.split(':') session_record_id = sessiontuplesplit[0] session_guid = sessiontuplesplit[1] resmsg = T(Login Successful) result = '{ IsLoggedIn:%s, sessioncookiename_fromweb2py:%s, session_record_id_fromweb2py:%s, session_guid_fromweb2py:%s, resmsg:%s}' % (retIsLoggedIn, ressessioncookiename, session_record_id, session_guid, resmsg) # Use this if called from xmlHttpRequest in Javascript response.headers['Content-Type'] = 'application/jsonp' response.headers['Access-Control-Allow-Origin'] = '*' # CORS response.view = 'generic.jsonp' # Using python code in file init/views/generic.jsonp to leave data unescaped return result --
[web2py] Re: Integrated Development Environment with web2py
One GOTCHA I found with WING IDE is that you must delete all .pyc files before running, in order to have it correctly stop on your breakpoints in non-module code, in the case where such .py source has been subsequently modified after the .pyc was created. For code that is in a module, the breakpoints always stop correctly regardless of changes to the .py of the module. On Thursday, April 23, 2009 12:51:21 AM UTC-5, Speedbird wrote: Folks, Just wanted to share with the community a real jewel, many of you knew this but I actually started using it heavily during the past couple of weeks: the IDE is wing from wingware, basically you run web2py from inside of it, then just open your controller/module/model from the IDE, set up a breakpoint and voila you have a very interesting development studio ala visual studio. I've added a screenshot of my desktop running the IDE with my current pet, pyforum.org being debugged, the screenshot can be found here: http://www.julioflores.com/static/debug_web2py.png Wing IDE is not free, BUT you can get a developer's license (which will give you the latest Pro release bona-fide). you have no idea how much less time I've spent debugging the code with a tool like this one, long live web2py PS - Here's the web2py-specific information on their page, whoever wrote it must've had a good understanding of the web2py framework (was it you massimo??) - http://www.wingware.com/doc/howtos/web2py Best regards to all, Julio --
[web2py] Re: wxpython app using web2py username and password
Here is the client code in Javascript for a PhoneGap mobile app using all the web2py mods and controller code I have previously posted. Hopefully it is straight forward to convert to C++ or C# for a Windows client app as well: It uses the HTML 5 feature window.localStorage instead of cookies. function xmlhttpPostloginrequest(strURL, username, password) { var xmlHttpReq = false; var self = this; // Mozilla/Safari if (window.XMLHttpRequest) { self.xmlHttpReq = new XMLHttpRequest(); } // IE else if (window.ActiveXObject) { self.xmlHttpReq = new ActiveXObject(Microsoft.XMLHTTP); } self.xmlHttpReq.open('POST', strURL, false, username, password); self.xmlHttpReq.setRequestHeader(Content-Type, application/x-www-form-urlencoded); self.xmlHttpReq.onreadystatechange = function() { if (self.xmlHttpReq.readyState == 4) { debugger; var restext = self.xmlHttpReq.responseText; var resdict = JSON.parse(restext); var res = resdict[IsLoggedIn]; var rescookiename = resdict[sessioncookiename_fromweb2py]; var ressession_record_id = resdict[session_record_id_fromweb2py]; var ressession_guid = resdict[session_guid_fromweb2py]; var resmsg = resdict[resmsg]; if (res == 'True') { //store window.localStorage[username] = username; window.localStorage[password] = password; window.localStorage[sessioncookiename_fromweb2py] = rescookiename; // retrieve these values for checkisloggedin() and do self.xmlHttpReq.setRequestHeader() window.localStorage[sessioncookieval_fromweb2py] = ressession_record_id + ':' + ressession_guid; // Now we are logged in... $.mobile.changePage(#mainPage); // mainPage is your first application page of business logic (html for mainPage is NOT shown in this posting) } else { navigator.notification.alert(Your login failed, function() { }); } $(#submitButton).removeAttr(disabled); } } var rawcred = make_base_auth(username, password) var rawcredhtmlEncoded = htmlEncode(rawcred); var qscred = cred= + rawcredhtmlEncoded; var session_record_id_fromweb2py = window.localStorage[session_record_id_fromweb2py]; var session_guid_fromweb2py = window.localStorage[session_guid_fromweb2py]; var sessioncookieval_fromweb2py = session_record_id_fromweb2py.toString() + ':' + session_guid_fromweb2py; window.localStorage[sessioncookieval_fromweb2py] = sessioncookieval_fromweb2py; var datatosend = 'sessioncookieval_fromweb2py=' + sessioncookieval_fromweb2py + '' + qscred ; self.xmlHttpReq.send(datatosend); } // xmlhttpPostloginrequest() function handleLogin() { var form = $(#loginForm); //disable the button so we can't resubmit while we wait $(#submitButton, form).attr(disabled, disabled); var u = $(#username, form).val(); var p = $(#password, form).val(); var urlpw = http://localhost:8080/init/default/login_mobile;; if (u != '' p != '') { xmlhttpPostloginrequest(urlpw, u, p); } else { navigator.notification.alert(You must enter a username and password, function () { }); $(#submitButton).removeAttr(disabled); } return false; } // handleLogin() function xmlhttpPostcheckisloggedinrequest(strURL) { var xmlHttpReq = false; var self = this; // Mozilla/Safari if (window.XMLHttpRequest) { self.xmlHttpReq = new XMLHttpRequest(); } // IE else if (window.ActiveXObject) { self.xmlHttpReq = new ActiveXObject(Microsoft.XMLHTTP); } self.xmlHttpReq.open('POST', strURL, false); var rescookiename = ; var rescookieval = ; if (window.localStorage[sessioncookiename_fromweb2py] != undefined window.localStorage[sessioncookieval_fromweb2py] != undefined) { rescookiename = window.localStorage[sessioncookiename_fromweb2py]; rescookieval = window.localStorage[sessioncookieval_fromweb2py]; } self.xmlHttpReq.onreadystatechange = function() { if (self.xmlHttpReq.readyState == 4) { debugger; var restext = self.xmlHttpReq.responseText; if (restext == ) { $.mobile.changePage(#loginPage); } else { var resdict = JSON.parse(restext); var res = resdict[IsLoggedIn]; var ressession_record_id_fromweb2py =
[web2py] Re: Transactions in Web2Py over Google App Engine.
I found this: https://developers.google.com/appengine/docs/python/datastore/overview#Cross_Group_Transactions For example, to increment a counter field in an object, you need to read the value of the counter, calculate the new value, and then store it back. Without a transaction, it is possible for another process to increment the counter between the time you read the value and the time you update it, causing your application to overwrite the updated value. Doing the read, calculation, and write in a single transaction ensures that no other process can interfere with the increment. On Friday, November 30, 2012 12:19:29 PM UTC-6, Joe Barnhart wrote: Think hard before locking a table while a user is dawdling over his reservation. The feature you are dealing with is database isolation levelhttp://en.wikipedia.org/wiki/Isolation_%28database_systems%29 and is the subject that fills volumes of database theory. From what you describe I think you want the repeatable read level. I do not know enough about GAE to tell you which levels it supports. But here is an article on Google BigTable Isolationhttps://developers.google.com/appengine/articles/transaction_isolationwhich may help. -- Joe B. On Thursday, November 29, 2012 2:18:47 AM UTC-8, José Manuel López Muñoz wrote: I'm making a room reservation system in Web2Py over Google App Engine. When a user is booking a Room the system must be sure that this room is really available and no one else have reserved it just a moment before. To be sure I make a query to see if the room is available, then I make the reservation. The problem is how can I do this transaction in a kind of Mutual exclusion to be sure that this room is really for this user? Thank you!! :) --
[web2py] Re: wxpython app using web2py username and password
Sample controller code: (This is not production quality code. It is meant only to suggest an approach to use). def isloggedin_cookieless0(self): request,response,session,cache,T,db=self._globals() retIsLoggedIn = False person_id = session.person_id retIsLoggedIn = True if person_id else False if retIsLoggedIn: resmsg = T(OK) else: resmsg = T(Not Logged In) return (retIsLoggedIn, resmsg) def isloggedin_cookieless(self): request,response,session,cache,T,db=self._globals() session_id_tuple0 = response.session_id # example 'None:d602d501-877d-42aa-9b52-0e58a91b8336' session_tuple_split = session_id_tuple0.split(':') session_record_id = session_tuple_split[0] session_guid = session_tuple_split[1] if session_record_id == 'None': session_record_id_fromweb2py = response.session_record_id else: session_record_id_fromweb2py = int(session_record_id) if 'cred' in request.post_vars: basic_cred = request.post_vars.cred if not basic_cred[:6].lower() == 'basic ': basic_cred = 'basic ' + basic_cred if not basic_cred or not basic_cred[:6].lower() == 'basic ': user = None pwd = None else: import base64 (user, pwd) = base64.b64decode(basic_cred[6:]).split(':') pwdcrypt=CRYPT()(pwd)[0] rows=db(db.person.email==user)\ (db.person.password==pwdcrypt).select() if rows: session.person_id=rows[0].id retIsLoggedIn, resmsg = self.isloggedin_cookieless0() result = '{ IsLoggedIn: %s, session_record_id_fromweb2py:%s, session_guid_fromweb2py:%s,resmsg: %s}' % (retIsLoggedIn, session_record_id_fromweb2py, session_guid, resmsg) # Use this if called from xmlHttpRequest in Javascript response.headers['Content-Type'] = 'application/jsonp' response.headers['Access-Control-Allow-Origin'] = '*' # CORS response.view = 'generic.jsonp' # Using python code in file init/views/generic.jsonp to leave data unescaped return result def login_cookieless(self): request,response,session,cache,T,db=self._globals() resmsg = T(Invalid login credentials) retIsLoggedIn, resmsg = self.isloggedin_cookieless0() if retIsLoggedIn: resmsg = T(Already Logged In) if (not retIsLoggedIn) and (request.is_https or (request.client=='127.0.0.1')): basic_cred = request.post_vars.cred if not basic_cred or not basic_cred[:6].lower() == 'basic ': user = None pwd = None else: import base64 (user, pwd) = base64.b64decode(basic_cred[6:]).split(':') pwdcrypt=CRYPT()(pwd)[0] rows=db(db.person.email==user)\ (db.person.password==pwdcrypt)\ (db.person.registration_key=='').select() if rows: retIsLoggedIn = True session.person_id=rows[0].id session.person_name=rows[0].name session.person_email=rows[0].email ressessioncookiename = response.session_id_name sessiontuplesplit = response.session_id.split(':') session_record_id = sessiontuplesplit[0] session_guid = sessiontuplesplit[1] resmsg = T(Login Successful) result = '{ IsLoggedIn:%s, sessioncookiename_fromweb2py:%s, session_record_id_fromweb2py:%s, session_guid_fromweb2py:%s, resmsg:%s}' % (retIsLoggedIn, ressessioncookiename, session_record_id, session_guid, resmsg) # Use this if called from xmlHttpRequest in Javascript response.headers['Content-Type'] = 'application/jsonp' response.headers['Access-Control-Allow-Origin'] = '*' # CORS response.view = 'generic.jsonp' # Using python code in file init/views/generic.jsonp to leave data unescaped return result --
[web2py] Re: admin interface + GAE
Yes, not a bug but these are issues which come up when messing with the admin interface on GAE. NOTE that the issues occur when running locally using the GAE SDK as well. So I assume the correct approach is to run it once as a normal web2py app i.e. python web2py.py to get those special files to write out. Then subsequent dev_appserver.py runs should work... On Monday, November 19, 2012 11:15:58 PM UTC-6, dlypka wrote: I had to work around this problem in tools.py in my web2py 1.9x code. Maybe this issue is still in 2.x @staticmethod def get_or_create_key(filename=None): request = current.request if not filename: filename = os.path.join(request.folder,'private','auth.key') if os.path.exists(filename): key = open(filename,'r').read().strip() else: key = web2py_uuid() *#* open(filename,'w').write(key) *# dlypka workaround - this crashes on GAE, not allowing to write to a file!!* return key -- Also a similar issue here: in In admin\controllers\default.py #Get crontab cronfolder = apath('%s/cron' % app, r=request) if not os.path.exists(cronfolder): os.mkdir(cronfolder) crontab = apath('%s/cron/crontab' % app, r=request) #if not os.path.exists(crontab): # dlypka patch for GAE - safe_write() fails on gae #safe_write(crontab, '#crontab') On Monday, November 19, 2012 9:22:36 PM UTC-6, Massimo Di Pierro wrote: Please open a ticken about this. I will be able to look at it later tomorrow. On Monday, 19 November 2012 10:57:27 UTC-6, Sebastian Cambeo wrote: might it be, that users.create_login_url(request.env.path_info) in check_credentials needs some kind of file access? Anyhow this request appears to trigger the error --
[web2py] Re: admin interface + GAE
I had to work around this problem in tools.py in my web2py 1.9x code. Maybe this issue is still in 2.x @staticmethod def get_or_create_key(filename=None): request = current.request if not filename: filename = os.path.join(request.folder,'private','auth.key') if os.path.exists(filename): key = open(filename,'r').read().strip() else: key = web2py_uuid() *#* open(filename,'w').write(key) *# dlypka workaround - this crashes on GAE, not allowing to write to a file!!* return key -- Also a similar issue here: in In admin\controllers\default.py #Get crontab cronfolder = apath('%s/cron' % app, r=request) if not os.path.exists(cronfolder): os.mkdir(cronfolder) crontab = apath('%s/cron/crontab' % app, r=request) #if not os.path.exists(crontab): # dlypka patch for GAE - safe_write() fails on gae #safe_write(crontab, '#crontab') On Monday, November 19, 2012 9:22:36 PM UTC-6, Massimo Di Pierro wrote: Please open a ticken about this. I will be able to look at it later tomorrow. On Monday, 19 November 2012 10:57:27 UTC-6, Sebastian Cambeo wrote: might it be, that users.create_login_url(request.env.path_info) in check_credentials needs some kind of file access? Anyhow this request appears to trigger the error --
[web2py] Re: wxpython app using web2py username and password
Here is a revision to Step 2: 2. In main.py starting around line 526 # ## # try load session or create new session file # ## if not env.web2py_disable_session: session.connect(request, response) change to # ## # try load session or create new session file # ## session.connect(request, response, db) # dlypka mod - added ,db newsessionid = 0 # dlypka mod if 'sessioncookieval_fromweb2py' in request.post_vars or 'checkIsLoggedIn' in request.post_vars : # dlypka mod newsessionid = session._try_store_in_db(request, response) # dlypka mod if newsessionid 0: # dlypka mod isSessionRecordCreated = True; # dlypka mod On Thursday, November 15, 2012 11:03:27 AM UTC-6, Jim S wrote: Hi, I'm creating a little desktop app as a companion to a web app I created with web2py. I'm using the default auth_user tables so I have an email address and encrypted password I can use for my desktop user to login. I've been looking for the code that does the login in web2py but can't seem to find it. Is there a recipe somewhere that would show me how to mimic the encryption that web2py uses so I compare encrypted passwords and use them to allow my desktop app users to login? -Jim --
[web2py] Re: wxpython app using web2py username and password
But from what I understand, the session logic in globals.py and main.py pretty much depends on cookies in the client for finding out what session to reconnect to on subsequent requests after the very first request (which creates the session record). But a windows client will not know what a cookie is... So I believe we need to change that web2py core code to handle this cookieless session reconnect scenario. On Saturday, November 17, 2012 10:41:24 PM UTC-6, Dave wrote: Jim, If your windows users are logging in via active directory you could just make your web2py app authenticate through ldap to AD. That would ensure AD is your source of truth fo user authentication and management. Just a thought. On Thursday, November 15, 2012 12:32:03 PM UTC-5, Jim S wrote: Sounds like there is no easy way to do it. I looked through that code and it seems pretty involved. I was hoping to do this without needing the web2py libs and such. -Jim On Thursday, November 15, 2012 11:14:09 AM UTC-6, Niphlod wrote: https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1776 that basically calls the validators attached by default to a password field https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1479 i.e. you just have to import the validator CRYPT and check with that passing the correct parameters https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2659 PS: CRYPT was easier to follow before the introduction of the pdfbk2 algo, but it's quite straightforward if you are willing to cut off backward-compatibility (that required lazycrypt https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2581) --
Re: [web2py] Re: wxpython app using web2py username and password
Here is the first bit of my patch to enable web2py to handle a cookieless login and session reconnect: 1. in main.py around line 401 static_file = False try: try: try: change to static_file = False isSessionRecordCreated = False # dlypka mod try: try: try: 2. In main.py starting around line 526 # ## # try load session or create new session file # ## if not env.web2py_disable_session: session.connect(request, response) change to # ## # try load session or create new session file # ## session.connect(request, response, db) # dlypka mod - added ,db newsessionid = 0 # dlypka mod if 'sessioncookieval_fromweb2py' in request.post_vars: # dlypka mod newsessionid = session._try_store_in_db(request, response) # dlypka mod if newsessionid 0: # dlypka mod isSessionRecordCreated = True; # dlypka mod 3. then in main.py around line 551: # ## # on success, try store session in database # ## session._try_store_in_db(request, response) change to # ## # on success, try store session in database # ## if isSessionRecordCreated == False: # dlypka mod session._try_store_in_db(request, response) 4. In globals.py around line 348 separate can be separate=lambda(session_name): session_name[-2:] and it is used to determine a session prefix. separate can be True and it is set to session_name[-2:] change to separate can be separate=lambda(session_name): session_name[-2:] and it is used to determine a session prefix. separate can be True and it is set to session_name[-2:] if session_id_name in response.keys(): # dlypka mod return # dlypka mod - avoids unnecessary session.connect() coming from db.py 5. In globals.py around line 624 try: # Get session data out of the database (record_id, unique_key) = response.session_id.split(':') if record_id == '0': raise Exception('record_id == 0') # Select from database if not session_cookie_data: rows = db(table.id == record_id).select() # Make sure the session data exists in the database if len(rows) == 0 or rows[0].unique_key != unique_key: raise Exception('No record') # rows[0].update_record(locked=True) # Unpickle the data session_data = cPickle.loads(rows[0].session_data) self.update(session_data) Change to try: # Get session data out of the database if 'sessioncookieval_fromweb2py' in request.post_vars: # dlypka mod for cookieless client key = request.post_vars['sessioncookieval_fromweb2py'] # dlypka e.g. '72:d602d501-877d-42aa-9b52-0e58a91b8336' else: key = response.session_id (record_id, unique_key) = key.split(':') record_id = int(record_idstr) # dlypka patch to use int instead of string for the id if record_id == 0: # dlypka patch to use int instead of string for the id raise Exception, 'record_id == 0' # Select from database if not session_cookie_data: rows = db(table.id == record_id).select() # Make sure the session data exists in the database if len(rows) == 0 or rows[0].unique_key != unique_key: raise Exception('No record') # rows[0].update_record(locked=True) # Unpickle the data session_data = cPickle.loads(rows[0].session_data) self.update(session_data) 6. In globals.py around line 713: def _try_store_in_db(self, request, response): # don't save if file-based sessions, # no session id, or session being forgotten
Re: [web2py] Re: wxpython app using web2py username and password
I intend to create some sample code fragments. I will try to post something by Monday. On Thursday, November 15, 2012 9:16:09 PM UTC-6, Jim S wrote: I would be interested in learning more. do you have any samples you could share? On Nov 15, 2012 8:52 PM, dlypka dly...@gmail.com javascript: wrote: I recently devised some changes to globals.py and main.py to allow a non-cookies client to log into web2py and keep the same session record between requests, just as a browser does. In my case the client is a PhoneGap app and I hit web2py through HTTP. I store the web2py session record id on the client in HTML 5 local storage, so that the client can sent it along with each request to tell web2py what session to reconnect to. A similar approach would probably work from a Windows App. On Thursday, November 15, 2012 4:34:22 PM UTC-6, Jim S wrote: My main concern is that with this being a desktop app that I don't want to have to keep the latest versions of those files on the client machines. I switched my desktop authorization to read the Windows username and then match it to a username in the auth_user table and rely on the Windows authentication to ensure that user is logged in properly. I validate that they are on the proper domain and they are logged in with an id in the table. Now I don't need to worry about keep those files current on multiple clients. -Jim On Thursday, November 15, 2012 2:01:12 PM UTC-6, Niphlod wrote: ehm validators.py (if not all, just crypt and lazycrypt, plus Validator original class), utils.py and pbkdf2 is all you need. On Thursday, November 15, 2012 6:32:03 PM UTC+1, Jim S wrote: Sounds like there is no easy way to do it. I looked through that code and it seems pretty involved. I was hoping to do this without needing the web2py libs and such. -Jim On Thursday, November 15, 2012 11:14:09 AM UTC-6, Niphlod wrote: https://github.com/web2py/**web2py/blob/master/gluon/**tools.py#L1776https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1776 that basically calls the validators attached by default to a password field https://github.com/web2py/**web2py/blob/master/gluon/**tools.py#L1479https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1479 i.e. you just have to import the validator CRYPT and check with that passing the correct parameters https://github.com/web2py/**web2py/blob/master/gluon/** validators.py#L2659https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2659 PS: CRYPT was easier to follow before the introduction of the pdfbk2 algo, but it's quite straightforward if you are willing to cut off backward-compatibility (that required lazycrypt https://github.com/web2py/** web2py/blob/master/gluon/**validators.py#L2581https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2581 ) -- --
[web2py] Re: wxpython app using web2py username and password
I recently devised some changes to globals.py and main.py to allow a non-cookies client to log into web2py and keep the same session record between requests, just as a browser does. In my case the client is a PhoneGap app and I hit web2py through HTTP. I store the web2py session record id on the client in HTML 5 local storage, so that the client can sent it along with each request to tell web2py what session to reconnect to. A similar approach would probably work from a Windows App. On Thursday, November 15, 2012 4:34:22 PM UTC-6, Jim S wrote: My main concern is that with this being a desktop app that I don't want to have to keep the latest versions of those files on the client machines. I switched my desktop authorization to read the Windows username and then match it to a username in the auth_user table and rely on the Windows authentication to ensure that user is logged in properly. I validate that they are on the proper domain and they are logged in with an id in the table. Now I don't need to worry about keep those files current on multiple clients. -Jim On Thursday, November 15, 2012 2:01:12 PM UTC-6, Niphlod wrote: ehm validators.py (if not all, just crypt and lazycrypt, plus Validator original class), utils.py and pbkdf2 is all you need. On Thursday, November 15, 2012 6:32:03 PM UTC+1, Jim S wrote: Sounds like there is no easy way to do it. I looked through that code and it seems pretty involved. I was hoping to do this without needing the web2py libs and such. -Jim On Thursday, November 15, 2012 11:14:09 AM UTC-6, Niphlod wrote: https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1776 that basically calls the validators attached by default to a password field https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1479 i.e. you just have to import the validator CRYPT and check with that passing the correct parameters https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2659 PS: CRYPT was easier to follow before the introduction of the pdfbk2 algo, but it's quite straightforward if you are willing to cut off backward-compatibility (that required lazycrypt https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2581) --
[web2py] Re: Unescaped single quotes break my json
Well if the controller did the Escaping, then my suggestion will pass it back to the view untouched I think. So it might help. On Thursday, November 1, 2012 7:18:54 AM UTC-5, villas wrote: Hi dlypka, Not sure I was clear. I need to maintain the escaping. My point was this: my data was escaped OK in the controller, but when it arrived in the view, it was not escaped. Something broke the escaping of single-quotes passing between the two. Double quotes are a bit of problem too. We can work around the problem, but I thought there may be a proper solution. Best regards, D On Thursday, November 1, 2012 12:05:44 PM UTC, dlypka wrote: I used this code in my controller: result = '{ IsLoggedIn: %s, resmsg: %s}' % (retIsLoggedIn, resmsg) response.headers['Content-Type'] = 'application/jsonp' response.view = 'generic.jsonp' # Using python code in file init/views/generic.jsonp to leave data unescaped return result On Wednesday, October 31, 2012 7:06:06 PM UTC-5, villas wrote: I have a problem with escaping single quotes when I need a JS list in my view. I have a workaround below, but is there a better way? In controller: lst = [Andy's Barber Shop] jsonlst = json.dumps(lst) '[Andy\'s Barber Shop]' In view: {{=XML(jsonlst)}} '[Andy's Barber Shop]' --- Broken My Workaround: {{=XML(jsonlst.replace(', \\')}} '[Andy\'s Barber Shop]' --- Works OK --
[web2py] Re: Unescaped single quotes break my json
I used this code in my controller: result = '{ IsLoggedIn: %s, resmsg: %s}' % (retIsLoggedIn, resmsg) response.headers['Content-Type'] = 'application/jsonp' response.view = 'generic.jsonp' # Using python code in file init/views/generic.jsonp to leave data unescaped return result On Wednesday, October 31, 2012 7:06:06 PM UTC-5, villas wrote: I have a problem with escaping single quotes when I need a JS list in my view. I have a workaround below, but is there a better way? In controller: lst = [Andy's Barber Shop] jsonlst = json.dumps(lst) '[Andy\'s Barber Shop]' In view: {{=XML(jsonlst)}} '[Andy's Barber Shop]' --- Broken My Workaround: {{=XML(jsonlst.replace(', \\')}} '[Andy\'s Barber Shop]' --- Works OK --
[web2py] Which resource bundling framework / approach to use with web2py?
Debugging web2py web apps under WING IDE for me is quite slow because each resource (.js, .css) is loaded individually and quite slowly on each request. I noticed the latest Microsoft .NET MVC 4.0 has resource bundling built-in to Visual Studio 2012 and it is automatic. I have researched bundling approaches but am still not clear which way to go. I want it to work on CHROME for sure. Anyone have bundling working? --
[web2py] DAL Sybase Adapter testing update
We have successfully queried rows using cursor.execute() with pythonodbc connected to our Sysbase database. We cannot test a native pythonsybase driver because from what we found in opensource, you have to have the Sybase SDK to build the opensource native driver and the SDK costs more than $1,700 apparently. We used this Sybase ODBC driver on the remove AWS host on Citrix: Sybase IQ Driver 11.00.01.5612 from Anywhere Solution Inc. DBODBC11.dll 8/31/2010 We used this driver on the laptop client: Adaptive Server IQ 9.00.02.1023 IAnywhere Solutions Inc. DBODBC9.dll We only have read access to the Sybase database. Next we plan to get the table schemas and will try to construct the web2py tables for them. Then we can try using web2py queries which will then exercise / test the column type mappings in the DAL Sybase Adapter. It will take a few weeks probably. I don't think there is any usable id column in the native sybase data, but I will cluge something. One suggestion: Where you can specify an id type column in a web2py table over a legacy database, have it take the python int() function of the column if it is a legacy string column. Often, a useable id column in a legacy table is unfortunately in string format, but otherwise would be a good id. So my suggestion is to 'help it along' by taking the int() of the string column so that it will be a useable numeric id for the web2py table.
[web2py] Re: How to use web2py DAL with sybase? Can we modify the adapter to use pyodbc?
Our corporate standard OS is 32 bit Windows Vista. The Sybase driver list at sourceforge.net is only for Windows XP which will not work. I searched internet and it looks like the only good sybase driver is one that has to be purchased. There is also one with source which has to be built but that needs the Sybase SDK which is very expensive. Anyway, we have an ODBC driver installed and working on our Vista machine. So can we simply change dal.py to use odbc here? i.e. will it work if we make this change?: class SybaseAdapter(MSSQLAdapter): driver = globals().get('Sybase',None) to driver = globals().get('pyodbc',None) - Another temporary option is to take the 30 day trial driver from here: http://www.egenix.com/products/python/mxODBC/ Also note that we are using port forwarding and our database machine is very remote. It is NOT the case that we have sybase installed locally on our laptop. I also looked at the open source driver here http://linux.windows9download.net/221/sybase-module-for-python-1102810.html but even if we could somehow build it with the sybase SDK, I think it assumes sybase is installed locally. Not sure if it can handle accessing a remote server. Please advise. Thanks. On Wednesday, May 16, 2012 4:48:39 PM UTC-5, Massimo Di Pierro wrote: I just committed a SybaseAdapter using this driver: http://python-sybase.sourceforge.net/ It extends the MSSQLAdapter but uses the other driver and Sybase types. It needs testing. You can use it with DAL('sybase://dsnstring') or DAL('sybase://username:password@hostname:port/dbname') It uses this line to built the dsn string: dsn = 'sybase:host=%s:%s;dbname=%s' % (host,port,db) This is one line I am not sure about because the docs for the adapter do not explain it and I cannot try it. Massimo On Wednesday, 16 May 2012 16:24:02 UTC-5, dlypka wrote: No preference on which python driver for sybase. So whatever you select is fine with us. Thanks. - Dave Lypka. On Wednesday, May 16, 2012 4:10:28 PM UTC-5, Massimo Di Pierro wrote: Will send it tonight. Basically Sybase is almost the same as MSSQL. Do you a preference for one of the pyhton drivers for sybase? On Wednesday, 16 May 2012 10:51:39 UTC-5, dlypka wrote: I do not see any reference to sybase in 1.99.7 dal.py. Please point me to the sybase adapter. There are 2 of us developers here at work who can test it for you on a large corporate sybase database. Thanks. On Wednesday, May 16, 2012 10:42:05 AM UTC-5, Massimo Di Pierro wrote: web2py includes an adapter but nobody has tested it. If you can help us test it we can help you debug any problem that may arise. Compatibility with sybase and other SQL DB engines is a priority. On Wednesday, 16 May 2012 07:47:59 UTC-5, dlypka wrote: I see this posting which has some sybase adapter code: https://groups.google.com/forum/?fromgroups#!searchin/web2py/sybase/web2py/LXdEdc1th3M/8ZIOxE8tJQgJ Is there anything else? I have a need to use web2y + sybase at work. Thanks.
[web2py] Re: How to use web2py DAL with sybase? Update
Hi: FYI - we did a lot of work to setup the corporate sybase environment and successfully connected to sybase using the sybase client tools Thursday night. And we installed and tested the web2py Welcome app on the corporate laptop. We expect to start trying the web2py sybase adapter on Monday. On Wednesday, May 16, 2012 4:48:39 PM UTC-5, Massimo Di Pierro wrote: I just committed a SybaseAdapter using this driver: http://python-sybase.sourceforge.net/ It extends the MSSQLAdapter but uses the other driver and Sybase types. It needs testing. You can use it with DAL('sybase://dsnstring') D or DAL('sybase://username:password@hostname:port/dbname') It uses this line to built the dsn string: dsn = 'sybase:host=%s:%s;dbname=%s' % (host,port,db) This is one line I am not sure about because the docs for the adapter do not explain it and I cannot try it. Massimo On Wednesday, 16 May 2012 16:24:02 UTC-5, dlypka wrote: No preference on which python driver for sybase. So whatever you select is fine with us. Thanks. - Dave Lypka. On Wednesday, May 16, 2012 4:10:28 PM UTC-5, Massimo Di Pierro wrote: Will send it tonight. Basically Sybase is almost the same as MSSQL. Do you a preference for one of the pyhton drivers for sybase? On Wednesday, 16 May 2012 10:51:39 UTC-5, dlypka wrote: I do not see any reference to sybase in 1.99.7 dal.py. Please point me to the sybase adapter. There are 2 of us developers here at work who can test it for you on a large corporate sybase database. Thanks. On Wednesday, May 16, 2012 10:42:05 AM UTC-5, Massimo Di Pierro wrote: web2py includes an adapter but nobody has tested it. If you can help us test it we can help you debug any problem that may arise. Compatibility with sybase and other SQL DB engines is a priority. On Wednesday, 16 May 2012 07:47:59 UTC-5, dlypka wrote: I see this posting which has some sybase adapter code: https://groups.google.com/forum/?fromgroups#!searchin/web2py/sybase/web2py/LXdEdc1th3M/8ZIOxE8tJQgJ Is there anything else? I have a need to use web2y + sybase at work. Thanks.
[web2py] How to use web2py DAL with sybase?
I see this posting which has some sybase adapter code: https://groups.google.com/forum/?fromgroups#!searchin/web2py/sybase/web2py/LXdEdc1th3M/8ZIOxE8tJQgJ Is there anything else? I have a need to use web2y + sybase at work. Thanks.
[web2py] Re: How to use web2py DAL with sybase? Please point me to the sybase adapter
I do not see any reference to sybase in 1.99.7 dal.py. Please point me to the sybase adapter. There are 2 of us developers here at work who can test it for you on a large corporate sybase database. Thanks. On Wednesday, May 16, 2012 10:42:05 AM UTC-5, Massimo Di Pierro wrote: web2py includes an adapter but nobody has tested it. If you can help us test it we can help you debug any problem that may arise. Compatibility with sybase and other SQL DB engines is a priority. On Wednesday, 16 May 2012 07:47:59 UTC-5, dlypka wrote: I see this posting which has some sybase adapter code: https://groups.google.com/forum/?fromgroups#!searchin/web2py/sybase/web2py/LXdEdc1th3M/8ZIOxE8tJQgJ Is there anything else? I have a need to use web2y + sybase at work. Thanks.
[web2py] cannot find the adapter for sybase which Massimo is referring to
Please advise where it is. I do not see 'sybase' in dal.py. Is is somewhere else? Thanks.
[web2py] Re: How to use web2py DAL with sybase? Please point me to the sybase adapter
No preference on which python driver for sybase. So whatever you select is fine with us. Thanks. - Dave Lypka. On Wednesday, May 16, 2012 4:10:28 PM UTC-5, Massimo Di Pierro wrote: Will send it tonight. Basically Sybase is almost the same as MSSQL. Do you a preference for one of the pyhton drivers for sybase? On Wednesday, 16 May 2012 10:51:39 UTC-5, dlypka wrote: I do not see any reference to sybase in 1.99.7 dal.py. Please point me to the sybase adapter. There are 2 of us developers here at work who can test it for you on a large corporate sybase database. Thanks. On Wednesday, May 16, 2012 10:42:05 AM UTC-5, Massimo Di Pierro wrote: web2py includes an adapter but nobody has tested it. If you can help us test it we can help you debug any problem that may arise. Compatibility with sybase and other SQL DB engines is a priority. On Wednesday, 16 May 2012 07:47:59 UTC-5, dlypka wrote: I see this posting which has some sybase adapter code: https://groups.google.com/forum/?fromgroups#!searchin/web2py/sybase/web2py/LXdEdc1th3M/8ZIOxE8tJQgJ Is there anything else? I have a need to use web2y + sybase at work. Thanks.
[web2py] Re: How to use web2py DAL with sybase? Please point me to the sybase adapter
OK I will download the trunk and try it tomorrow. Thanks. On Wednesday, May 16, 2012 4:48:39 PM UTC-5, Massimo Di Pierro wrote: I just committed a SybaseAdapter using this driver: http://python-sybase.sourceforge.net/ It extends the MSSQLAdapter but uses the other driver and Sybase types. It needs testing. You can use it with DAL('sybase://dsnstring') or DAL('sybase://username:password@hostname:port/dbname') It uses this line to built the dsn string: dsn = 'sybase:host=%s:%s;dbname=%s' % (host,port,db) This is one line I am not sure about because the docs for the adapter do not explain it and I cannot try it. Massimo On Wednesday, 16 May 2012 16:24:02 UTC-5, dlypka wrote: No preference on which python driver for sybase. So whatever you select is fine with us. Thanks. - Dave Lypka. On Wednesday, May 16, 2012 4:10:28 PM UTC-5, Massimo Di Pierro wrote: Will send it tonight. Basically Sybase is almost the same as MSSQL. Do you a preference for one of the pyhton drivers for sybase? On Wednesday, 16 May 2012 10:51:39 UTC-5, dlypka wrote: I do not see any reference to sybase in 1.99.7 dal.py. Please point me to the sybase adapter. There are 2 of us developers here at work who can test it for you on a large corporate sybase database. Thanks. On Wednesday, May 16, 2012 10:42:05 AM UTC-5, Massimo Di Pierro wrote: web2py includes an adapter but nobody has tested it. If you can help us test it we can help you debug any problem that may arise. Compatibility with sybase and other SQL DB engines is a priority. On Wednesday, 16 May 2012 07:47:59 UTC-5, dlypka wrote: I see this posting which has some sybase adapter code: https://groups.google.com/forum/?fromgroups#!searchin/web2py/sybase/web2py/LXdEdc1th3M/8ZIOxE8tJQgJ Is there anything else? I have a need to use web2y + sybase at work. Thanks.
[web2py] Re: breakpoints + Eclipse + Web2Py
I believe you must delete all .pyc files before running it with breakpoints. On Mar 23, 1:18 pm, web2py_tn bougue...@gmail.com wrote: Hi guys- I sat up my Aptana Studio and loaded a web2py project that has breakpoints in it. I ran web2py.py in a debug more and for some reason, it doesn't stop at the breakpoints. If I create a new python project with breakpoints, it works perfectly fine. can you guys help?
[web2py] web2py on GAE: Issue #694 is a DAL patch to provide high performance parent-child queries
GAE developers - you may be interested in Issue 694 http://code.google.com/p/web2py/issues/detail?id=694 It allows you to use a normal web2py query to retrieve the parent entity but that single datastore query automatically attaches all the child entities as well. So instead of following links in a join, you get a one step high performance retrieval of parent and children combined.
[web2py] Re: Significant overhead with each define_table()
I have always wondered why the tables are executed on each request. For my apps, I moved them into a module and I also check if the table already exists, then bypass the creation. I hope the DAL is stateless in its table operations and that there are no multiple request contention issues.
[web2py] Re: Which is faster, download() in default.py or static
I don't think the static approach works on GAE.
[web2py] Re: Alternative for GROUP BY in app-engine
some relevant discussion is here: http://groups.google.com/group/google-appengine-java/browse_thread/thread/3dfe0f3268cd7e27
[web2py] Re: Optimizing web2py app for GAE
Perhaps these links will help: http://groups.google.com/group/google-appengine/browse_thread/thread/21478bd9185dcc32/f61b532da5c46588?lnk=gstq=index+reads#f61b532da5c46588 http://groups.google.com/group/google-appengine/browse_thread/thread/bdb45e04dd8f959e/0659767c7878bafb?lnk=gstq=index+reads#0659767c7878bafb http://groups.google.com/group/google-appengine/browse_thread/thread/fef4a4c22a50039/4ae7426d4daca9d2?lnk=gstq=index+reads#4ae7426d4daca9d2 So, excessive index reads could be a problem...
[web2py] How to cause radio buttons to auto deselect?
When I create several radio buttons in a web2py form, they do not auto deselect when another is selected. They all stay selected. Do I need to add my own javascript code to do the auto deselect (so that only one radio button at a time stays selected) or does web2py have some support for this behavior?
[web2py] Re: How to cause radio buttons to auto deselect?
Thanks - I had not noticed that fact hidden underneath the ASP.NET controls all these years. On Nov 26, 3:31 pm, Anthony abasta...@gmail.com wrote: More generally, if you give all the radio input elements the same value for the 'name' attribute, the browser will allow only one to be selected at a time. Anthony On Saturday, November 26, 2011 4:25:54 PM UTC-5, Anthony wrote: Have you tried the radio widget -- SQLFORM.widgets.radio.widget (see http://web2py.com/book/default/chapter/07#Widgets). Anthony On Saturday, November 26, 2011 4:00:06 PM UTC-5, dlypka wrote: When I create several radio buttons in a web2py form, they do not auto deselect when another is selected. They all stay selected. Do I need to add my own javascript code to do the auto deselect (so that only one radio button at a time stays selected) or does web2py have some support for this behavior?
[web2py] Re: packaging return from executesql as Rows object?
Why send legacy_db into sql.Rows()? It is not needed for anything at that point. Maybe just send in None or some default as the first arg. On Nov 16, 2:43 pm, David Watson davidthewat...@gmail.com wrote: Does anybody have example code showing how to package the return from executesql as a gluon.sql.Rows object? I have tried: raw_rows = legacy_db.executesql(sqlstr, as_dict=True) from gluon import sql columns = ['col1', 'col2', 'col3'] rowsobj = sql.Rows(legacy_db, raw_rows, columns) table = SQLTABLE(rowsobj) but this blows up in sql.Rows. I'm just looking for a quick and dirty (throw-away) way to do some reports with existing complex SQL queries. Thanks, Dave
[web2py] Re: Unwanted submit on checkbox click ?
maybe ;return false; at the end of _onclick (after the alert). false will indicate that the event did not complete and so Javascript will not post/submit. On Nov 11, 2:54 pm, BrendanC bren...@gmail.com wrote: I'm building a dynamic table with a checkbox in each row with the code below. The table displays correctly and html looks ok. However when I click on any checkbox, the page is being submitted - not sure why. Any suggestions? for item in imgtags: s = [[item.name , 'input id=%s /' %item.name]] chbx = (INPUT( _type='checkbox', _name= 'chk%s' %item.name, _onclick=alert(this.checked))) arr.append ([[item.name],[ chbx]]) return XML(TABLE(*[TR(*r) for r in arr], _id = 'tagtable')) BrendanC
[web2py] Need File Chooser which does NOT upload upon form Submit
Is there a widget / technique in web2py forms to choose a file but not upload it?
[web2py] Re: Need File Chooser which does NOT upload upon form Submit
Parse it on the local machine. On Nov 12, 4:53 pm, Anthony abasta...@gmail.com wrote: What do you want to do with the file? On Saturday, November 12, 2011 5:12:39 PM UTC-5, dlypka wrote: Is there a widget / technique in web2py forms to choose a file but not upload it?
[web2py] Re: Need File Chooser which does NOT upload upon form Submit
This is going into a web2py app which I have running in a major U.S. corporation. So far it has 10 users who depend on it 24x7. It is saving their butts... Many thanks. On Nov 12, 6:33 pm, Anthony abasta...@gmail.com wrote: An input field with type=file will give you the upload widget. Then I suppose you'd need some Javascript to catch the form submission and do something with the file instead of submitting the form to web2py. That would require client-side Javascript and wouldn't depend on web2py. Seehttp://www.html5rocks.com/en/tutorials/file/dndfiles/. Anthony On Saturday, November 12, 2011 6:45:12 PM UTC-5, dlypka wrote: Parse it on the local machine. On Nov 12, 4:53 pm, Anthony abas...@gmail.com wrote: What do you want to do with the file? On Saturday, November 12, 2011 5:12:39 PM UTC-5, dlypka wrote: Is there a widget / technique in web2py forms to choose a file but not upload it?
[web2py] Re: best way to contact a programmer
I am a certified MCSD .NET developer using both ASP.NET 4 and web2py on my current job in a very large company. I consider .NET to be best for 'legacy' .NET designs, and web2py best for green field designs. .NET is fundamentally flawed for web work because it depends on old style compiled dlls. .NET apps are difficult to install on just any windows machine due to both security and licensing issues. So our .NET projects often lose time due to lack of access to a machine that is setup for development of the particular app. With web2py, I can move my app to any machine quickly to continue development. In particular, I can install the development environment on the client's machine and let the client tweak the source code. .NET cannot be put on the client's machine in a lot of cases because the client cannot pay for a VS 2010 license. Bugs are easy to spot in web2py because python is a fraction of the lines of code to scan. Finally, .NET is vendor-designed, not academically designed. If want proper design for your web app, you pretty much have to use web2py. Most of ASP.NET is being replaced by jquery / jquery-ui these days anyway even in .NET web apps. So there is little value in ASP.NET anymore. On Nov 12, 11:03 am, Marin Dodoub marindod...@gmail.com wrote: Dear All, I have a nice project. I have already started to code it. 1) First I would like to make sure that there are no technical limitations to Web2py. For example I have never seen any jQuery multiple autocomplete plug-in implemented in a website powered by Web2py. Why ? Can Web2py really compete with ASP.NET or Ruby on Rails ? 2) Second I am not good enough to write it entirely. Or it would take me too much time. So I would like to contact a programmer. What's the best way to contact a programmer ? Is it through experts4solutions ? 3) Third I don't have too much money ;) So my budget is limited. What's the average price of your last contracts ? Also I don't know if we can make money out of my idea, but I could also give a share in my website... Thanks in advance, Marin
[web2py] Re: gae ReferenceProperty
In the latest dal.py around line 3010 (may float a bit, I am looking at the trunk) if self.dbengine == 'google:datastore' in globals():http:// groups.google.com/group/web2py/browse_thread/thread/ 33b722be4316472a#Change it toif self.dbengine == 'google:datastore':and the exception will go away The issue is that'GoogleDatastoreAdapter' is in globals(), not 'google:datastore'Also 'GQLDB' is in globals() I have been settingdb=DAL('google:datastore') Should it be something else On Nov 3, 9:55 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: I think I just fixed this in trunk, please check. On Nov 3, 9:34 am, Murray3 cjjmur...@gmail.com wrote: I thought this would work with custom SQL Using latest version of web2py in gae interactive console I have for testing purposes: from gluon.contrib.gql import gae from gluon.dal import * db = DAL('gae') db.define_table('Contact', Field('name', 'string')) db.define_table('PhoneNumber', Field('contact', gae.ReferenceProperty()), Field('phone_type', 'string'), Field('number', 'string')) db.Contact.insert(name='Scotty') from google.appengine.api.datastore_types import Key rows = db(db.Contact.name=='Scotty').select() selected_row = rows[0] key = Key.from_path(Contact,selected_row.id) db.PhoneNumber.insert(contact=key, phone_type='home', number='(650) 555 - 2200') db.PhoneNumber.insert(contact=key, phone_type='mobile', number='(650) 555 - 2201') entity_keyselect = db(db.PhoneNumber.contact == key).select() print 'Content-Type: text/html' print for c in entity_keyselect: print '%s: %s' % (c.phone_type, c.number) I get returned error: Traceback (most recent call last): File C:\Python25\google\appengine\ext\admin\__init__.py, line 247, in post exec(compiled_code, globals()) File string, line 21, in module File C:\Python25\content\gluon\dal.py, line 5031, in insert return self._db._adapter.insert(self,self._listify(fields)) File C:\Python25\content\gluon\dal.py, line 3436, in insert dfields=dict((f.name,self.represent(v,f.type)) for f,v in fields) File C:\Python25\content\gluon\dal.py, line 3436, in genexpr dfields=dict((f.name,self.represent(v,f.type)) for f,v in fields) File C:\Python25\content\gluon\dal.py, line 2990, in represent if fieldtype.startswith('list:'): AttributeError: 'ReferenceProperty' object has no attribute 'startswith' Any help Aprreciated Chris
[web2py] Re: gae ReferenceProperty
In the latest dal.py around line 3010 (may float a bit, I am looking at the trunk) if self.dbengine == 'google:datastore' in globals(): Change it to if self.dbengine == 'google:datastore': and the exception will go away The issue is that 'GoogleDatastoreAdapter' is in globals(), not 'google:datastore' Also 'GQLDB' is in globals() I have been settingdb=DAL('google:datastore') Should it be something else
[web2py] Re: Help! import winrandom gives dll load failed error under Apache on Vista, but works under Rocket.
P.S. In this scenario, you have to run web2py with -i 138.85.50.99 -p 8000 for example: python web2py.py -a recycle -i 138.85.50.99 -p 8000 On Oct 10, 6:36 pm, dlypka dly...@gmail.com wrote: Resolved: After researching, I see this problem plagues many other developers as well. The root cause is that the Distribution Windows Build of Apache 2.2 is built with msvcr71.dll which is the C++ runtime dll for Visual Studio 2003!!! But, most recent builds of python .pyd files which link to C/C++ code, are built with msvcr90.dll which is the one from Visual Studio 2008. As a result, Apache chokes with this obscure error (failure to load a dll) whenever a pyd is imported that is built with any C/C+ runtime which is not msvrcr71.dll. If you run httpd.exe from a command prompt, you will get an error popup for Microsoft error R6034. In particular, if you want to used sftp in python on Apache 2.2, you cannot do so using the distributed Windows build of Apache 2.2. However, there are lots of postings showing how to build Apache 2.2 yourself under Visual Studio 2008, so that would be the workaround for running web2py on a Windows platform under Apache 2.2 when you are doing sftp or something using C/C++ code. Seehttp://comments.gmane.org/gmane.comp.apache.devel/43600where it mentions that Apache 2.4 will finally be built with a current Microsoft C++ runtime dll. Another workaround if you do not want to build Apache in VS 2008, is to try to run web2py under IIS. I got it working under IIS 7 on Vista, but yes, it is quite difficult to do even with the easiest of the 3 methods described in the web2py slice about IIS. The easiest method is to use Rocket together with IIS 7, where IIS 7 is used as a proxy for Rocket. Additional steps to take regarding what is mentioned in the slice is to create web application in IIS 7 to serve as a kind of surrogate for the web2py application. Plus the specifics of the routes.py entries and of the .NET URL rewriter file ManagedFusion.Rewriter.txt are pretty much have to discovered by experimentation. Here is what works for my web2py app named 'UETR' on IIS 7: ManagedFusion.Rewriter.txt --- RewriteEngine On RewriteBase / RewriteRule ^(/) http://138.85.50.99:8000/UETR?r=$1[R,NC] c:\web2py\routes.py --- default_application = 'UETR' # ordinarily set in base routes.py default_controller = 'default' # ordinarily set in app-specific routes.py default_function = 'index' # ordinarily set in app-specific routes.py routes_app = ((r'/(?Pappwelcome|admin|uetr)\b.*', r'\gapp'), (r'(.*)', r'UETR'), (r'/?(.*)', r'UETR')) routes_in = ((r'.*:/favicon.ico', r'/examples/static/favicon.ico'), (r'.*:/robots.txt', r'/examples/static/robots.txt'), (r'.*:/LTE1/index', r':8000/UETR/default/ index'), ((r'.*http:/localhost.* (?Pany.*)', r'http://localhost: 8000/UETR/default/index'))) routes_out = ((r'.*http://otherdomain.com.*/app/ctr(?Pany.*)', r'\gany'), (r'/app(?Pany.*)', r'\gany')) -- I created an ASP.NET 4.0 web application on IIS 7 whose Virtual Directory name is 'LTE1' In it, I used the Visual Studio 2010 wizard to create a basic web application (hello world roughly). In that web application I had to modify the web.config as per the documentation for ManagedFusion.Rewriter I also created a 'bin' folder in LTE1 and copied the Managed Fusion dll into into it. The actual content of the .aspx pages in this .NET web app are irrelevant as this app is never rendered. Only its web.config is read and acted upon by Managed Fusion, to cause the request to be passed to the URL where web2py is running on Rocket at port 8000. - Now if I browse tohttp://138.85.50.99/LTE1 It hits IIS 7 and magically reroutes to my UETR web2py app athttp://138.85.50.99:8000/UETR?r=/LTE1 More work is needed to refine it, but the basic functionality is shown. On Oct 6, 9:19 pm,dlypkadly...@gmail.com wrote: My web2py app which uses paramiko sftp, works fine under the Rocket webserver, but fails here when run under the Apache 2.2 webserver, under WINDOWS VISTA Enterprise: • File C:\Python27\lib\site-packages\Crypto\Random\OSRNG\nt.py, line 28 import winrandom -- failing to load some DLL at line 28 -- from rng_base import BaseRNG I imagine it is some kind of permissions problem, maybe with having to load a cryptographic C dll I have already run a Process viewer and cleaned up the PATH to avoid dll search failures. This is a proof of concept app to a major U.S. corporation. They have already seen it work under Rocket and are very
[web2py] Re: SQLFORM.factory does not create the table in db, so how to query results?
Thanks - your reply helped me see how it works. I did not realize that web2py just puts the name of *only* the selected radio button in request.vars. I had been looking for all 3 of my radio buttons, assuming there would be a checked=true attribute on one of them. But instead, just the presence of the radio button name in request.vars after form validation means that is the one that was selected. It seems that the virtual table is mostly for internal use in web2py except its schema might be useful for looping through the list of controls. On Oct 5, 10:11 am, monotasker scotti...@gmail.com wrote: When the form is submitted, each field value is returned as a variable of the response object. So if you give a name to your radio button (foo) then all you have to do is access response.vars.foo to get the value. (I'm assuming that myFieldlist is a collection of field definitions in which you define and name the radio button field)
[web2py] Re: Help! import winrandom gives dll load failed error under Apache on Vista, but works under Rocket.
Resolved: After researching, I see this problem plagues many other developers as well. The root cause is that the Distribution Windows Build of Apache 2.2 is built with msvcr71.dll which is the C++ runtime dll for Visual Studio 2003!!! But, most recent builds of python .pyd files which link to C/C++ code, are built with msvcr90.dll which is the one from Visual Studio 2008. As a result, Apache chokes with this obscure error (failure to load a dll) whenever a pyd is imported that is built with any C/C+ runtime which is not msvrcr71.dll. If you run httpd.exe from a command prompt, you will get an error popup for Microsoft error R6034. In particular, if you want to used sftp in python on Apache 2.2, you cannot do so using the distributed Windows build of Apache 2.2. However, there are lots of postings showing how to build Apache 2.2 yourself under Visual Studio 2008, so that would be the workaround for running web2py on a Windows platform under Apache 2.2 when you are doing sftp or something using C/C++ code. See http://comments.gmane.org/gmane.comp.apache.devel/43600 where it mentions that Apache 2.4 will finally be built with a current Microsoft C++ runtime dll. Another workaround if you do not want to build Apache in VS 2008, is to try to run web2py under IIS. I got it working under IIS 7 on Vista, but yes, it is quite difficult to do even with the easiest of the 3 methods described in the web2py slice about IIS. The easiest method is to use Rocket together with IIS 7, where IIS 7 is used as a proxy for Rocket. Additional steps to take regarding what is mentioned in the slice is to create web application in IIS 7 to serve as a kind of surrogate for the web2py application. Plus the specifics of the routes.py entries and of the .NET URL rewriter file ManagedFusion.Rewriter.txt are pretty much have to discovered by experimentation. Here is what works for my web2py app named 'UETR' on IIS 7: ManagedFusion.Rewriter.txt --- RewriteEngine On RewriteBase / RewriteRule ^(/) http://138.85.50.99:8000/UETR?r=$1 [R,NC] c:\web2py\routes.py --- default_application = 'UETR'# ordinarily set in base routes.py default_controller = 'default' # ordinarily set in app-specific routes.py default_function = 'index' # ordinarily set in app-specific routes.py routes_app = ((r'/(?Pappwelcome|admin|uetr)\b.*', r'\gapp'), (r'(.*)', r'UETR'), (r'/?(.*)', r'UETR')) routes_in = ((r'.*:/favicon.ico', r'/examples/static/favicon.ico'), (r'.*:/robots.txt', r'/examples/static/robots.txt'), (r'.*:/LTE1/index', r':8000/UETR/default/ index'), ((r'.*http:/localhost.* (?Pany.*)', r'http://localhost: 8000/UETR/default/index'))) routes_out = ((r'.*http://otherdomain.com.* /app/ctr(?Pany.*)', r'\gany'), (r'/app(?Pany.*)', r'\gany')) -- I created an ASP.NET 4.0 web application on IIS 7 whose Virtual Directory name is 'LTE1' In it, I used the Visual Studio 2010 wizard to create a basic web application (hello world roughly). In that web application I had to modify the web.config as per the documentation for ManagedFusion.Rewriter I also created a 'bin' folder in LTE1 and copied the Managed Fusion dll into into it. The actual content of the .aspx pages in this .NET web app are irrelevant as this app is never rendered. Only its web.config is read and acted upon by Managed Fusion, to cause the request to be passed to the URL where web2py is running on Rocket at port 8000. - Now if I browse to http://138.85.50.99/LTE1 It hits IIS 7 and magically reroutes to my UETR web2py app at http://138.85.50.99:8000/UETR?r=/LTE1 More work is needed to refine it, but the basic functionality is shown. On Oct 6, 9:19 pm, dlypka dly...@gmail.com wrote: My web2py app which uses paramiko sftp, works fine under the Rocket webserver, but fails here when run under the Apache 2.2 webserver, under WINDOWS VISTA Enterprise: • File C:\Python27\lib\site-packages\Crypto\Random\OSRNG\nt.py, line 28 import winrandom -- failing to load some DLL at line 28 -- from rng_base import BaseRNG I imagine it is some kind of permissions problem, maybe with having to load a cryptographic C dll I have already run a Process viewer and cleaned up the PATH to avoid dll search failures. This is a proof of concept app to a major U.S. corporation. They have already seen it work under Rocket and are very excited to see it deployed under a standard webserver. An alternative is to use IIS7 but the web2py slice I read looked very difficult to follow so I am trying Apache first. We are also running Symantec anti virus (corporate edition) and we are locked out from being able to disable
[web2py] Help! import winrandom gives dll load failed error under Apache on Vista, but works under Rocket.
My web2py app which uses paramiko sftp, works fine under the Rocket webserver, but fails here when run under the Apache 2.2 webserver, under WINDOWS VISTA Enterprise: • File C:\Python27\lib\site-packages\Crypto\Random\OSRNG\nt.py, line 28 import winrandom -- failing to load some DLL at line 28 -- from rng_base import BaseRNG I imagine it is some kind of permissions problem, maybe with having to load a cryptographic C dll I have already run a Process viewer and cleaned up the PATH to avoid dll search failures. This is a proof of concept app to a major U.S. corporation. They have already seen it work under Rocket and are very excited to see it deployed under a standard webserver. An alternative is to use IIS7 but the web2py slice I read looked very difficult to follow so I am trying Apache first. We are also running Symantec anti virus (corporate edition) and we are locked out from being able to disable it. Not sure if antivirus interferes with Apache. We only have this corporate PC to use at the moment. I would appreciate any clues or tips for configuring Apache to load paramiko sftp under Windows. Or links to straight-forward and $free steps for installing web2py under IIS 7 in Vista.
[web2py] SQLFORM.factory does not create the table in db, so how to query results?
form = SQLFORM.factory(*myFieldlist, table_name='OSSListFormTable', submit_button='Submit Query', formname='QueryForm', _method = 'POST') Problem: 'OSSListFormTable' is not registered as a table in the db, so myset = db(myquery) crashes Is this a bug in web2py? OR should 'OSSListFormTable' be created by the application first? If not, how to get the results from the form when the form was created by SQLFORM.factory I am trying find out which radio button was clicked in the SQLFORM.factory form. Please advise. Thanks.
[web2py] successful apache and web2py install on VISTA but what is the final step?
I followed the web2py 3.1 Ed. book chapter for installation on Windows (VISTA Enterprise in my case). web2py and Apache 2.2 now work independently. web2py still just working in its own Rocket server. I made all the changes to C:\Program Files\Apache Software Foundation \Apache2.2\conf\httpd.conf and it works. I create the Self-Signed Certificate and so on as well. Apache seems to not work on Port 80, maybe due to IIS 7 presence though I stopped the IIS7 Service. So in httpd.conf I decided to specify Listen 138.85.50.99:8080 Listen 138.85.50.99:443 ServerName 138.85.50.99:8080 http://127.0.0.1:8080/welcome/default/index (web2py Rocket) http://138.85.50.99:8080/index.html works (Apache) Q: How to get the web2py Welcome app to run under Apache? What URL should be used to run web2py Welcome under Apache??? Is there a .py I have change to point to Apache instead of Rocket? How to I keep web2py running? Does it have to be a Windows Service? or will Apache somehow invoke python web2py.py as needed? ONE Gotcha under VISTA and Windows 7: Not good to install in C: \Program Files because security restrictions prevent the installer from saving changes to any config files it tries to update as part of installation. Needs to go into something like C:\Apache22 for example. Else open up Security Settings for C:\Program Files.
[web2py] Re: successful apache and web2py install on VISTA but what is the final step?
Update: https://138.85.50.99/welcome/default/index works! http://138.85.50.99:8080 works! (Apache index.html) http://138.85.50.99:8080/welcome/default/index does not work. What is the problem? On Oct 1, 5:27 pm, dlypka dly...@gmail.com wrote: I followed the web2py 3.1 Ed. book chapter for installation on Windows (VISTA Enterprise in my case). web2py and Apache 2.2 now work independently. web2py still just working in its own Rocket server. I made all the changes to C:\Program Files\Apache Software Foundation \Apache2.2\conf\httpd.conf and it works. I create the Self-Signed Certificate and so on as well. Apache seems to not work on Port 80, maybe due to IIS 7 presence though I stopped the IIS7 Service. So in httpd.conf I decided to specify Listen 138.85.50.99:8080 Listen 138.85.50.99:443 ServerName 138.85.50.99:8080 http://127.0.0.1:8080/welcome/default/index (web2py Rocket) http://138.85.50.99:8080/index.html works (Apache) Q: How to get the web2py Welcome app to run under Apache? What URL should be used to run web2py Welcome under Apache??? Is there a .py I have change to point to Apache instead of Rocket? How to I keep web2py running? Does it have to be a Windows Service? or will Apache somehow invoke python web2py.py as needed? ONE Gotcha under VISTA and Windows 7: Not good to install in C: \Program Files because security restrictions prevent the installer from saving changes to any config files it tries to update as part of installation. Needs to go into something like C:\Apache22 for example. Else open up Security Settings for C:\Program Files.
[web2py] Re: successful apache and web2py install on VISTA but what is the final step? - Solved
To solve my problem the I could not get NON https to work in web2py with Apache 2.2 On Windows VISTA Enterprise: In httpd.conf, I had to add another Virtual Host entry, copied mostly from the given :443 entry, but for port 8080: NameVirtualHost *:8080 VirtualHost *:8080 : : I had to use port 8080 because for some reason the Apache Service fails to start if I try to use port 80, possibly a conflict with the installation of IIS 7, even though I have set the IIS 7 service to be Disabled. There is also a typo in the web2py book (unwanted quotes around %r) It should be: LogFormat %h %l %u %t %r %s %b common Another Gotcha: web2py book deployment chapter has broken a link to wsgi mod I downloaded mod_wsgi-win32-ap22py27-3.3.so from http://code.google.com/p/modwsgi/wiki/DownloadTheSoftware?tm=2 NOTE This is only for 32 bit python and 32 bit Apache. For 64 bit you must build or pay Instruction for installing mod_wsgi are here http://code.google.com/p/modwsgi/wiki/InstallationOnWindows Also I renamed it to mod_wsgi.so when copying into to Apache2.2/ modules Finally, on Windows Vista, for creating the Self Signed Certificate, I had to use this command: cd C:\Program Files\Apache Software Foundation\Apache2.2\conf openssl req -x509 -nodes -days 365 -newkey sa:2048 -keyout server.key - out server.crt -config C:\Program Files\Apache Software oundation \Apache2.2\conf\openssl.cnf It seems I can use web2py with Rocket to set the Admin Password and after that run in Apache and use that same password. https://138.85.50.99/admin (enter it using password that was first created by running web2py Rocket version) http://138.85.50.99:8080/welcome On Oct 1, 6:25 pm, dlypka dly...@gmail.com wrote: Update:https://138.85.50.99/welcome/default/index works!http://138.85.50.99:8080 works! (Apache index.html)http://138.85.50.99:8080/welcome/default/indexdoes not work. What is the problem? On Oct 1, 5:27 pm, dlypka dly...@gmail.com wrote: I followed the web2py 3.1 Ed. book chapter for installation on Windows (VISTA Enterprise in my case). web2py and Apache 2.2 now work independently. web2py still just working in its own Rocket server. I made all the changes to C:\Program Files\Apache Software Foundation \Apache2.2\conf\httpd.conf and it works. I create the Self-Signed Certificate and so on as well. Apache seems to not work on Port 80, maybe due to IIS 7 presence though I stopped the IIS7 Service. So in httpd.conf I decided to specify Listen 138.85.50.99:8080 Listen 138.85.50.99:443 ServerName 138.85.50.99:8080 http://127.0.0.1:8080/welcome/default/index (web2py Rocket) http://138.85.50.99:8080/index.html works (Apache) Q: How to get the web2py Welcome app to run under Apache? What URL should be used to run web2py Welcome under Apache??? Is there a .py I have change to point to Apache instead of Rocket? How to I keep web2py running? Does it have to be a Windows Service? or will Apache somehow invoke python web2py.py as needed? ONE Gotcha under VISTA and Windows 7: Not good to install in C: \Program Files because security restrictions prevent the installer from saving changes to any config files it tries to update as part of installation. Needs to go into something like C:\Apache22 for example. Else open up Security Settings for C:\Program Files.- Hide quoted text - - Show quoted text -
[web2py] Re: Try Flask in a browser
T3 can do that. On Sep 30, 9:09 pm, Bruno Rocha rochacbr...@gmail.com wrote: On Fri, Sep 30, 2011 at 7:35 PM, Anthony abasta...@gmail.com wrote: We've already gothttp://www.web2py.com/demo_admin/default/site. I wonder if we could enable people to create their own apps and have them live for a day or so (the TryFlask apps last for 12 hours, and can be exported). Anthony I mean having a live web based shell, where people can create mem db = DAL(None) or db = DAL('sqlite://memory') and deal with DAL and web2py helpers API.
[web2py] How to disable escaping in @service
I need something like @service.json(escape=false) in my service: @service.json def mytasks(a, b): R = '{completed_in:0.163,max_id: 112677442623246336,max_id_str:112677442623246336,next_page:? page=2max_id=112677442623246336q=miami...}]' return R The problem for me is that this is returning a string with \ infront of each double quote, which is not what I want. Any suggestions?
[web2py] Re: sqlite OperationalError: database is locked in a cron job
I had this problem when adding the 2nd record to a table using crud and sqlite3. Then I saw this posting http://groups.google.com/group/web2py/browse_thread/thread/ff93d18db6d4ed53/bc1f44c0cc0f50a3?lnk=gstq=database+is+locked#bc1f44c0cc0f50a3 where Massimo suggests trying db.commit() I put a db.commit() call in my controller and it solved the problem. My controller: from gluon import * from gluon.tools import Crud from gluon.globals import * def index(): crud = Crud(globals(), db_invoice) formForInsert = crud.create(db_invoice.customer) formForRead = crud.select(db_invoice.customer) db_invoice.commit() return dict(formForInsert=formForInsert,formForRead=formForRead,customers=plugin_editable_jqgrid(db_invoice.customer)) On May 23, 6:40 am, Michele Comitini michele.comit...@gmail.com wrote: Yes it is a problem with sqlite you have anoter process locking the db. mic 2011/5/23 Pablo Angulo pablo.ang...@uam.es: Hello: I'm working on a cron job that must write to thedatabase: is this allowed? I don't know if the following error is sqlite only: File web2py/gluon/dal.py, line 4487, in insert return self._db._adapter.insert(self,self._listify(fields)) File web2py/gluon/dal.py, line 772, in insert raise e pysqlite2.dbapi2.OperationalError:databaseislocked Regards
[web2py] Re: TypeError: 'module' object is not callable on globals()
Great news. Will upgrade. Thanks! On May 28, 7:40 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: This is fixed in trunk. You cannot do from gluon import * in version before 1.95.1 On May 28, 3:44 pm, dlypka dly...@gmail.com wrote: I am trying to use crud but I get TypeError: 'module' object is not callable when I reference globals() in crud = Crud(globals(), mydb) At the top of my source file I have from gluon import * from gluon.globals import * from gluon.tools import Crud My web2py is Version 1.93.2 (2011-03-04 23:48:59) Any ideas?
[web2py] TypeError: 'module' object is not callable on globals()
I am trying to use crud but I get TypeError: 'module' object is not callable when I reference globals() in crud = Crud(globals(), mydb) At the top of my source file I have from gluon import * from gluon.globals import * from gluon.tools import Crud My web2py is Version 1.93.2 (2011-03-04 23:48:59) Any ideas?
[web2py] Re: Google GAE Task Queue independence
Here is the traceback: Traceback (most recent call last): File c:\Google\AppEngine\esentrnet\gluon\restricted.py, line 188, in restricted exec ccode in environment File c:\Google\AppEngine\esentrnet\applications\init/controllers/ default.py:upbm2gig, line 246, in module File c:\Google\AppEngine\esentrnet\gluon\globals.py, line 95, in lambda self._caller = lambda f: f() File c:\Google\AppEngine\esentrnet\applications\init/controllers/ default.py:upbm2gig, line 93, in upbm2gig File applications\init\modules\controllers\default_module.py, line 1951, in upbm2gig upload_url = blobstore.create_upload_url(URL(r=request,c='default',f='upbm2gig_gaehandler',args=None)) File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\blobstore\blobstore.py, line 192, in create_upload_url _make_sync_call('blobstore', 'CreateUploadURL', request, response) File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\apiproxy_stub_map.py, line 86, in MakeSyncCall return stubmap.MakeSyncCall(service, call, request, response) File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\apiproxy_stub_map.py, line 286, in MakeSyncCall rpc.CheckSuccess() File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\apiproxy_rpc.py, line 149, in _WaitImpl self.request, self.response) File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\apiproxy_stub.py, line 80, in MakeSyncCall method(request, response) File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\blobstore\blobstore_stub.py, line 218, in _Dynamic_CreateUploadURL users.get_current_user()) File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\blobstore\blobstore_stub.py, line 204, in _CreateSession user) File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\blobstore\blobstore_stub.py, line 79, in CreateUploadSession 'state': 'init'}) File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\datastore.py, line 638, in update self.__setitem__(name, value) File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\datastore.py, line 617, in __setitem__ datastore_types.ValidateProperty(name, value) File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\datastore_types.py, line 1323, in ValidateProperty 'Unsupported type for property %s: %s' % (name, v.__class__)) BadValueError: Unsupported type for property success_path: class 'gluon.html.XML' On Mar 12, 1:28 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: I do not think we ever said URL returns a string. We did this change in a way that did not break any example in the book. I will look more carefully at your example and treat it as a web2py bug. I am sure we can make it work. Can you post the complete traceback? Massimo On Mar 12, 11:12 am, Carl Roach m...@carlroach.com wrote: Thanks for the tip - that saves me GAE debugging time - always welcomed. The Web2py guys take backward compatiblilty v. seriously so there must be a reasonable reason for this change. I've searched GoogleGroups but couldn't find past threads but the search isn't great and I turned nothing up. On 12 Mar 2011, at 15:55, dlypka dly...@gmail.com wrote: FYI:I found a *GOTCHA* issue when upgrading to 1.92.3 from 1.77.3 Now you have to use .xml() on the URL() that you send into the GAE API: upload_url = blobstore.create_upload_url(URL(r=request,c='default',f='upbm2gig_gaehandle r',args=None).xml()) # This works upload_url = blobstore.create_upload_url(URL(r=request,c='default',f='upbm2gig_gaehandle r',args=None)) # This crashes It crashes because between 1.77.3 and 1.92.3, a change was made in html.py in the URL() class. Around html.py line 265, they added XML() around the return value. return XML(rewrite.url_out(r or _request, env, application, controller, function, args, other, scheme, host, port)) In 1.77.3 it was formerly: return rewrite.url_out(r or _request, env,) So basically they have changed the signature of the URL() object. Not very backward compatible, I would say... On Mar 12, 12:48 am, Carl Roach m...@carlroach.com wrote: thanks howesc On 11 Mar 2011, at 23:29, howesc how...@umich.edu wrote: i use taskqueue extensively in my GAE apps. i have not wrapped it in a way that it runs in non-gae environment. My usages of the taskqueue are for things that i can't complete in a single 30 second execution time, so i suppose i could put an 'if not GAE run all the processing in one request' type statement. my usual usage pattern (i have a few variations on this, but this is a simple example): def process_lots_of_rows(): from google.appengine.api import taskqueue last_timestamp
[web2py] Re: Google GAE Task Queue independence
FYI:I found a *GOTCHA* issue when upgrading to 1.92.3 from 1.77.3 Now you have to use .xml() on the URL() that you send into the GAE API: upload_url = blobstore.create_upload_url(URL(r=request,c='default',f='upbm2gig_gaehandler',args=None).xml()) # This works upload_url = blobstore.create_upload_url(URL(r=request,c='default',f='upbm2gig_gaehandler',args=None)) # This crashes It crashes because between 1.77.3 and 1.92.3, a change was made in html.py in the URL() class. Around html.py line 265, they added XML() around the return value. return XML(rewrite.url_out(r or _request, env, application, controller, function, args, other, scheme, host, port)) In 1.77.3 it was formerly: return rewrite.url_out(r or _request, env,) So basically they have changed the signature of the URL() object. Not very backward compatible, I would say... On Mar 12, 12:48 am, Carl Roach m...@carlroach.com wrote: thanks howesc On 11 Mar 2011, at 23:29, howesc how...@umich.edu wrote: i use taskqueue extensively in my GAE apps. i have not wrapped it in a way that it runs in non-gae environment. My usages of the taskqueue are for things that i can't complete in a single 30 second execution time, so i suppose i could put an 'if not GAE run all the processing in one request' type statement. my usual usage pattern (i have a few variations on this, but this is a simple example): def process_lots_of_rows(): from google.appengine.api import taskqueue last_timestamp = request.vars.last_timestamp or datetime.datetime(2010,1,1) #reasonable default for my app limit = 100 #get records. use = so i don't miss any, don't use ID as they are not assigned in strictly increasing fashion rows = db(db.record.created_time = last_timestamp).select(orderby=db.end_user.timestamp, limitby=(0,limit)) for r in rows: r.update_record(bob='fred') if len(rows) == limit: #there are probably more to process taskqueue.add(url=URL(r=request)) return dict(message=did some work)
[web2py] Re: XML() object in html.py breaks ajax callback which needs HTML returned.
FYI:I found the solution. It is a *GOTCHA* issue when upgrading to 1.92.3 from 1.77.3 Now you have to use .xml() on the URL() that you send into the GAE API: upload_url = blobstore.create_upload_url(URL(r=request,c='default',f='upbm2gig_gaehandle r',args=None).xml()) # This works upload_url = blobstore.create_upload_url(URL(r=request,c='default',f='upbm2gig_gaehandle r',args=None)) # This crashes It crashes because between 1.77.3 and 1.92.3, a change was made in html.py in the URL() class. Around html.py line 265, they added XML() around the return value. return XML(rewrite.url_out(r or _request, env, application, controller, function, args, other, scheme, host, port)) In 1.77.3 it was formerly: return rewrite.url_out(r or _request, env,) So basically they have changed the signature of the URL() object. On Mar 7, 4:58 pm, dlypka dly...@gmail.com wrote: Ever since web2py 1.91.6 I have had to patch html.py to avoid this exception when my code tries to do an ajax callback to get some HTML: Traceback (most recent call last): File c:\Google\AppEngine\esentrnet\gluon\restricted.py, line 188, in restricted exec ccode in environment File c:\Google\AppEngine\esentrnet\applications\init/controllers/ default.py:upbm2gig, line 238, in module File c:\Google\AppEngine\esentrnet\gluon\globals.py, line 95, in lambda self._caller = lambda f: f() File c:\Google\AppEngine\esentrnet\applications\init/controllers/ default.py:upbm2gig, line 93, in upbm2gig File applications\init\modules\controllers\default_module.py, line 1766, in upbm2gig upload_url = blobstore.create_upload_url(URL(r=request,c='default',f='upbm2gig_gaehandle r',args=None)) File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\blobstore\blobstore.py, line 192, in create_upload_url _make_sync_call('blobstore', 'CreateUploadURL', request, response) File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\apiproxy_stub_map.py, line 86, in MakeSyncCall return stubmap.MakeSyncCall(service, call, request, response) File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\apiproxy_stub_map.py, line 286, in MakeSyncCall rpc.CheckSuccess() File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\apiproxy_rpc.py, line 149, in _WaitImpl self.request, self.response) File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\apiproxy_stub.py, line 80, in MakeSyncCall method(request, response) File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\blobstore\blobstore_stub.py, line 218, in _Dynamic_CreateUploadURL users.get_current_user()) File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\blobstore\blobstore_stub.py, line 204, in _CreateSession user) File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\blobstore\blobstore_stub.py, line 79, in CreateUploadSession 'state': 'init'}) File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\datastore.py, line 638, in update self.__setitem__(name, value) File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\datastore.py, line 617, in __setitem__ datastore_types.ValidateProperty(name, value) File C:\Program Files (x86)\Google\google_appengine\google\appengine \api\datastore_types.py, line 1323, in ValidateProperty 'Unsupported type for property %s: %s' % (name, v.__class__)) BadValueError: Unsupported type for property success_path: class 'gluon.html.XML' CAUSED BY a change in html.py line 265 in 1.92.3 where it does return XML(rewrite.filter_out(url, env, the old web2py code in 1.77.3.does not do this. 1.77.3 does return rewrite.filter_out(url, env) which works for me. My patch is to delete the enclosing XML() expression.
[web2py] Re: some functionality to mix html and {{python expression}} is broken since 1.92.3, even back to 1.91.6
I have now reproduced the issue in a small project. So I will create an incident and attach a zip tomorrow. On Mar 8, 2:33 pm, dlypka dly...@gmail.com wrote: I will try to reduce it to a small example. From the call stack it looks like web2py is confused between python code and html. It seems to be executing the html thinking it is python. On Mar 8, 12:57 pm, pbreit pbreitenb...@gmail.com wrote: We cannot confirm that it is broken unless we are able to re-produce which we are not. We would need a specific code example from you that does not work to have any chance of fixing something that is broken.