[web2py] Slider example
Hello everybody, does anyone have an example on creating a form with sliders. Selecting a value of lets say 1-10. I tried using the example on web2pyslices but can't get it working. Kenneth -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/e88be7ef-62f3-4e40-9aed-fd03433cce88n%40googlegroups.com.
[web2py] Re: What happened to web2pyslices.com
I think this is the same: http://web2pyslices.pythonanywhere.com/home torsdag 18 augusti 2022 kl. 05:10:15 UTC+3 skrev JPlata: > Is there a mirror or archive lying around? > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/5169d9ab-241e-4e2a-92ae-96abbf60b502n%40googlegroups.com.
[web2py] Google Maps API
Hello, has anybody used Google Maps after 2018, looks like you need an api key to use the geocode function. Geocode doesn't seam to be updated for this? Kenneth -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/b7dfb61a-7bcb-4009-be38-af7edf6adcadn%40googlegroups.com.
[web2py] Login via an link/URL
Hi, I tried searching the discussions but could not find anything like this being discussed. I'm looking into having users login into my app via an link/URL they receive via email. They just get an link no separate username and password. When the link is accessed they are logged in normally. The link would look like something like this: my.website.com/longhash4324kljhasdfasd9f87ads Does web2py already contain this function? Kenneth -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/e8102d90-88c8-4a4c-abcb-96ba7aa54cddn%40googlegroups.com.
[web2py] Using the T function
Hello, I have been using the T function on many apps and working great. Now I installed a new server och installed newest web2py (2.20.4) and Python 2.7.17. If I use the {{T('asdasd')}} in a view I can get the languages files to include the new string, so I can't translate the app. I don't rememver having to activate the T-function anywhere. Kenneth -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/74ad75ce-420d-405f-a3b4-0effa220f59bo%40googlegroups.com.
[web2py] Re: Insert not inserting data
Den torsdag 26 april 2018 kl. 17:32:56 UTC+3 skrev Anthony: > > On Thursday, April 26, 2018 at 4:07:31 AM UTC-4, Kenneth wrote: >> >> Hi, >> >> correct, no records 24031-24040. I was thinking that my variables maybe >> would have contained something not acceptable so I changed all variables, >> but still can't insert. >> >> Feels like an roolback, but why earth it would do something like that I >> don't understand. There definitly aren't any roolbacks in the code as I >> didn't know there was anything like that. >> > > How are you running the controller function repeatedly? Are you able to > observe whether each run is generating an exception? Maybe check your MySQL > logs to determine exactly what queries are being issued. > > Anthony > Just accessing the URL runs the controller. Never had to enable MySQL logging and looking at each query to find an problem this before. Very interesting. There really is an Rollback issued when inserting fails. I found out when the Rollback is issued but not yet why. tracker = db.usage_tracker.insert(client = int(user_data.id), product_group = 2, product = int(access_code)) company = db(db.customer_company.id == user_data.cc).select() If user_data.cc is None then an Rollback is issued, any ideas why? If user_data.cc is an value then no Rollback. I can of course beat this with an if None but I don't understand why this happens. Kenneth -- 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: Insert not inserting data
Hi, correct, no records 24031-24040. I was thinking that my variables maybe would have contained something not acceptable so I changed all variables, but still can't insert. Feels like an roolback, but why earth it would do something like that I don't understand. There definitly aren't any roolbacks in the code as I didn't know there was anything like that. Kenneth Den onsdag 25 april 2018 kl. 17:54:07 UTC+3 skrev Anthony: > > On Tuesday, April 24, 2018 at 4:20:18 PM UTC-4, Kenneth wrote: >> >> The function that contains this does a lot of things, but nothing else >> regarding this table. And no values are not hard coded, just trying to find >> out the problem so I made it as simple as possible. >> >> If I look at the table in MySQL prompt is see that highest record ID is >> lets say 24030, I run the controller 10 times and look at the table again, >> still highest record is 24030. If I at this moment insert a record manually >> from MySQL prompt it'll get ID, 24041. >> > > But when you query MySQL (from the prompt or from web2py) there are no > records whose IDs are 24031 through 24040? > > If so, is it possible the inserts made from web2py are being rolled back > (either because an exception is being raised or via an explicit > db.rollback)? In that case, I believe MySQL will increment the IDs even > though the transaction is ultimately rolled back. > > Anthony > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Insert not inserting data
The function that contains this does a lot of things, but nothing else regarding this table. And no values are not hard coded, just trying to find out the problem so I made it as simple as possible. If I look at the table in MySQL prompt is see that highest record ID is lets say 24030, I run the controller 10 times and look at the table again, still highest record is 24030. If I at this moment insert a record manually from MySQL prompt it'll get ID, 24041. Kenneth Den tisdag 24 april 2018 kl. 04:16:34 UTC+3 skrev Anthony: > > Can we get more context? What does the real code look like (I assume you > don't really have a line at the top level of a controller file that inserts > the same hard-coded record on every request to the controller)? How are you > determining that no new records are inserted but the id is > auto-incrementing? > > Anthony > > On Sunday, April 22, 2018 at 6:55:18 PM UTC-4, Kenneth wrote: >> >> Hello, >> >> I can't understand this simple problem. >> >> tracker = db.usage_tracker.insert(client = 6728, product_group = 2, >> product = 15) >> >> nothing appears in the database. ID counter is updated. If I look >> at db._lastsql I get >> >> INSERT INTO usage_tracker(logged_in,product,client,product_group) VALUES >> ('2018-04-23 01:51:34.001992',15,6728,2); >> >> this is in a normal controller. >> >> If I put the same tracker = db.usage_tracker.insert(client = 6728, >> product_group = 2, product = 15) in an own function in controller it works. >> >> >> Kenneth >> >> -- 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: Insert not inserting data
This is in an normal controller, no command line. And still it is not working. Everything around it works. And I can't understand how MySQL ID auto increment is getting higher and higher but no data is entered. Almost like data is inserted but deleted right away. I even tried putting in the db.commit() without success. Kenneth Den måndag 23 april 2018 kl. 19:26:09 UTC+3 skrev Leonel Câmara: > > If you put it into a controller web2py automatically commits the > transaction. If you're doing this from the command line you need to to > db.commit() > -- 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] Insert not inserting data
Hello, I can't understand this simple problem. tracker = db.usage_tracker.insert(client = 6728, product_group = 2, product = 15) nothing appears in the database. ID counter is updated. If I look at db._lastsql I get INSERT INTO usage_tracker(logged_in,product,client,product_group) VALUES ('2018-04-23 01:51:34.001992',15,6728,2); this is in a normal controller. If I put the same tracker = db.usage_tracker.insert(client = 6728, product_group = 2, product = 15) in an own function in controller it works. Kenneth -- 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: Apache + multidomain + SSL
Hi, I have a server running two versions of web2py. The other one runs 4-5 apps on own domains. Every domain will have it's own certificate. I have I one almost running correctly, the app works nicely but you can't open error tickets. But I'm not sure how to add more certificates. Kenneth Den måndag 8 januari 2018 kl. 21:32:02 UTC+2 skrev Richard: > > Hi Kenneth, > > Can you be more precise on your issues... I have upgrade my certificate in > the begining of 2017 and fall on many issues and resolves them... In my > case I was wanting to use one certificate for multiple sub-domains... But I > may help you get out of some pitfall you face. > > Richard > > On Sun, Jan 7, 2018 at 2:40 PM, Massimo Di Pierro <massimo@gmail.com > > wrote: > >> we strongly recommend that you do not use Apache but use nginx. >> >> >> On Thursday, 4 January 2018 01:50:13 UTC-6, Kenneth wrote: >>> >>> Hello, >>> >>> does anybody have experience with setting up Apache with separate >>> certificate for multi domains. I have it working like 95% but something is >>> strange, I can't for example look at errors with this setup. >>> >>> >>> Kenneth >>> >>> -- >> 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] Apache + multidomain + SSL
Hello, does anybody have experience with setting up Apache with separate certificate for multi domains. I have it working like 95% but something is strange, I can't for example look at errors with this setup. Kenneth -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] How do I run the web2py scheduler under the models directory
Hi, I'm trying to set up the web2py scheduler to run an hourly task and put the following code as scheduler.py in the models directory: from gluon.scheduler import Scheduler def log(): logging.warning('is when this event was logged.') import logging logger = logging.getLogger("web2py.app.welcome") logger.setLevel(logging.DEBUG) myscheduler = Scheduler(db,tasks=dict(log=log)) myscheduler.queue_task('log',period=3600,repeats=0,immediate=True) However I find that each time I visit the website, it schedules a new task, resulting in multiple tasks of the same nature (i.e. period=3600, repeats=0). How do I run the set up once so that I will only get a single repeating task queued in the web2py scheduler. Thanks in advance for any help! Cheers, Kenneth -- 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] Upgraded OS, now IS_IN_SET now working
I changed the {} to [] and it seams to be working now. Interesting. Kenneth Den tisdag 4 april 2017 kl. 16:28:49 UTC+3 skrev Kenneth: > > Hi, > > I found a list of packages that was updated yesterday when I updated the > server and python 2.6 was updated to newest 2.6 version, I'm guessing this > is the reason why I'm getting the errors right now. But I don't understand > why I'm getting errors. > > > Kenneth > > > Den tisdag 4 april 2017 kl. 16:09:57 UTC+3 skrev Áureo Dias Neto: >> >> you do not need multiple = True? to use checkboxes >> >> 2017-04-04 10:07 GMT-03:00 Kenneth <kenneth.t...@gmail.com>: >> >>> Hi, >>> >>> everything was wortking yesterday, so IS_IN_SET should be OK. >>> >>> Full traceback is (or do you need anymore of it): >>> >>> Traceback (most recent call last): >>> File "/data/web2py/gluon/restricted.py", line 226, in restricted >>> ccode = compile2(code, layer) >>> File "/data/web2py/gluon/restricted.py", line 209, in compile2 >>> return compile(code.rstrip().replace('\r\n', '\n') + '\n', layer, >>> 'exec') >>> File "/data/web2py/applications/bbfid/controllers/epiauth2.py", line >>> 1186 >>> Field('accept_terms', widget=SQLFORM.widgets.checkboxes.widget, >>> requires=IS_IN_SET({T('Get access')})), >>> >>> >>> ^ >>> SyntaxError: invalid syntax >>> >>> >>> Kenneth >>> >>> Den tisdag 4 april 2017 kl. 15:10:26 UTC+3 skrev Anthony: >>>> >>>> On Tuesday, April 4, 2017 at 7:05:25 AM UTC-4, Áureo Dias Neto wrote: >>>>> >>>>> the correct is: >>>>> >>>>> requires=IS_IN_SET(['Only one option '])) >>>>> >>>>> >>>> IS_IN_SET should be able to take a Python set object rather than a >>>> list, so {} vs. [] shouldn't be the issue. >>>> >>>> Anthony >>>> >>> -- >>> Resources: >>> - http://web2py.com >>> - http://web2py.com/book (Documentation) >>> - http://github.com/web2py/web2py (Source code) >>> - https://code.google.com/p/web2py/issues/list (Report Issues) >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "web2py-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to web2py+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.
Re: [web2py] Upgraded OS, now IS_IN_SET now working
Hi, I found a list of packages that was updated yesterday when I updated the server and python 2.6 was updated to newest 2.6 version, I'm guessing this is the reason why I'm getting the errors right now. But I don't understand why I'm getting errors. Kenneth Den tisdag 4 april 2017 kl. 16:09:57 UTC+3 skrev Áureo Dias Neto: > > you do not need multiple = True? to use checkboxes > > 2017-04-04 10:07 GMT-03:00 Kenneth <kenneth.t...@gmail.com >: > >> Hi, >> >> everything was wortking yesterday, so IS_IN_SET should be OK. >> >> Full traceback is (or do you need anymore of it): >> >> Traceback (most recent call last): >> File "/data/web2py/gluon/restricted.py", line 226, in restricted >> ccode = compile2(code, layer) >> File "/data/web2py/gluon/restricted.py", line 209, in compile2 >> return compile(code.rstrip().replace('\r\n', '\n') + '\n', layer, >> 'exec') >> File "/data/web2py/applications/bbfid/controllers/epiauth2.py", line >> 1186 >> Field('accept_terms', widget=SQLFORM.widgets.checkboxes.widget, >> requires=IS_IN_SET({T('Get access')})), >> >> >> ^ >> SyntaxError: invalid syntax >> >> >> Kenneth >> >> Den tisdag 4 april 2017 kl. 15:10:26 UTC+3 skrev Anthony: >>> >>> On Tuesday, April 4, 2017 at 7:05:25 AM UTC-4, Áureo Dias Neto wrote: >>>> >>>> the correct is: >>>> >>>> requires=IS_IN_SET(['Only one option '])) >>>> >>>> >>> IS_IN_SET should be able to take a Python set object rather than a list, >>> so {} vs. [] shouldn't be the issue. >>> >>> Anthony >>> >> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web2py+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.
Re: [web2py] Upgraded OS, now IS_IN_SET now working
Hi, everything was wortking yesterday, so IS_IN_SET should be OK. Full traceback is (or do you need anymore of it): Traceback (most recent call last): File "/data/web2py/gluon/restricted.py", line 226, in restricted ccode = compile2(code, layer) File "/data/web2py/gluon/restricted.py", line 209, in compile2 return compile(code.rstrip().replace('\r\n', '\n') + '\n', layer, 'exec') File "/data/web2py/applications/bbfid/controllers/epiauth2.py", line 1186 Field('accept_terms', widget=SQLFORM.widgets.checkboxes.widget, requires=IS_IN_SET({T('Get access')})), ^ SyntaxError: invalid syntax Kenneth Den tisdag 4 april 2017 kl. 15:10:26 UTC+3 skrev Anthony: > > On Tuesday, April 4, 2017 at 7:05:25 AM UTC-4, Áureo Dias Neto wrote: >> >> the correct is: >> >> requires=IS_IN_SET(['Only one option '])) >> >> > IS_IN_SET should be able to take a Python set object rather than a list, > so {} vs. [] shouldn't be the issue. > > Anthony > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Upgraded OS, now IS_IN_SET now working
Hi, yesterday I did a yum update on my CentOS server and today I'm getting errors on rows using IS_IN_SET? I'm using Python 2.6 for web2py and that one was not updated. I know a lot was updated but not exactly what, didn't pay much attention to it. If I comment out rows having IS_IN_SET the app works. web2py was neither updated. This is the row that gives error: Field('accept_terms', widget=SQLFORM.widgets.checkboxes.widget, requires=IS_IN_SET({'Only one option '})), And error is: SyntaxError: invalid syntax Anyone had problems like this? Kenneth -- 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] Updating log on mobile device
Hello, I'm working on an app that contains a function where users open a page where a log is shown. The log should be updated all the time when users has it open. Is there a way to updated the log without a need to reload the whole page all the time? Users are using mobile devices like smartphone/pads so loading the whole page feels like a waste of bandwidth. Kenneth -- 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] Do not show None
Hello, I fetch a number on records from the database and show it on the screen. Is there a way to not print the text None for fields that are in the state None. I could use if field != None but I'd rather not use IF if there is an other way. Kenneth -- 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: JS: very small but very useful
Could you provide any cases to use this JS function for? On Friday, May 6, 2016 at 11:26:43 AM UTC-4, Val K wrote: > > Very small py-function that wraps any js-content in anonymous js-function > > def JS_fun(*args_lst): > def _inner(body): > return "(function(%s){ %s ;})" % (','.join(args_lst), body) > return _inner > > > >>> JS_fun( 'a', 'b' )( 'console.log(a,b)' ) > '(function(a,b){ console.log(a, b) ;})' > > > >>> args= ['a', 'b'] > >>> JS_fun(*args)('console.log(%s)' % ','.join(args)) > '(function(a,b){ console.log(a, b) ;})' > > >>> JS_call = lambda f: lambda *args: f + '(%s)' % ','.join([str(a) for a > in args]) > >>> JS_call( JS_fun('a', 'b')('console.log(a,b)') )('"text"', 123 ) > '(function(a,b){ console.log(a,b) ;})("text", 123)' > > > > > another smarter variant: > > def JS_fun(*args_lst): > def _inner(*body): > return "(function(%s){ %s ;})" % (','.join(args_lst), '\n > '.join(body)) > return _inner > > > #so, you can: > f = JS_fun('a', 'b')( >'var sum = a+b;', >'console.log(sum);', >'return sum' > ) > > > > > > > > -- 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: Installing custom modules on a Web2py-friendly VPS (e.g. DigitalOcean, Linode)?
You can treat DigitalOcean or Linode as complete linux server to play around with. You can install any Python modules with PIP install module_name. On Saturday, May 7, 2016 at 11:50:12 AM UTC-4, Marty Jones wrote: > > I know this isn't a Web2py specific question but hope some of you will > have had experience with this. > > I have a Web2py app that relies on a number of 3rd party Python modules > (Selenium, BeautifulSoup, PyVirtualDisplay, and various dependencies). > Before I pay for a VPS, I want to be sure I understand how easy or hard it > is to install these packages. With DigitalOcean, Linode, and the other more > popular options out there, is it pretty easy to install custom packages? > -- 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: Enabling Unicode characters in URL
Quick update By adding "args_match =r'([ㄱ-ㅣ가-힣\w@ -_=])" under BASE= dict(, I was able to read all unicode characters. Hope this Regex is safe to use. On Friday, May 6, 2016 at 3:15:38 AM UTC-4, Niphlod wrote: > > you need to think it through. > web2py's defaults to have /a/c/f with a being your app, c the name of a > controller file and f a valid python function identifier. > > if you want to support /whatever you NEED to use routes.py > > a simple > > > routes_in = ( ('/welcome/static/$anything', '/welcome/static/$anything'), > ('/(?P.*)', '/welcome/default/index/\g'), ) > routes_out = ( ('/welcome/static/$anything', '/welcome/static/$anything'), > ('/welcome/default/index/(?P.*)', '/\g'), ) > > > will route /与 <http://localhost:8080/%E4%B8%8E> to /welcome/default/index/ > 与 <http://localhost:8080/%E4%B8%8E> . request.args won't be usable for > the aforementioned "bug" (or lack of feature), but request.raw_args will be > there for you to parse as you wish > > On Friday, May 6, 2016 at 3:02:02 AM UTC+2, Kenneth wrote: >> >> Just filed an issue. thank you, Leonel. >> >> Is there any interim solution to this problem? >> >> On Wednesday, May 4, 2016 at 2:31:17 PM UTC-4, Leonel Câmara wrote: >>> >>> For functions, specially since in python 2 the identifiers must be >>> ascii. If percent encoded args don't work then that's actually a >>> bug/missing feature of web2py which doesn't unquote args. Please file an >>> issue in github so the devs get properly motivated to close it. In the >>> meantime you will have to use request.vars to put stuff. >>> >> -- 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: Enabling Unicode characters in URL
Thank you, Niphlod. I just had to spin my head for all day today and I figured that - I was using parameter-based routes and didn't know that I had to use pattern-based routes to use routes_in and routes_out. No-mixing two different routes. - I couldn't activate request.raw_args with my parameter-based routes file - I couldn't figure out how to set up languages for pattern-based routes For example, I have this snippet on my parameter-based routes routers = { app: dict( default_language = 'en', languages =['ko'] ) } Is it possible to use request.raw_args with parameter-baed routes file? For now, I will just pause on this issue since I don't think I'd be able to reconfigure all my apps to work properly with patter-based routes. :P Thank you for great replies as always, Niphlod. On Friday, May 6, 2016 at 3:15:38 AM UTC-4, Niphlod wrote: > > you need to think it through. > web2py's defaults to have /a/c/f with a being your app, c the name of a > controller file and f a valid python function identifier. > > if you want to support /whatever you NEED to use routes.py > > a simple > > > routes_in = ( ('/welcome/static/$anything', '/welcome/static/$anything'), > ('/(?P.*)', '/welcome/default/index/\g'), ) > routes_out = ( ('/welcome/static/$anything', '/welcome/static/$anything'), > ('/welcome/default/index/(?P.*)', '/\g'), ) > > > will route /与 <http://localhost:8080/%E4%B8%8E> to /welcome/default/index/ > 与 <http://localhost:8080/%E4%B8%8E> . request.args won't be usable for > the aforementioned "bug" (or lack of feature), but request.raw_args will be > there for you to parse as you wish > > On Friday, May 6, 2016 at 3:02:02 AM UTC+2, Kenneth wrote: >> >> Just filed an issue. thank you, Leonel. >> >> Is there any interim solution to this problem? >> >> On Wednesday, May 4, 2016 at 2:31:17 PM UTC-4, Leonel Câmara wrote: >>> >>> For functions, specially since in python 2 the identifiers must be >>> ascii. If percent encoded args don't work then that's actually a >>> bug/missing feature of web2py which doesn't unquote args. Please file an >>> issue in github so the devs get properly motivated to close it. In the >>> meantime you will have to use request.vars to put stuff. >>> >> -- 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: Enabling Unicode characters in URL
Just filed an issue. thank you, Leonel. Is there any interim solution to this problem? On Wednesday, May 4, 2016 at 2:31:17 PM UTC-4, Leonel Câmara wrote: > > For functions, specially since in python 2 the identifiers must be ascii. > If percent encoded args don't work then that's actually a bug/missing > feature of web2py which doesn't unquote args. Please file an issue in > github so the devs get properly motivated to close it. In the meantime you > will have to use request.vars to put stuff. > -- 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: Enabling Unicode characters in URL
Hi Niphld, Do I need to configure "routes.py" to accept percent-encoded function? is it "args_match" that I need to configure? Just tried to pass encoded string "%ED%95%9C%EA%B8%80" as argument, I am getting "Invalid request". Thank you. On Wednesday, May 4, 2016 at 8:09:22 AM UTC-4, Niphlod wrote: > > BTW: you NEED to get your hands dirty with routes.py because a > percent-encoded fragment won't ever be mapped to a function or a controller. > > On Wednesday, May 4, 2016 at 1:55:53 PM UTC+2, Leonel Câmara wrote: >> >> I don't think that's possible, they need to come pre-encoded, don't worry >> the browser will show the unicode characters in the adress bar and not >> those ugly percents. >> > -- 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: Enabling Unicode characters in URL
Hi Leonel, Thank you for your quick reply. If that is the case, is it possible to encode the unicode URLs right after it hits the server? So, it can be redirected to proper URL after the incoming url is encoded in percent. Best, On Tuesday, May 3, 2016 at 10:15:36 PM UTC-4, Leonel Câmara wrote: > > Unicode characters are not valid in URLs you need to percent encode them. > -- 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] Enabling Unicode characters in URL
Hello there, I'd like to create URLs in unicode characters and I get "Invalid Request" error when I do. I tried to reconfigure on Nginx side but wasn't able to work it properly. For example, this curl call will output "Invalid Request". curl http://localhost:8080/与 Grateful if there is a solution to detect and read URLs in unicode characters. My Web2Py server is currently running Nginx and WSGI. Cheers, -- 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: How to find the entry in a table with the highest ID
Hi Richard, Quick question on your reply, how do you use ** as prefix of form.vars? I've seen it in the book but never knew what it was for. Ken On Saturday, April 16, 2016 at 12:09:39 PM UTC-4, Richard wrote: > > Hello Jack, > > You mean you want to pass the id of the inserted record to another > controller ? > > # Controller form 1 > if form.process(dbio=False).accept: > id = db.table.insert(**forms.vars) > session.last_record_id = id > > In the next controller you can access the id you store in session > # Controller form 2 > session.last_record_id # contains the previous inserted record id > > Watchout as session will keep last_record_id for the during of it... So > you may need to clean it (delete last_record_id from session after second > controller complete process) to make sure you are always refering to the > proper id... > > Richard > > > > On Sat, Apr 16, 2016 at 2:19 AM, Dave S> wrote: > >> >> >> On Friday, April 15, 2016 at 9:53:35 PM UTC-7, Jack Lodge wrote: >>> >>> Im trying to make a Order system for my alevel course work and when im >>> filling in some forms i make a *Request* then i redirect the user to >>> the *Item_Request* form to fill in the details there, i need to be able >>> to get the id of the Request that they just submitted so i can populate the >>> Item_Request Table. >>> >>> I am using Pythonanywhere and web2py >>> >>> how would i do this? >>> >> >> One way would be for the item form to record in the session the id >> returned by its add operation . The order form would then look up that id >> in the session. >> >> /dps >> >> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web2py+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] (Apache + modwsgi) redirect non-www to www using htaccess or virtual directory?
Hello I've been trying to redirect non-www to www using htaccess but I was able to redirect only one domain when there are multiple applications/domains in applications directory. Is there anyone who was able to redirect non-www to www successfully? I wasn't able to find one correct solution from Web2py user group, so I am posting a question here. https://groups.google.com/forum/#!topic/web2py/nFM3PwXC7mM I followed this but it redirected all domains to one domain stated in htaccess. Also, it redirected to '/' main page. Thank you in advance! -- 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: Handling JSON stream
Hi, the whole set is JSON, I can load it with json.loads och access the different fields. But the string inside billing_address is not I think JSON, but does anybody have any ideas what it could be and how to access it. I'd rather not start splitting it up and do a lot of trial and errors. But maybe that is the only way of doing it. Kenneth Den söndag 21 februari 2016 kl. 15:59:23 UTC+2 skrev Val K: > > Maybe I mistake, but JSON means arrays ([1,2, "any string", 5]) , hashes > ({"a":1, "b":"any string"}) and combinations ([{"a": [1,2,3], "b":2 }, 2,3 > ]), > so , "a:7:{..." - isn't JSON > > On Sunday, February 21, 2016 at 2:46:47 PM UTC+3, Kenneth wrote: >> >> Hi, >> >> I don't access to change the webform, so I need to get by what I receive. >> It is a standard webform in Drupal that sends the JSON. >> >> >> Kenneth >> >> >> Den söndag 21 februari 2016 kl. 13:01:40 UTC+2 skrev Val K: >>> >>> How do you serialize form? >>> Jquery.param makes json in extended format by default, try use >>> traditional=true >> >> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Handling JSON stream
Hi, I don't access to change the webform, so I need to get by what I receive. It is a standard webform in Drupal that sends the JSON. Kenneth Den söndag 21 februari 2016 kl. 13:01:40 UTC+2 skrev Val K: > > How do you serialize form? > Jquery.param makes json in extended format by default, try use > traditional=true -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Handling JSON stream
Hello, I have an external webform sending data as a JSON to my web2py app. {"product_package":"basic_m","products":"31349","billing_name":"Kenneth","billing_surname":"Lundstr\u00f6m","e_mail":"kenneth.lundst...@tester.com","billing_organization":"Testing","billing_job_description":"Tester","billing_address":"a:7:{s:12:\"thoroughfare\";s:18:\"Teststreet 5\";s:7:\"premise\";s:0:\"\";s:11:\"postal_code\";s:5:\"12\";s:18:\"dependent_locality\";s:0:\"\";s:8:\"locality\";s:5:\"Test city\";s:19:\"administrative_area\";s:0:\"\";s:7:\"country\";s:2:\"NO\";}","company_business_id":"123456789","billing_phone":"123456789","billing_mobile":"","delivery_checkbox":"","delivery_name":"","delivery_surname":"","delivery_organization":"","delivery_address":"N;","terms__conditions":"agree"} If I use json.loads I can access all the different data without any problem, except the billing_address fields. "billing_address":"a:7:{s:12:\"thoroughfare\";s:18:\"Teststreet 5\";s:7:\"premise\";s:0:\"\";s:11:\"postal_code\";s:5:\"12\";s:18:\"dependent_locality\";s:0:\"\";s:8:\"locality\";s:5:\"Test city\";s:19:\"administrative_area\";s:0:\"\";s:7:\"country\";s:2:\"NO\";}" How would you split this into useable parts. I'd like to get my hands on the different fields inside billing_address. Kenneth -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] How to move a set of view,edit,delete buttons from last column to first column on SQLgrid?
Hello, Lately, I've started playing with sqlgrid since it saves so much time pulling out all data in a page. The problem is that I have a table with 20 attirbutes saved in it, it's hard to scroll to the end of right side and click on view/edit buttons. Is there any way to move those buttons to first column? I don't know if it's possible without editing SQLgrid library code. 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: how does search work on sql grid? (search over a whole table instead of a field)
Hi Anthony, Thank you for your reply as always. I believe the forwarded post is about how to show only a search option for searching throught a whole table. so unfortunately that post doesn't answer my question. Do you know how the search works behind of sql grid form? Thank you. On Sunday, May 10, 2015 at 12:55:30 AM UTC-4, Anthony wrote: See https://groups.google.com/d/msg/web2py/WvGH9XAH160/TjzYVCDBzQ0J Anthony On Saturday, May 9, 2015 at 9:57:03 PM UTC-4, Kenneth wrote: I am curious how I can implement the search widget used on sql grid. It seems to me that sql grid searche widget searches a keword over a whole table and show the result. Can anyone tell me how to create a search widget to search a keyword on a table instead of selecting fields? 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: how does search work on sql grid? (search over a whole table instead of a field)
Hope this clarifies my question. Basically I have 5 fields (last_name, middle_name, first_name, mother_full_name, father_full_name) in a table called names, When I search a keyword john, I would like to search it on a whole table. For example, is there any way to just do db(db.names.contains(%john%)) and it gives a list of rows with a searched keyword stored in it instead of doing this == db((db.names.last_name.contains(%john%)(db.names.first_name.contains(%john%)(db.names.mother_full_name.contains(%john%))) Thank you. On Sunday, May 10, 2015 at 11:15:21 PM UTC-4, Anthony wrote: Sorry, you said you want to search a keyword on a table instead of selecting fields? Perhaps you can clarify what you are trying to achieve. Anthony On Sunday, May 10, 2015 at 11:07:49 PM UTC-4, Kenneth wrote: Hi Anthony, Thank you for your reply as always. I believe the forwarded post is about how to show only a search option for searching throught a whole table. so unfortunately that post doesn't answer my question. Do you know how the search works behind of sql grid form? Thank you. On Sunday, May 10, 2015 at 12:55:30 AM UTC-4, Anthony wrote: See https://groups.google.com/d/msg/web2py/WvGH9XAH160/TjzYVCDBzQ0J Anthony On Saturday, May 9, 2015 at 9:57:03 PM UTC-4, Kenneth wrote: I am curious how I can implement the search widget used on sql grid. It seems to me that sql grid searche widget searches a keword over a whole table and show the result. Can anyone tell me how to create a search widget to search a keyword on a table instead of selecting fields? 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: Prince - Print Python Html to PDF
You can check out this post. https://groups.google.com/forum/?fromgroups#!topic/web2py/B21c-PgscJg On Monday, April 20, 2015 at 3:52:10 PM UTC-4, Ovidio Marinho wrote: Has anyone tried to use it with web2py? http://www.princexml.com/doc/9.0/python/ [image: http://itjp.net.br] http://itjp.net.br http://itjp.net.b http://itjp.net.brr *Ovidio Marinho Falcao Neto* ovid...@gmail.com javascript: Brasil -- 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: Tutorial: Populating a Handsontable Grid using web2py
Look great, Tom. Thank you for sharing. I wonder what we can implement with this instead of CRUD. On Thursday, April 9, 2015 at 11:49:02 PM UTC-4, Tom Campbell wrote: Niphlod helped me with some crucial code getting Handsontable to work with web2py so I wrote this: web2py Handsontable tutorial #1: Populating a Handsontable grid using web2py http://www.pyguy.com/web2py/web2py-handsontable-tutorial-1-populating-a-handsontable-grid-using-web2py/. It also shows a typical use of Crud. Please tear it apart and let me know where I screwed up. -- 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: instagram login
This is what I've added on db.py. Hope this helps. == from instagram.client import InstagramAPI access_token = access_token client_secret= client_secret client_id = client_id redirect_uri = redirect_uri auth = Auth(db) auth_table = db.define_table( auth.settings.table_user_name, Field('fullname', 'string', default=), Field('first_name', length=128,default=''), Field('last_name', length=128,default=''), Field('email', length=128,default=''), Field('username', 'string', unique=True), Field('user_bio', 'text', default=), Field('website', 'string', default=), Field('profile_picture', 'string', default=), Field('instagram_id', 'string', unique=True), Field('password', 'password', length=256, readable=False, label='Password'), Field('access_token','string'), Field('registration_id', length=128, default= , writable=False, readable=False)) auth_table.username.requires = IS_NOT_IN_DB(db, auth_table.username) auth.define_tables() class InstagramOauth(): def login_url(self, next=/): from instagram import client instagram_client = client.InstagramAPI(client_id= client_id, client_secret=client_secret, redirect_uri=redirect_uri) return instagram_client.get_authorize_url(scope=[likes,comments]) def get_user(self): from instagram import client instagram_client = client.InstagramAPI(client_id= client_id, client_secret=client_secret, redirect_uri=redirect_uri) if request.vars.code: code = request.vars.code access_token, instagram_user = instagram_client.exchange_code_for_access_token(code) return dict(username = instagram_user['username'],instagram_id = instagram_user['id'],user_bio=instagram_user['bio'],website = instagram_user['website'],profile_picture = instagram_user['profile_picture'],full_name=instagram_user['full_name'],registration_id = instagram_user['id'],access_token=access_token) auth.settings.login_form = InstagramOauth() On Sunday, April 19, 2015 at 6:44:40 PM UTC-4, www.diazluis.com wrote: greetings, one could publish the adapted code to login on instagram? try to, but I overcame :( I do not have the ability to adapt oauth20_account.py to work with it: from instagram.client import InstagramAPI instagram_api = InstagramAPI(client_id=CLIENT_ID, client_secret=CLIENT_SECRET, redirect_uri=REDIRECT_URI) auth.settings.login_url = instagram_api.get_authorize_login_url(scope = 'basic') instagram_code = request.vars.code or None if instagram_code: instagram_token, user_info = instagram_api.exchange_code_for_access_token(code) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] how does search work on sql grid? (search over a whole table instead of a field)
I am curious how I can implement the search widget used on sql grid. It seems to me that sql grid searche widget searches a keword over a whole table and show the result. Can anyone tell me how to create a search widget to search a keyword on a table instead of selecting fields? 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] Search in web2py book case sensitive
Hello, is the search function in web2py Book supposed to be case sensitive? I went to the online book and typed sqlform in the search field. Was a little bit surprised when I got: No results for sqlform Searching for SQLFORM works. Kenneth -- 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] .decode('utf-8') on a string containg €
Hello, is there a way to do a decode('utf-8') on a string containg for example the € sign? Kenneth -- 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] Different template in the same PDF file
Hi, I have built an PDF report using the Template of pyfpdf, but I have done it a stupid way. The problem is that I need different templates on every page. This is not directly a web2py questions, but maybe somebody might have an idea how to use different Templates on different pages when creating PDF:s with pyfpdf. Kenneth -- 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 CAS for non web2py apps
Hi, after reading the web2py book and some testing it starts to look like this is not possible. The Drupal installation will be on a different server Kenneth Den torsdag 26 februari 2015 kl. 11:15:58 UTC+2 skrev Kenneth: Hello, I'm trying to get an Drupal with the Drupal CAS module to authenticate against an web2py app. When I test to go with browser to the user/cas/login adress on my site I get the following message: not authorized Can anyone explain how to get this working? How do I return some user parameters to Drupal? Kenneth -- 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] Using CAS for non web2py apps
Hello, I'm trying to get an Drupal with the Drupal CAS module to authenticate against an web2py app. When I test to go with browser to the user/cas/login adress on my site I get the following message: not authorized Can anyone explain how to get this working? How do I return some user parameters to Drupal? Kenneth -- 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: Integrating web2py and a CMS
Hi, finally getting around doing this. I have a Drupal site with a CAS module installed. Anyone done this before? Kenneth Den lördag 15 januari 2011 kl. 17:49:46 UTC+2 skrev Massimo Di Pierro: It can. http://web2py.com/cas On Jan 15, 9:13 am, David Bain pigeonfli...@gmail.com wrote: I believe web2py can act as a CAS authentication server. If you CMS does CAS then you're good. Maybe an easier place to start is to figure what CMSes out there can authenticate against CAS. 2011/1/15 Kenneth Lundström kenneth.t.lundst...@gmail.com I was thinking about using web2py as the authentication platform as it holds the members database. Or then a LDAP that gets it information from members database. The intranet will hold a lot of information that should be visible on the website via the CMS. Either lots of small info (names, telephone numbers) or maybe whole pages. Could iframe be a way of displaying data from web2y on a webpage? Kenneth This kind of information is often stored in a corporate directory using something called LDAP. I am not sure of the size of your company but it sounds like it is large enough to consider this solution. There is OpenLDAP on Linux or Active Directory on Microsoft which perform this task as concrete examples of product. The web2py server has a contrib module for using LDAP authentication which is documented in the manual. Check if your CMS is capable of this as well. The web2py server has a very diverse set of authentication mechanisms such as SMTP server login etc. This would get you username and password in one location but not a hierarchy or org chart. Since the choice of CMS is unknown at this point it is difficult to tell if it is open enough to be able to refer to tables in the web2py portion of the infrastructure. A couple of ideas, Ron -- 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: Not in touch with web2py community for a while. anything new interesting?
I think PyNuke is the latest CMS based on Web2py. On Tuesday, December 2, 2014 1:07:48 PM UTC-5, Phyo Arkar wrote: Being busy and i lost touch with w2p community for a while. What are the new features of web2py? What are the most actively maintainted web2py community projects ? (Plug-ins?, CMS ? , Blogs?) We are planning to build a community platform , with some blog features and comment system. So , is there any plugin for that now? or we need to develop from scratch? Past 2 years I've been building SIngle page , Desktop APPs using web2py + qooxdoo. So my team is missing a bit on normal Web things. 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] Re: Apsis Pro
Hello, do you mean using Apsis Pro? I have now idea, just integrating it, someobody else pays for it :=) Kenneth Den fredagen den 10:e oktober 2014 kl. 01:25:52 UTC+3 skrev Carlos Zenteno: Looks good! Can you tell us more or less how much it cost? -- 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] Apsis Pro
Hello, has anybody used Apsis Pro mailinglist/newsletter API integration with web2py. I'm trying to get started but running into all kinds of problems. Kenneth -- 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: Can't retrieve a picture for download function
2.5.1-stable Den onsdagen den 1:e oktober 2014 kl. 12:54:51 UTC+3 skrev Leonel Câmara: This error should never happen since that filename matches REGEX_UPLOAD_PATTERN, what version of web2py are you using? -- 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: Can't retrieve a picture for download function
Hi, yes I use this function: def makeThumbnail(dbtable,ImageID,size=(150,150)): try: thisImage=db(dbtable.id==ImageID).select()[0] import os, uuid from PIL import Image except: return if thisImage.image == : return im=Image.open(request.folder + 'uploads/' + thisImage.image) im.thumbnail(size,Image.ANTIALIAS) thumbName='product.image.%s.jpg' % (uuid.uuid4()) im.save(request.folder + 'uploads/' + thumbName,'jpeg') thisImage.update_record(thumbnail=thumbName) return Den onsdagen den 1:e oktober 2014 kl. 21:53:53 UTC+3 skrev Anthony: Looks like something is wrong with the filename. It should be of the form: [tablename].[fieldname].[first 16 characters of UUID].[b16encoded original filename].[extension] Instead, it looks like it includes a full (non-truncated) UUID and no b16encoded filename. Was the file originally stored via a custom_store method? Anthony On Wednesday, October 1, 2014 12:27:46 AM UTC-4, Kenneth wrote: Hello, TAG.img(_height=50, _src=URL(r=request, c='default', f='download', args=[value])) gives me: type 'exceptions.TypeError' Can't retrieve product.image.4dfd23fe-ba46-43a0-9def-6bdbc929a68c.jpg This has worked before, the problem is that I have no idea when this has stopped working, migth be years. The product.image.4dfd23fe file does exist in uploads folder. Kenneth -- 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't retrieve a picture for download function
Hello, TAG.img(_height=50, _src=URL(r=request, c='default', f='download', args=[value])) gives me: type 'exceptions.TypeError' Can't retrieve product.image.4dfd23fe-ba46-43a0-9def-6bdbc929a68c.jpg This has worked before, the problem is that I have no idea when this has stopped working, migth be years. The product.image.4dfd23fe file does exist in uploads folder. Kenneth -- 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] Login restricted based on subscription
Hello everyone, I'm building a site that clients subscribes to so I need to limit their login based on the subscription. Is there a built in feature to limit login to a date range? Kenneth -- 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] Need to have def 4() and def dir() to 301 redirect. Is it possible?
I would like to redirect these two links: www.mydomain.com/4 and www.mydomain.com/dir for fixing backlinks I previously had for SEO purpose. I've tried to redirect from the controller but it didn't work. -- def 4(): redirect('/',301) def dir(): redirect('/',301) -- Obviously this is not possible since dir is a reserved keyword and 4 is integer. Anyway to redirect these two? 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.
Re: [web2py] Do not mask password field
Thank you Marin, that did it. Rob, the form is for creating new users and client complains about not seeing the password. Kenneth Den lördagen den 14:e juni 2014 kl. 01:31:15 UTC+3 skrev Marin Pranjić: Can you try if this works? db.auth_user.password.type = 'string' On Sat, Jun 14, 2014 at 12:26 AM, Dave S snide...@gmail.com javascript: wrote: On Friday, June 13, 2014 2:09:59 PM UTC-7, Robert O'Connor wrote: You could do it via js likely...but better question is why do you want this? --Rob Sent from my phone...excuse any typos please! Well, that there points to one reason ;-) (It's not unusual for mobile apps to briefly show the last character entered before the masking character covers it.) /dps -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+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] orderby / case
Hi, I have a table that contains 5 items. Usually I order them by product name. Now I'd like to order them so a specific ID is first and then the rest. As everything else is ready I'm looking into making the SQL query do the ordering. I found a posting ( https://groups.google.com/forum/?fromgroups#!searchin/web2py/orderby$20$20case/web2py/B9iM-r1rV0A/jPMBmoSv2kgJ ) where CASE was used with orderby but I just couldn't understand how to get it working. Is this the way or is there an other way to do this? Kenneth -- 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: orderby / case
Hi, is it possible to merge two resultssets so I have only one resultssets. That way I would only need to add an extra query. Kenneth Den lördagen den 14:e juni 2014 kl. 16:53:09 UTC+3 skrev Niphlod: there's no simple way to do it. I'd suggest you fetch the first record, then every other record (ordered as you like) and then merge the resultsets. On Saturday, June 14, 2014 8:39:32 AM UTC+2, Kenneth wrote: Hi, I have a table that contains 5 items. Usually I order them by product name. Now I'd like to order them so a specific ID is first and then the rest. As everything else is ready I'm looking into making the SQL query do the ordering. I found a posting ( https://groups.google.com/forum/?fromgroups#!searchin/web2py/orderby$20$20case/web2py/B9iM-r1rV0A/jPMBmoSv2kgJ ) where CASE was used with orderby but I just couldn't understand how to get it working. Is this the way or is there an other way to do this? Kenneth -- 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] Do not mask password field
Hello, I'm pretty sure this is a stupid question but I just can't get it working. I have created a form to edit a user in auth_user, so one field is password. Is it possible in controller disable the masking of the values in the password, when entering a new password? Kenneth -- 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] I am using Haystack module created by Massimo, does it support insertorupdate?
I see that it updates indexes when it updates,deletes or insert. Does it refresh indexes when I use insertorupdate on DAL? 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] Fill out a webform and process the result
Hello, I'd like to make a form in web2py that asks one string. This string is sent to another webform on another server. That webpage searches its database and returns the same page but with an link to an info page about the string. The page I'd like to process and use that info to fill out my database. The form code is: form method=post action=yrityshaku.aspx?path=1547%3b1631%3b1678amp;kielikoodi=1 view-source:http://www.ytj.fi/yrityshaku.aspx?path=1547%3b1631%3b1678kielikoodi=1 language=javascript onkeypress=javascript:return WebForm_FireDefaultButton(event, 'ContentPlaceHolder_Hae') id=_ctl0 Any ideas where to start? Kenneth -- 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] T when sending email
Hello, I'm trying to send email that is made from about 6-7 T('texts'). But newlines are not inserted into the emails. How should I do that? Kenneth -- 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: T when sending email
Hello, text send.mail() Kenneth what format are you sending the emails ? text or html ? What's the used function to send the emails ? On Wednesday, April 16, 2014 2:20:02 PM UTC+2, Kenneth wrote: Hello, I'm trying to send email that is made from about 6-7 T('texts'). But newlines are not inserted into the emails. How should I do that? Kenneth -- 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] Multiple domains, one app
Hello, is it possible to build an app that handle multiple domains but totally different layouts. I'm thinking something like this: views/domain1/layout.html default/index.html .. views/domain2/layout.html default/index.html ... I made an table called site that contains domainname and domain_url and by matching domainname and request.env.host_name I get an domain_url from database. In every .html I have changed the {{extend layout.html}} to {{extend domain_url + layout.html}} The same can be done for static folder. I'm I doing this too complicated? Kenneth -- 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: Multiple domains, one app
One row is missing in my message: response.view= domain_url + request.controller + '/' + request.function + '.html' I have it in models/db.py so it reflects on all controllers. Kenneth Den söndagen den 6:e april 2014 kl. 09:56:38 UTC+3 skrev Kenneth: Hello, is it possible to build an app that handle multiple domains but totally different layouts. I'm thinking something like this: views/domain1/layout.html default/index.html .. views/domain2/layout.html default/index.html ... I made an table called site that contains domainname and domain_url and by matching domainname and request.env.host_name I get an domain_url from database. In every .html I have changed the {{extend layout.html}} to {{extend domain_url + layout.html}} The same can be done for static folder. I'm I doing this too complicated? Kenneth -- 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] I tried to implment Redis-queue by going over Bruno's slice and it is giving me an error.
I went over http://www.web2pyslices.com/slice/show/1579/web2py-and-redis-queue and seems like it's giving me an error when I tried to dequeue all the tasks which are sending emails --- 23:06:12 UnpickleError: (*'Could not unpickle.', ImportError('No module named gluon.tools',))* Traceback (most recent call last): File /usr/local/lib/python2.7/dist-packages/rq/worker.py, line 311, in work result = self.dequeue_job_and_maintain_ttl(timeout) File /usr/local/lib/python2.7/dist-packages/rq/worker.py, line 346, in dequeue_job_and_maintain_ttl connection=self.connection) File /usr/local/lib/python2.7/dist-packages/rq/queue.py, line 292, in dequeue_any raise e UnpickleError: ('Could not unpickle.', ImportError('No module named gluon.tools',)) - I assume that RQ is not detecting gluon.tools. are there any working example to try? 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] Restricted access based on IP to video files
Hello, I'm trying to built an system to be able to grant access to a bunch on video files based on IP-address. The idea is to have an unique URL for every video but depending on what IP range the viewer is connecting from he will get access to just some of the videos. No username or password will be used. What built in videoplayers are you using to show videos? Kenneth -- 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] iframe without iframe
Hello, is there a way of integration data from an web2py site into an other sites. Like many integrates Tvitter Tweedk onto theur website. I't like to use web2py to create a small page that is shown on another website, like iframe but without iframes. Any ideas for this? Kenneth -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Load content from a text file
Hello, only one max two clients at a time will access this page. I don't even see why two clients would be accesing this page if not a supervisor wants to check on the progress of an worker. Jim, not quite sure how to do what you suggest. The serial communication is using an special protocol that the app reads and creates an text file from. The app stores also everything in the database but I thought it would be more efficient for this page to get the info from an text file. There will be many other pages that will be using mobile jquery with an normal menu that reads data from the database, but this one special page will be just a blank page showing the content of the file if I can't find out how to reload just the part of the page that shows the text file. Was thinking using PHP to show that page. Kenneth Now many clients need to access this at one time? The issue is the workload on the pi. On Friday, 16 August 2013 17:40:29 UTC-5, Kenneth wrote: Hello everyone, I'm planing on running web2py on an Raspberry Pi. On the computer there will also be an app that listens on the serial port and writes the results into an text file. I'd like to create an extremly simple page where only the content of the file is shown and having the page to reload like once every second. This page will be shown from mobile ones or tablets over GPRS or 3G. Is it possible to create an page so every reload doesn't re-execute the controller and models just re-reads the text file and shows it. To controll that app I'd like to sends commands by writing them into an text file that the app reads. This shouldn't be too hard? Kenneth -- --- 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. -- --- 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] Load content from a text file
Hello everyone, I'm planing on running web2py on an Raspberry Pi. On the computer there will also be an app that listens on the serial port and writes the results into an text file. I'd like to create an extremly simple page where only the content of the file is shown and having the page to reload like once every second. This page will be shown from mobile ones or tablets over GPRS or 3G. Is it possible to create an page so every reload doesn't re-execute the controller and models just re-reads the text file and shows it. To controll that app I'd like to sends commands by writing them into an text file that the app reads. This shouldn't be too hard? Kenneth -- --- 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] I just fresh installed web2py on ubuntu 12.04, cannot find modules?
This seems odd to me. I just moved my server and ran the ubuntu script to install web2py I cannot import simplejson for some reason. (I ran it on python -S web2py.py as well) anyone had this problem before? Let me know! Otherwise, I have to import directly from gluon. -- --- 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: I just fresh installed web2py on ubuntu 12.04, cannot find modules?
My ubuntu is Ubuntu 12.04 X64 Server On Thursday, May 2, 2013 8:08:31 PM UTC-5, Kenneth wrote: This seems odd to me. I just moved my server and ran the ubuntu script to install web2py I cannot import simplejson for some reason. (I ran it on python -S web2py.py as well) anyone had this problem before? Let me know! Otherwise, I have to import directly from gluon. -- --- 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: I just fresh installed web2py on ubuntu 12.04, cannot find modules?
Ubuntue is 12.04 64bit server, fresh installed. This is what I received after import simplejson web2py™Version 2.4.6-stable+timestamp.2013.04.06.17.37.38PythonPython 2.7.3: /usr/bin/python (prefix: /usr)Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/www-data/web2py/applications/welcome/controllers/default.py https://www.thme.com/admin/default/edit/welcome/controllers/default.py, line 78, in module File /home/www-data/web2py/gluon/globals.py, line 194, in lambda self._caller = lambda f: f() File /home/www-data/web2py/applications/welcome/controllers/default.py https://www.thme.com/admin/default/edit/welcome/controllers/default.py, line 22, in index import simplejson File /home/www-data/web2py/gluon/custom_import.py, line 81, in custom_importer raise ImportError, 'Cannot import module %s' % str(e) ImportError: Cannot import module 'simplejson' On Thursday, May 2, 2013 8:08:31 PM UTC-5, Kenneth wrote: This seems odd to me. I just moved my server and ran the ubuntu script to install web2py I cannot import simplejson for some reason. (I ran it on python -S web2py.py as well) anyone had this problem before? Let me know! Otherwise, I have to import directly from gluon. -- --- 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: Webfaction account with multiple apps under 1 web2py install
I am using the routers.domains method to routing the applications to domains, I have a problem that I can access to the applications which are not routed to the assigned domain. for example routers = dict( BASE = dict( domains = { 'domain1.com' : 'app1', 'domain2.com' : 'app2', } ), ) domain2.com still has the access to app1. Should I just block the applications when users request the unassigned applications from the controller? Thank you On Wednesday, February 1, 2012 4:14:05 PM UTC-6, Jim S wrote: Hi I've got a couple different apps I want to deploy under my web2py instance on webfaction. Unfortunately, I'm well versed in routing and knowing how to route different requests to different apps. I have different urls that I'd like mapped to different apps. www.application1.com I would like to point to web2py/applications/application1 www.application2.com I would like to point to web2py/applications/application2 And, if possible, I prefer to not show the application name in the url - www.application1.com/application1/controller/function Controller and function are fine but would prefer to eliminate the duplicate application1. If there is a spot in the manual I should study harder, please reference it. Unfortunately, I'm relatively weak when it comes to url rewriting/routing and regular expressions. -Jim -- --- 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: Webfaction account with multiple apps under 1 web2py install
Yeah. I follow the same pattern. Could you try to browse www.domain1.com/app2 to see if it doesn't direct to app2? Mine does. hmm On Wednesday, May 1, 2013 8:48:31 AM UTC-5, Loïc wrote: Did you restart your webserver / reload routes? I use a similar routes.py for multiple domains and it works fine. Maybe you could try : routers = dict( BASE = dict( domains = { 'www.domain1.com' : 'app1', 'domain1.com' : 'app1', 'www.domain2.com' : 'app2', 'domain2.com' : 'app2', }, applications=['app1', 'app2'] ), ) Le mercredi 1 mai 2013 14:54:34 UTC+2, Kenneth a écrit : I am using the routers.domains method to routing the applications to domains, I have a problem that I can access to the applications which are not routed to the assigned domain. for example routers = dict( BASE = dict( domains = { 'domain1.com' : 'app1', 'domain2.com' : 'app2', } ), ) domain2.com still has the access to app1. Should I just block the applications when users request the unassigned applications from the controller? Thank you On Wednesday, February 1, 2012 4:14:05 PM UTC-6, Jim S wrote: Hi I've got a couple different apps I want to deploy under my web2py instance on webfaction. Unfortunately, I'm well versed in routing and knowing how to route different requests to different apps. I have different urls that I'd like mapped to different apps. www.application1.com I would like to point to web2py/applications/application1 www.application2.com I would like to point to web2py/applications/application2 And, if possible, I prefer to not show the application name in the url - www.application1.com/application1/controller/function Controller and function are fine but would prefer to eliminate the duplicate application1. If there is a spot in the manual I should study harder, please reference it. Unfortunately, I'm relatively weak when it comes to url rewriting/routing and regular expressions. -Jim -- --- 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: Webfaction account with multiple apps under 1 web2py install
:) Thank you for trying, Loic! Should I just ignore this concern? I am not too concerned about this but I would like to learn about how to solve this problem. On Wednesday, May 1, 2013 8:59:41 AM UTC-5, Loïc wrote: You're right. On my webserver : www.domain1.com redirects to app1 == OK www.domain2.com redirects to app2 == OK *but* www.domain1.com/app2 redirects to app2, and I don't understand why... Le mercredi 1 mai 2013 15:54:08 UTC+2, Kenneth a écrit : Yeah. I follow the same pattern. Could you try to browse www.domain1.com/app2 to see if it doesn't direct to app2? Mine does. hmm On Wednesday, May 1, 2013 8:48:31 AM UTC-5, Loïc wrote: Did you restart your webserver / reload routes? I use a similar routes.py for multiple domains and it works fine. Maybe you could try : routers = dict( BASE = dict( domains = { 'www.domain1.com' : 'app1', 'domain1.com' : 'app1', 'www.domain2.com' : 'app2', 'domain2.com' : 'app2', }, applications=['app1', 'app2'] ), ) Le mercredi 1 mai 2013 14:54:34 UTC+2, Kenneth a écrit : I am using the routers.domains method to routing the applications to domains, I have a problem that I can access to the applications which are not routed to the assigned domain. for example routers = dict( BASE = dict( domains = { 'domain1.com' : 'app1', 'domain2.com' : 'app2', } ), ) domain2.com still has the access to app1. Should I just block the applications when users request the unassigned applications from the controller? Thank you On Wednesday, February 1, 2012 4:14:05 PM UTC-6, Jim S wrote: Hi I've got a couple different apps I want to deploy under my web2py instance on webfaction. Unfortunately, I'm well versed in routing and knowing how to route different requests to different apps. I have different urls that I'd like mapped to different apps. www.application1.com I would like to point to web2py/applications/application1 www.application2.com I would like to point to web2py/applications/application2 And, if possible, I prefer to not show the application name in the url - www.application1.com/application1/controller/function Controller and function are fine but would prefer to eliminate the duplicate application1. If there is a spot in the manual I should study harder, please reference it. Unfortunately, I'm relatively weak when it comes to url rewriting/routing and regular expressions. -Jim -- --- 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: Webfaction account with multiple apps under 1 web2py install
+1 !! On Wednesday, May 1, 2013 11:37:20 AM UTC-5, Loïc wrote: I would like to understand too... Maybe somebody else has an idea ? -- --- 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: Upgrading to 2.4.2. breaks virtual field
Nobody has any pointers how to fix this? I'm using powertable plugin in my app and if possible don't want to replace it right now. Kenneth Den lördagen den 9:e mars 2013 kl. 21:11:20 UTC+2 skrev Kenneth: Hi, anybody have any ideas where to start solving this? Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. Traceback (most recent call last): File /gluon/restricted.py, line 212, in restricted exec ccode in environment File /applications/economy/controllers/receipt.py https://economy.nudata.fi/admin/edit/economy/controllers/receipt.py, line 705, in module File /gluon/globals.py, line 193, in lambda self._caller = lambda f: f() File /gluon/tools.py, line 2942, in f return action(*a, **b) File /applications/economy/controllers/receipt.py https://economy.nudata.fi/admin/edit/economy/controllers/receipt.py, line 439, in show_receipts return dict(table=powerTable.create()) File /applications/economy/models/plugin_powertable.py https://economy.nudata.fi/admin/edit/economy/models/plugin_powertable.py, line 704, in plugin_powertable PowerTable(), File /applications/economy/models/plugin_powertable.py https://economy.nudata.fi/admin/edit/economy/models/plugin_powertable.py, line 178, in __init__ headers[c] = sqlrows.db[t][f].label File /gluon/dal.py, line 7758, in __getitem__ return self.__getattr__(str(key)) File /gluon/dal.py, line 7765, in __getattr__ return ogetattr(self, key) AttributeError: 'DAL' object has no attribute 'virtual' Error snapshot [image: help] https://economy.nudata.fi/admin/default/ticket/economy/100.100.0.177.2013-03-09.20-47-03.16e5aa6e-7d39-4ad0-8977-ab55a40202ff# type 'exceptions.AttributeError'('DAL' object has no attribute 'virtual') Den tisdagen den 5:e mars 2013 kl. 20:47:19 UTC+2 skrev Kenneth: Hi, I usually find what row causes the problem but not in this case. I'm using the plugin_PowerGrid. Anyone using PowerGrid with the new web2py version? Kenneth maybe showing what line of your code raised the Exception will help... On Tuesday, March 5, 2013 5:51:57 PM UTC+1, Kenneth wrote: Hi, I upgraded my production server to 2.4.2. yesterday.I thought everything was looking good until I just got: Error ticket File /data/domains/web2py/gluon/dal.py, line 7765, in __getattr__ return ogetattr(self, key) AttributeError: 'DAL' object has no attribute 'virtual' Is this easy to fix? Kenneth -- --- 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: Upgrading to 2.4.2. breaks virtual field
Hello, have tested 2.4.2., 2.4.5 and today 2.4.6 and still receiving the same error. Kenneth you're still using 2.4.2 or upgraded to 2.4.6? There were some changes, including bug fixes from one to another... 2013/4/8 Kenneth kenneth.t.lundst...@gmail.com mailto:kenneth.t.lundst...@gmail.com Nobody has any pointers how to fix this? I'm using powertable plugin in my app and if possible don't want to replace it right now. Kenneth Den lördagen den 9:e mars 2013 kl. 21:11:20 UTC+2 skrev Kenneth: Hi, anybody have any ideas where to start solving this? Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. Traceback(most recent call last): File/gluon/restricted.py,line212,inrestricted execccodeinenvironment File/applications/economy/controllers/receipt.py https://economy.nudata.fi/admin/edit/economy/controllers/receipt.py,line705,inmodule File/gluon/globals.py,line193,inlambda self._caller=lambdaf:f() File/gluon/tools.py,line2942,inf returnaction(*a, **b) File/applications/economy/controllers/receipt.py https://economy.nudata.fi/admin/edit/economy/controllers/receipt.py,line439,inshow_receipts returndict(table=powerTable.create()) File/applications/economy/models/plugin_powertable.py https://economy.nudata.fi/admin/edit/economy/models/plugin_powertable.py,line704,inplugin_powertable PowerTable(), File/applications/economy/models/plugin_powertable.py https://economy.nudata.fi/admin/edit/economy/models/plugin_powertable.py,line178,in__init__ headers[c] =sqlrows.db[t][f].label File/gluon/dal.py,line7758,in__getitem__ return self.__getattr__(str(key)) File/gluon/dal.py,line7765,in__getattr__ returnogetattr(self,key) AttributeError:'DAL'object has no attribute'virtual' Error snapshot help https://economy.nudata.fi/admin/default/ticket/economy/100.100.0.177.2013-03-09.20-47-03.16e5aa6e-7d39-4ad0-8977-ab55a40202ff# |type 'exceptions.AttributeError'('DAL' object has no attribute 'virtual')| || | | Den tisdagen den 5:e mars 2013 kl. 20:47:19 UTC+2 skrev Kenneth: Hi, I usually find what row causes the problem but not in this case. I'm using the plugin_PowerGrid. Anyone using PowerGrid with the new web2py version? Kenneth maybe showing what line of your code raised the Exception will help... On Tuesday, March 5, 2013 5:51:57 PM UTC+1, Kenneth wrote: Hi, I upgraded my production server to 2.4.2. yesterday.I thought everything was looking good until I just got: Error ticket File/data/domains/web2py/gluon/dal.py,line7765,in__getattr__ returnogetattr(self,key) AttributeError:'DAL'object has no attribute'virtual' Is this easy to fix? Kenneth -- --- 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 mailto:web2py%2bunsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- []'s Marco Tulio -- --- 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. -- --- 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: Problems after upgrading from 1.98 to 2.42
Hello, upgrading didn't in this case, still getting the same error. Kenneth Den tisdagen den 19:e mars 2013 kl. 04:11:59 UTC skrev Massimo Di Pierro: Please try 2.4.5. Let us know if this is not fixed alreday. On Monday, 18 March 2013 19:42:38 UTC-5, Kenneth wrote: Hello, I'm getting: type 'exceptions.AttributeError' 'Row' object has no attribute 'copy' Version web2py™ (2, 4, 2, 'stable', datetime.datetime(2013, 3, 4, 3, 26, 21)) Python Python 2.6.5: /usr/bin/python (prefix: /usr) Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. Traceback (most recent call last): File /data/domains/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /data/domains/web2py/applications/x/controllers/billing.py https://www.phvk.fi/admin/edit/phvk/controllers/billing.py, line 873, in module File /data/domains/web2py/gluon/globals.py, line 193, in lambda self._caller = lambda f: f() File /data/domains/web2py/gluon/tools.py, line 2942, in f return action(*a, **b) File /data/domains/web2py/applications/x/controllers/billing.py https://www.phvk.fi/admin/edit/phvk/controllers/billing.py, line 779, in show_pdf_bill return f.render('invoice.pdf', dest='S') File /data/domains/web2py/gluon/contrib/pyfpdf/template.py, line 101, in render element = element.copy() AttributeError: 'Row' object has no attribute 'copy' Error snapshot [image: help] https://www.phvk.fi/admin/default/ticket/phvk/217.152.236.190.2013-03-18.15-47-53.11d8d47e-f481-432b-92b2-532afef1692c# type 'exceptions.AttributeError'('Row' object has no attribute 'copy') Where should I start looking for the error? Kenneth -- --- 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] Problems after upgrading from 1.98 to 2.42
Hello, I'm getting: type 'exceptions.AttributeError' 'Row' object has no attribute 'copy' Version web2py™ (2, 4, 2, 'stable', datetime.datetime(2013, 3, 4, 3, 26, 21)) Python Python 2.6.5: /usr/bin/python (prefix: /usr) Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. Traceback (most recent call last): File /data/domains/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /data/domains/web2py/applications/x/controllers/billing.py https://www.phvk.fi/admin/edit/phvk/controllers/billing.py, line 873, in module File /data/domains/web2py/gluon/globals.py, line 193, in lambda self._caller = lambda f: f() File /data/domains/web2py/gluon/tools.py, line 2942, in f return action(*a, **b) File /data/domains/web2py/applications/x/controllers/billing.py https://www.phvk.fi/admin/edit/phvk/controllers/billing.py, line 779, in show_pdf_bill return f.render('invoice.pdf', dest='S') File /data/domains/web2py/gluon/contrib/pyfpdf/template.py, line 101, in render element = element.copy() AttributeError: 'Row' object has no attribute 'copy' Error snapshot [image: help] https://www.phvk.fi/admin/default/ticket/phvk/217.152.236.190.2013-03-18.15-47-53.11d8d47e-f481-432b-92b2-532afef1692c# type 'exceptions.AttributeError'('Row' object has no attribute 'copy') Where should I start looking for the error? Kenneth -- --- 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: Upgrading to 2.4.2. breaks virtual field
Hi, anybody have any ideas where to start solving this? Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. Traceback (most recent call last): File /gluon/restricted.py, line 212, in restricted exec ccode in environment File /applications/economy/controllers/receipt.py https://economy.nudata.fi/admin/edit/economy/controllers/receipt.py, line 705, in module File /gluon/globals.py, line 193, in lambda self._caller = lambda f: f() File /gluon/tools.py, line 2942, in f return action(*a, **b) File /applications/economy/controllers/receipt.py https://economy.nudata.fi/admin/edit/economy/controllers/receipt.py, line 439, in show_receipts return dict(table=powerTable.create()) File /applications/economy/models/plugin_powertable.py https://economy.nudata.fi/admin/edit/economy/models/plugin_powertable.py, line 704, in plugin_powertable PowerTable(), File /applications/economy/models/plugin_powertable.py https://economy.nudata.fi/admin/edit/economy/models/plugin_powertable.py, line 178, in __init__ headers[c] = sqlrows.db[t][f].label File /gluon/dal.py, line 7758, in __getitem__ return self.__getattr__(str(key)) File /gluon/dal.py, line 7765, in __getattr__ return ogetattr(self, key) AttributeError: 'DAL' object has no attribute 'virtual' Error snapshot [image: help] https://economy.nudata.fi/admin/default/ticket/economy/100.100.0.177.2013-03-09.20-47-03.16e5aa6e-7d39-4ad0-8977-ab55a40202ff# type 'exceptions.AttributeError'('DAL' object has no attribute 'virtual') Den tisdagen den 5:e mars 2013 kl. 20:47:19 UTC+2 skrev Kenneth: Hi, I usually find what row causes the problem but not in this case. I'm using the plugin_PowerGrid. Anyone using PowerGrid with the new web2py version? Kenneth maybe showing what line of your code raised the Exception will help... On Tuesday, March 5, 2013 5:51:57 PM UTC+1, Kenneth wrote: Hi, I upgraded my production server to 2.4.2. yesterday.I thought everything was looking good until I just got: Error ticket File /data/domains/web2py/gluon/dal.py, line 7765, in __getattr__ return ogetattr(self, key) AttributeError: 'DAL' object has no attribute 'virtual' Is this easy to fix? Kenneth -- --- 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] Upgrading to 2.4.2. breaks virtual field
Hi, I upgraded my production server to 2.4.2. yesterday.I thought everything was looking good until I just got: Error ticket File /data/domains/web2py/gluon/dal.py, line 7765, in __getattr__ return ogetattr(self, key) AttributeError: 'DAL' object has no attribute 'virtual' Is this easy to fix? Kenneth -- --- 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: Upgrading to 2.4.2. breaks virtual field
Hi, I usually find what row causes the problem but not in this case. I'm using the plugin_PowerGrid. Anyone using PowerGrid with the new web2py version? Kenneth maybe showing what line of your code raised the Exception will help... On Tuesday, March 5, 2013 5:51:57 PM UTC+1, Kenneth wrote: Hi, I upgraded my production server to 2.4.2. yesterday.I thought everything was looking good until I just got: Error ticket File /data/domains/web2py/gluon/dal.py, line 7765, in __getattr__ return ogetattr(self, key) AttributeError: 'DAL' object has no attribute 'virtual' Is this easy to fix? Kenneth -- --- 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] DAL/SQL question
Hi, I have a feeling this is quite easy to do but can't find an elegant way of doing it. I'm building a book application for an client, the book has chapters and articels in it. Every book has an editor and every articel has a writer and cowriter. There will be maybe 20 books. Every editor and writer will be inserted into auth_user and will have permission to edit their own articels, so that the editor can edit all articels in his/hers book. Now I'd like to find all articels belonging to a person either via direct ownership of articels or via bookownership. I can find all books belonging to the person and then all articels that way. But finding all other articels will also contain all articels in bookownership. books = db(t.book.f_editor = auth.user['id']).select() articels = db(t.article.f_writer = auth.user['id']) (t.articel.f_book == not in books).select() How is this written in DAL? Kenneth -- --- 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] Keeping track of changes
Hi, more questions on my book application. There is let's say 20 books, all containing about 10 chapters and then maybe 5 articels per chapter. Every article is its own item in a table. When everything is ready all articles are looked and published. When it is time to upgrade the articles I'm planing on making new copies of them articles in the database and use that one when the upgraded book is released. How would you do keep track of changes in the edited article? All changes needs to be moved into the printed version. Kenneth -- --- 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] DAL/SQL question number 2
Hi, how do you orderby and groupby with two fields? I have a table with these fields: chapter, page and version. I'd like to find all items that are unique based on chapter and page and has the highest version number. Kenneth -- --- 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] Changing reference definition in models files does not update MySQL database
Hi, I defined an table in models with an field with type reference db.t_abc later I changed the models file so that type is reference db.t_def I reloaded the page and everything seams to be fine but now when using the app I noticed that MySQL's table definition is not updated. What would be the correct way of doing this? The app is still in development so database is quite empty. So no problem to loose the connection between the tables. Kenneth -- --- 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] PDF as an background when using pyfPdf
Hello, does anyone know if it is possible to use an PDF as an background when creating PDFs with pyfpdf? Kenneth -- --- 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] Removing HTML TAGS
Hello, def parser(): from gluon.html import web2pyHTMLParser from gluon.sanitizer import sanitize folder = os.path.join(request.folder,'static') file = os.path.join(folder,'MYY.03.02.5.1.asp') source = open(file) html = source.read() tree=web2pyHTMLParser(html).tree elements=tree.elements(_class=BODYCONTENT)[1] return XML(TAG(elements[9])) if I try it like that I get a ticket: AttributeError: '__tag__' object has no attribute 'decode' if I put only: return XML(elements[9]) I get the text I want but with a couple of HTML tags that I'd wasning on using TAG to remove them. div class=bba name=92912Tässä artikkelissa käydään läpi tulevaisuuden sosiologisia /atrendejä. Os...sista./div I'd like to the ridden of div claas and a name Any ideas? Kenneth -- --- 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] Removing HTML TAGS
Thank both Bruno and Michele. I just tried you second suggestion Michele but still got an ticket. But by changing places of str and TAG and adding flatten() I got what I wanted. XML(TAG(str(elements[9])).flatten()) Kenneth use beatifulsoup a one stop shop for html mangling http://www.crummy.com/software/BeautifulSoup/ or try this: XML(str(TAG(elements[9])) mic 2013/2/18 Bruno Rocha rocha...@gmail.com javascript:: http://stackoverflow.com/questions/9662346/python-code-to-remove-html-tags-from-a-string -- --- 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.
Re: [web2py] Re: Book app
Thank you. Kenneth https://github.com/mdipierro/web2py-book On Friday, 8 February 2013 23:51:57 UTC-6, Kenneth wrote: Hello, is the web2py online book app available as an appliance? I'd like to take a look for example on the database setup. Kenneth -- --- 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. -- --- 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: Auth with Wordpress
Yes, that could be the solution. Atleast as this only a temporary (I really, really hope so) way of doing this. Thank you. Kenneth I guess you could have wordpress set a cookie of some sort if they have access, and then use that cookie in web2py to control access. On Thursday, February 7, 2013 11:13:41 AM UTC-7, Kenneth wrote: Hi Michael, Am I understanding you solution completly wrong but isn't it so that web2py asks WP if a username and password compination is OK. In my case customer first logs into a WP site, he gets a list of manuals he has paid for. When selecting a manual he wants to read he is sent to a web2py site. Somehow WP has to tell web2py that it is OK to show the site for the user. Kenneth Hello Kenneth, But how do I handle that WP takes care of authentication and somehow gives the customer rights to view the manual. I had a similar problem. I added an XMLRPC method to my wordpress instance to check if a given username/password combination is valid and added an auth method to my web2py instance which calls that XMLRPC method. Wordpress Code: | # custom remote auth add_filter('xmlrpc_methods','my_add_xml_rpc_methods'); functionmy_add_xml_rpc_methods($methods ){ $methods['mh.testCredentials']='test_credentials'; return$methods; } functiontest_credentials($params ){ global$wp_xmlrpc_server; $blog_id =(int)$params[0];// not used, but follow in the form of the wordpress built in XML-RPC actions $username =$params[1]; $password =$params[2]; $args =$params[3]; // verify credentials if(!$wp_xmlrpc_server-login($username,$password )){ returnFalse; } do_action('xmlrpc_call','mh.testCredentials');// patterned on the core XML-RPC actions // return success returnTrue; } | This is one of the tutorials I used when coming up with this: http://www.foxrunsoftware.net/articles/wordpress/extending-the-wordpress-xml-rpc-api/ http://www.foxrunsoftware.net/articles/wordpress/extending-the-wordpress-xml-rpc-api/ Now the web2py part - copy to ./gluon/contrib/login_methods/my_auth.py | fromwordpress_xmlrpc importClient fromwordpress_xmlrpc importAuthenticatedMethod fromwordpress_xmlrpc importInvalidCredentialsError classGetUserInfo(AuthenticatedMethod): method_name =mh.testCredentials defmy_auth(server): to use basic login with a different server from gluon.contrib.login_methods.basic_auth import basic_auth auth.settings.login_methods.append(basic_auth('http://server http://server')) defbasic_login_aux(username, password,server=server): wp =Client(server,username,password) retVal =None try: retVal =wp.call(GetUserInfo()) exceptInvalidCredentialsError: returnFalse returnretVal returnbasic_login_aux | Now, where you configure your auth module, add this: | fromgluon.contrib.login_methods.my_auth importmy_auth auth.settings.login_methods=[my_auth(http://mywordpress/xmlrpc.php; http://mywordpress/xmlrpc.php)]# smart people use https auth.settings.actions_disabled.append('register') | -- --- 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 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. -- --- 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] Book app
Hello, is the web2py online book app available as an appliance? I'd like to take a look for example on the database setup. Kenneth -- --- 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: Auth with Wordpress
Hi Michael, Am I understanding you solution completly wrong but isn't it so that web2py asks WP if a username and password compination is OK. In my case customer first logs into a WP site, he gets a list of manuals he has paid for. When selecting a manual he wants to read he is sent to a web2py site. Somehow WP has to tell web2py that it is OK to show the site for the user. Kenneth Hello Kenneth, But how do I handle that WP takes care of authentication and somehow gives the customer rights to view the manual. I had a similar problem. I added an XMLRPC method to my wordpress instance to check if a given username/password combination is valid and added an auth method to my web2py instance which calls that XMLRPC method. Wordpress Code: | # custom remote auth add_filter('xmlrpc_methods','my_add_xml_rpc_methods'); functionmy_add_xml_rpc_methods($methods ){ $methods['mh.testCredentials']='test_credentials'; return$methods; } functiontest_credentials($params ){ global$wp_xmlrpc_server; $blog_id =(int)$params[0];// not used, but follow in the form of the wordpress built in XML-RPC actions $username =$params[1]; $password =$params[2]; $args =$params[3]; // verify credentials if(!$wp_xmlrpc_server-login($username,$password )){ returnFalse; } do_action('xmlrpc_call','mh.testCredentials');// patterned on the core XML-RPC actions // return success returnTrue; } | This is one of the tutorials I used when coming up with this: http://www.foxrunsoftware.net/articles/wordpress/extending-the-wordpress-xml-rpc-api/ Now the web2py part - copy to ./gluon/contrib/login_methods/my_auth.py | fromwordpress_xmlrpc importClient fromwordpress_xmlrpc importAuthenticatedMethod fromwordpress_xmlrpc importInvalidCredentialsError classGetUserInfo(AuthenticatedMethod): method_name =mh.testCredentials defmy_auth(server): to use basic login with a different server from gluon.contrib.login_methods.basic_auth import basic_auth auth.settings.login_methods.append(basic_auth('http://server')) defbasic_login_aux(username, password,server=server): wp =Client(server,username,password) retVal =None try: retVal =wp.call(GetUserInfo()) exceptInvalidCredentialsError: returnFalse returnretVal returnbasic_login_aux | Now, where you configure your auth module, add this: | fromgluon.contrib.login_methods.my_auth importmy_auth auth.settings.login_methods=[my_auth(http://mywordpress/xmlrpc.php;)]# smart people use https auth.settings.actions_disabled.append('register') | -- --- 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. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Auth with Wordpress
Hello, I have a case where an old site is done with Wordpress as front and authentication from an external database. Showing of content is then handled with somekind of XML viewer. Site contains 12 manuals. Manual 13 is done with web2py and the idea is to though out the very old Wordpress and XML viewer and handle everything from web2py. But due to time constraints we need to have every as it is now and only show the new manual from web2py. But how do I handle that WP takes care of authentication and somehow gives the customer rights to view the manual. Any ideas how to do this? Kenneth -- --- 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: webgrid and row_created
Hi, anybody have any ideas? tablerow.components.insert(2, TD(IMG(_src=URL('static', 'delete-article.png'), _onclick=confirmation(rowdata.asset_id), _width=15))) Kenneth Den måndagen den 17:e december 2012 kl. 00:40:10 UTC+2 skrev Kenneth: Hello, I'm using webgrid in an application and I'm trying to insert an delete image into the table to shows all rows in an table. When clicking on the delete image I want an onclick event to trigger a Javascript that confirms and deletes that row. To do that I need the rownumber. Looks like this: def controller that uses webgrid(): grid.row_created = add_add_serial_link def add_add_serial_link(tablerow,rowtype,rowdata): if rowtype == 'datarow': tablerow.components.insert(2, TD(IMG(_src=URL('static', 'delete-article.png'), _onclick=confirmation(rowdata.asset_id), _width=15))) How do I write that _onclick so that the asset_id is sent to the confirmation Javascript? If I write _onclick='confirmation(rowdata.asset_id)' Javascript gets the text rowdata.asset_id and not the ID I'm tryin to send to it. Kenneth --
Re: [web2py] Re: webgrid and row_created
Hi Adi, very many thanks. That was exactly what I was looking for. Kenneth this is how i use onclick for confirmation purpose in a grid: | lambdarow:A('Copy', _class='btn', _onclick='return confirm(Duplicate %s?)'%row.po_number, _href=URL('duplicate_po',args=[row.id])), | On Monday, December 17, 2012 2:46:59 PM UTC-5, Kenneth wrote: Hi, anybody have any ideas? tablerow.components.insert(2, TD(IMG(_src=URL('static', 'delete-article.png'), _onclick=confirmation(rowdata.asset_id), _width=15))) Kenneth Den måndagen den 17:e december 2012 kl. 00:40:10 UTC+2 skrev Kenneth: Hello, I'm using webgrid in an application and I'm trying to insert an delete image into the table to shows all rows in an table. When clicking on the delete image I want an onclick event to trigger a Javascript that confirms and deletes that row. To do that I need the rownumber. Looks like this: def controller that uses webgrid(): grid.row_created = add_add_serial_link def add_add_serial_link(tablerow,rowtype,rowdata): if rowtype == 'datarow': tablerow.components.insert(2, TD(IMG(_src=URL('static', 'delete-article.png'), _onclick=confirmation(rowdata.asset_id), _width=15))) How do I write that _onclick so that the asset_id is sent to the confirmation Javascript? If I write _onclick='confirmation(rowdata.asset_id)' Javascript gets the text rowdata.asset_id and not the ID I'm tryin to send to it. Kenneth -- --
[web2py] webgrid and row_created
Hello, I'm using webgrid in an application and I'm trying to insert an delete image into the table to shows all rows in an table. When clicking on the delete image I want an onclick event to trigger a Javascript that confirms and deletes that row. To do that I need the rownumber. Looks like this: def controller that uses webgrid(): grid.row_created = add_add_serial_link def add_add_serial_link(tablerow,rowtype,rowdata): if rowtype == 'datarow': tablerow.components.insert(2, TD(IMG(_src=URL('static', 'delete-article.png'), _onclick=confirmation(rowdata.asset_id), _width=15))) How do I write that _onclick so that the asset_id is sent to the confirmation Javascript? If I write _onclick='confirmation(rowdata.asset_id)' Javascript gets the text rowdata.asset_id and not the ID I'm tryin to send to it. Kenneth --
[web2py] Re: onaccept in CRUD
Hi, yes still open. Attached what you requested, hopefully. Kenneth def data(): new = 0 serials = db(db.asset_serial.asset_id == request.args(2)).select() crud.settings.create_onaccept = insert_serial crud.settings.create_next = URL('index',vars=session.http_get_vars,args=session.http_args) crud.settings.update_onaccept = update_assets crud.settings.update_next = URL('index',vars=session.http_get_vars,args=session.http_args) crud.settings.delete_next = URL('index',vars=session.http_get_vars,args=session.http_args) crud.settings.delete_onvalidation = delete_serials #return db._lastsql db.assets.asset_label.requires = IS_NOT_IN_DB(db, 'assets.asset_label') db.assets.asset_start_date.requires = IS_NOT_EMPTY() db.assets.asset_name.requires = IS_EMPTY_OR(IS_IN_DB(db, 'assets.asset_name', groupby=db.assets.asset_name)) db.assets.asset_parent.requires = IS_EMPTY_OR(IS_IN_DB(db((db.assets.asset_id.belongs([r.asset_parent for r in db(db.assets.asset_parent != None).select(db.assets.asset_parent, groupby=db.assets.asset_parent)])) or (db.assets.asset_ form = crud() form[0][0][1].append(INPUT(_type='text', _id=assets_asset_name_2, _name='asset_name_2', _width=3)) form[0][5][1].append(INPUT(_type='text', _id=assets_asset_parent_2, _name='asset_parent_2', _width=3)) if request.args(0) == 'create': types = db(db.asset_serial).select(db.asset_serial.asset_serial_type, groupby=db.asset_serial.asset_serial_type) form[0][8].insert(0,TR(TD(LABEL('Serial number type:')), TD(SELECT(*[type.asset_serial_type for type in db(db.asset_serial).select(groupby=db.asset_serial.asset_serial_type)], _name='serial_number_type'), INPUT(_type='text',_nam form[0][8].insert(0,TR(TD(LABEL('Serial number:')), TD(INPUT(_type='text',_name='serial_number' new = 1 return dict(form=form, serials=serials, new = new) def update_assets(form): if form.request_vars.asset_name_2 != '': row = db(db.assets.asset_id == form.vars.id).update(asset_name = form.request_vars.asset_name_2) if form.request_vars.asset_parent_2 != '': row = db(db.assets.asset_id == form.vars.id).select().first() if len(db(db.assets.asset_id == form.request_vars.asset_parent_2).select()): row.update_record(asset_parent = form.request_vars.asset_parent_2) db.define_table('assets', Field('asset_id', type='id'), Field('asset_name', type='string'), Field('asset_description', type='string'), Field('asset_label', type='string'), Field('asset_type_id', 'reference ref_asset_type'), Field('asset_category_id', 'reference ref_asset_category'), Field('asset_parent', 'integer'), Field('asset_start_date', type='datetime'), Field('asset_end_date', type='datetime'), Field('update_time', type='datetime',writable=False,readable=False), Field('update_user', type='string',writable=False,readable=False, update=auth.user_id), format='%(asset_label)s',) Den torsdagen den 13:e december 2012 kl. 05:02:33 UTC+2 skrev Massimo Di Pierro: Is this still an open issue? If so can you post your model and the complete action? On Sunday, 9 December 2012 17:02:13 UTC-6, Kenneth wrote: Hi, I converted the problematic row ( row = db(db.assets.asset_id == form.vars.id).update(asset_name = form.request_vars.asset_name_2) ) into normal SQL and used it on the database directly, works fine. I made a static version of the same row ( row = db(db.assets.asset_id == 273).update(asset_name = 'testing3') ) and put it into an own function and works fine. But if I put the static row into my onaccept ( crud.settings.update_onaccept = update_assets) function I get the same error. I just wildly guessing but could be somekind of locking issue? Kenneth Den fredagen den 7:e december 2012 kl. 18:50:17 UTC+2 skrev Massimo Di Pierro: The error you are getting is a database error, not a web2py error, it says you are trying to insert a record with a duplicate id. Perhaps the data is already corrupted in db. On Friday, 7 December 2012 00:06:43 UTC-6, Kenneth wrote: Hi, this is a legacy table and asset_id is the id for the table. So it needs to be unique. The migration is false, web2py is not able to change the structure at all. I'm only trying to update the asset_name not create an new that looks the same. Kenneth Den fredagen den 7:e december 2012 kl. 04:10:24 UTC+2 skrev Massimo Di Pierro: I suspect your asset_id is declared as unique (or was declared as unique, then you made a migration but db still thinks it is unique). On Thursday, 6 December 2012 17:37:10 UTC-6, Kenneth wrote: Hello, I have a form created by CRUD with some extra fields. assets_label field is a dropdown consisting of all old labels. Beside that I add an normal text field where user can enter a new label. I have then crud.settings.create_onaccept
[web2py] Re: onaccept in CRUD
Hi, I converted the problematic row ( row = db(db.assets.asset_id == form.vars.id).update(asset_name = form.request_vars.asset_name_2) ) into normal SQL and used it on the database directly, works fine. I made a static version of the same row ( row = db(db.assets.asset_id == 273).update(asset_name = 'testing3') ) and put it into an own function and works fine. But if I put the static row into my onaccept ( crud.settings.update_onaccept = update_assets) function I get the same error. I just wildly guessing but could be somekind of locking issue? Kenneth Den fredagen den 7:e december 2012 kl. 18:50:17 UTC+2 skrev Massimo Di Pierro: The error you are getting is a database error, not a web2py error, it says you are trying to insert a record with a duplicate id. Perhaps the data is already corrupted in db. On Friday, 7 December 2012 00:06:43 UTC-6, Kenneth wrote: Hi, this is a legacy table and asset_id is the id for the table. So it needs to be unique. The migration is false, web2py is not able to change the structure at all. I'm only trying to update the asset_name not create an new that looks the same. Kenneth Den fredagen den 7:e december 2012 kl. 04:10:24 UTC+2 skrev Massimo Di Pierro: I suspect your asset_id is declared as unique (or was declared as unique, then you made a migration but db still thinks it is unique). On Thursday, 6 December 2012 17:37:10 UTC-6, Kenneth wrote: Hello, I have a form created by CRUD with some extra fields. assets_label field is a dropdown consisting of all old labels. Beside that I add an normal text field where user can enter a new label. I have then crud.settings.create_onaccept = insert_assets where I update the label name if there is some text in the textfield. This works great. The problem comes with crud.settings.update_onaccept = update_assets and def update_assets(form): if form.request_vars.asset_name_2 != '': row = db(db.assets.asset_id == form.vars.id).update(asset_name = form.request_vars.asset_name_2) I get an error ticket containg: class '_mysql_exceptions.IntegrityError' (1062, Duplicate entry '275-2012-12-07 10:26:41' for key 'asset_id') File /usr/lib/pymodules/python2.6/MySQLdb/cursors.py, line 166, in execute self.errorhandler(self, exc, value) File /usr/lib/pymodules/python2.6/MySQLdb/connections.py, line 35, in defaulterrorhandler raise errorclass, errorvalue IntegrityError: (1062, Duplicate entry '275-2012-12-07 10:26:41' for key 'asset_id') Any ideas what I'm doing wrong? Kenneth --
[web2py] onaccept in CRUD
Hello, I have a form created by CRUD with some extra fields. assets_label field is a dropdown consisting of all old labels. Beside that I add an normal text field where user can enter a new label. I have then crud.settings.create_onaccept = insert_assets where I update the label name if there is some text in the textfield. This works great. The problem comes with crud.settings.update_onaccept = update_assets and def update_assets(form): if form.request_vars.asset_name_2 != '': row = db(db.assets.asset_id == form.vars.id).update(asset_name = form.request_vars.asset_name_2) I get an error ticket containg: class '_mysql_exceptions.IntegrityError' (1062, Duplicate entry '275-2012-12-07 10:26:41' for key 'asset_id') File /usr/lib/pymodules/python2.6/MySQLdb/cursors.py, line 166, in execute self.errorhandler(self, exc, value) File /usr/lib/pymodules/python2.6/MySQLdb/connections.py, line 35, in defaulterrorhandler raise errorclass, errorvalue IntegrityError: (1062, Duplicate entry '275-2012-12-07 10:26:41' for key 'asset_id') Any ideas what I'm doing wrong? Kenneth --