[web2py] Re: PostgreSQL migrate / fake_migrate_all failure with relation does not exists
Hi Tom, wiki's tables are not present. You have to include them during the migration, probably you have defined the wiki object in a controller? Paolo On Saturday, November 29, 2014 6:22:00 PM UTC+1, Tom Øyvind Hogstad wrote: My migrations suddenly failed with Error: class 'gluon.contrib.pg8000.errors.ProgrammingError' ('ERROR', '42P01', 'relation wiki_page does not exist') This will happen for any relation trying to commenting them out etc. Running a fake_migrate_all and the problem still persists, so I can not find a way around manually modify my PostgreSQL schema at the moment. Any suggestions? Web2Py: 2.9.11 PostrgeSQL: 9.3 Tom Ø. -- 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: add task and wait the result
On Sunday, November 30, 2014 1:51:37 PM UTC+1, nick name wrote: Is that true even with immediate=True? If so, what is the recommended way to reduce this to 0.5 seconds or so? I have an app in which a user requests somethng; that request launches 1-10 other web requests, and the user keeps refreshing until they all complete for the summarized result. (I will probably replace this with an ajax poll or a ws notification instead later on). mine was just a general checklist before anything else, since several minutes point towards another whole set of issues. in general, immediate=True shortcircuits the 5 loops wait in assigning newly created tasks. so, in worst case scenario, you'll have |---sched.queue_task()---|---sleep---|---sleep---|---sleep---|---sleep---|---ASSIGNING---|---RUNNING---| (without immediate) |---sched.queue_task(,immediate=True)---|---ASSIGNING---|---RUNNING---| (with immediate) every |---something---| is by default a loop that last 3 seconds (the heartbeat value on initialization) Simone -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] SQLFORM.grid field is not empty if another field is full
Hello I have a SQLFORM.grid and I have to raise error for user if he inserts value into one field and not another. Example start 1 10:00 end 1 12:00 - has to show error if field is empty - start 2 16:00 - not necessary to be inserted end 2 20:00 - has to show error if start 2 is not empty What would be the best solution? 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] update_or_insert error
On 28 November 2014 at 07:26, T.R.Rajkumar t.r.rajkuma...@gmail.com wrote: When I do update_or_insert into a table in postgresql I get the following error. My code is below. class 'gluon.contrib.pg8000.errors.ProgrammingError' ('ERROR', '42601', 'syntax error at or near ') What does the generated query look like? Regards Johann -- 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] syntax for making var appear in view
On 1 December 2014 at 09:23, Alex Glaros alexgla...@gmail.com wrote: Question one: This is in controller: vars=dict(Alex=99) This is in view: brAlex = {{ =response.get_vars.Alex}} br error is: 'NoneType' object has no attribute 'Alex'. I assume this is not the way to get a var to show up in view. What is correct syntax? Try br Alex = {{=Alex}} /br Regards Johann -- 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: syntax for making var appear in view
On Monday, December 1, 2014 2:23:25 AM UTC-5, Alex Glaros wrote: Question one: This is in controller: vars=dict(Alex=99) This is in view: brAlex = {{ =response.get_vars.Alex}} br Assuming the first line is in a call to the URL() function and the view in question is that of the linked page, you want request.get_vars, not response.get_vars. Question two: bAlex var is in controller below: db.Suggestion.suggestionTitle.represent = lambda v, r: A(v, _href=URL( 'view_specific_suggestion', args=r.id, vars=dict(bAlex=77))) This is in view: vars = {{=request.vars}}br brbAlex = {{request.vars.bAlex}}br Forgot the = -- should be: {{=request.vars.bAlex}} 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: SQLFORM.grid field is not empty if another field is full
You can either use an onvalidation function or do something like: Field('end1', requires=IS_NOT_EMPTY() if request.post_vars.start1 else None) Anthony On Monday, December 1, 2014 8:27:30 AM UTC-5, Yebach wrote: Hello I have a SQLFORM.grid and I have to raise error for user if he inserts value into one field and not another. Example start 1 10:00 end 1 12:00 - has to show error if field is empty - start 2 16:00 - not necessary to be inserted end 2 20:00 - has to show error if start 2 is not empty What would be the best solution? 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] Custom validator - pass record id to validator for update operations
Hello all, I am developing a web2py application and I am writing the logic to control stock of certain items. To that end, I wrote a custom validator which is working fine when creating new sale items. Now the problem arises when updating these sale items, because I would need to know the actual record being updated to adjust the logic in this cases. I could get this information through ._before_update method, but how would I pass it to the validator ? I am not sure if this is the best way to do it. I will appreciate any help on this matter! Best regards, Clara -- 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] Subclassing IS_IN_SET - one piece missing.
Hi, I wanted to create a validator which creates a dropdown of users in a certain auth group. I figured I could shortcut this by inheriting from IS_IN_SET, see class below. This works fine for SQLFORMS in create mode (drop dow with just what I want to see) and for read-only mode (I see the user name, not the id) , but for a SQLFORM in edit mode which is pointing at an existing record, it doesn't pre-select the entry in the options drop-down. Any ideas on how I go about getting this to work, or is there a simpler solution? If you use this validator in the DAL, you can see the result the admin pages, so you have an easy way to test if you want to play around with it. Thanks, class IS_USER_IN_GROUP(IS_IN_SET): A validator that can be used like requires = IS_USER_IN_GROUP() Provides a drop down of users in that group. def __init__(self, group_name): keys = [] labels = [] staff_groups = db((db.auth_user.id==db.auth_membership.user_id) (db.auth_group.id==db.auth_membership.group_id)) rows = staff_groups(db.auth_group.role == group_name).select(db.auth_user.ALL, orderby=db.auth_user.first_name|db.auth_user.last_name) for user in rows: keys.append(user.id) labels.append('%s %s' % (user.first_name, user.last_name)) IS_IN_SET.__init__(self, keys, labels) def formatter(self, user_id): hits = db(db.auth_user.id == user_id).select() if len(hits) == 1: user = hits.first() return '%s %s' % (user.first_name, user.last_name) return '' -- 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: Custom validator - pass record id to validator for update operations
Hi Clara, I think (someone please correct me if I'm wrong -- and have a look at my other question posted just after this :D) that the validator has no access to the record. But because you can set the validator on a field at any time, one solution is to chang your validator class so it knows about the record id, and only assign the validator to the table's field just before you need to use it in a form, but after you have obtained the record id. class MY_VALIDATOR(IS_IN_SET): def __init__(self, record_id=None): self.record_id = record_id #whatever your validator does def __call__(self, value): if value == self.self.record_id: #whatever def some_controller_url(): record_id = request.vars.record_id #Override the validator set in models (if any) with this validator which does have knowledge of the record db.my_table._my_field.requires = MY_VALIDATOR(record=record_id) form = SQLFORM( db.my_table, record=record_id) ...#Table will be built with a validator which knows about your record :) Does this make sense? On Monday, December 1, 2014 2:49:45 PM UTC, clara wrote: Hello all, I am developing a web2py application and I am writing the logic to control stock of certain items. To that end, I wrote a custom validator which is working fine when creating new sale items. Now the problem arises when updating these sale items, because I would need to know the actual record being updated to adjust the logic in this cases. I could get this information through ._before_update method, but how would I pass it to the validator ? I am not sure if this is the best way to do it. I will appreciate any help on this matter! Best regards, Clara -- 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: Web2py's included connection pooling VS external pooling software
Sorry about the delay. I recently installed pgbouncer. I let postgresql max_connection set to 80, and configure pgbouncer with a max_client_conn of 1000 and a default_pool_size of 20. Now when I check pg_stat_activity I can see different amounts of idle connections per app, more accordingly with that app's traffic. What I mean is that I can see more connections for the apps with higher volumes of traffic and less connections for the apps with lower volumes of traffic. What I still don't understand is the max_connections setting of postgresql vs the max_client_conn of pgbouncer. For what I've read in [1] and [2] it's ok to set those variables for example in the way I did, leting postgresql max_connections in an appropiated value (in my case, using pgtune, 80 max_connections) and using a high value for max_client_conn on pgbouncer configuration. What isnt' clear to me is: what will happen when one of the apps has more than 20 active connections to pgbouncer and requests keep coming in? The ideal (for me, in this case) would be that next requests just stay waiting (browser saying waiting for domain.com). In the other hand, related to Michele comment, right now I have every flup server running with max-procs set to 1, this is how my lighttpd virtual hosts look like: $HTTP[host] == diarioprimicia.com.ar { server.document-root = /var/www/diarioprimicia server.dir-listing = disable server.error-handler-404 = /diarioprimicia.fcgi server.kbytes-per-second = 256 connection.kbytes-per-second = 128 accesslog.filename = /var/log/lighttpd/diarioprimicia_access.log fastcgi.server = ( .fcgi = (localhost = ( check-local = disable, max-procs = 1, socket = /var/tmp/lighttpd/diarioprimicia.sock, bin-path = /var/www/diarioprimicia/diarioprimicia.fcgi) ) ) } Then the file indicated by bin-path contains the following: #!/usr/bin/python import sys import gluon.main from flup.server.fcgi_fork import WSGIServer application=gluon.main.wsgibase WSGIServer(application).run() Another strange thing I see (strange for me, because I don't fully understand in) is that, regardless of setting max-procs to 1, when I use pgrep to check for fastcgi processes I can see exactly 5 processes for every app. I'm sorry to mix all this stuff in this post, if you think that I should move it to other forums, let me know. Thank you very much! 2014-11-30 18:00 GMT-03:00 Michele Comitini michele.comit...@gmail.com: p.s. by no threading I mean to use processes in place of threads. The number of processes is something you must tune based on server resources, 2xn where n is the number of cores is a safe choice. 2014-11-30 20:04 GMT+01:00 Michele Comitini michele.comit...@gmail.com: pool_size==number of threads in a web2py process. I suggest to work around the problem by setting the number of threads to 1 in you flup server. I.e. no threading. You should also see smoother performance across applications on higher loads. 2014-11-30 15:51 GMT+01:00 Lisandro Rostagno rostagnolisan...@gmail.com : Yes in deed. I've restarted the webserver and the database server. Recently I've tried setting pool_size to 1 for every app, that is, for every website. Restarted postgresql and webserver (lighttpd). And then I used this SQL statement to check the total count of connections for every database (or what it is the same, for every app, because every app has its own database): select datname, count(*) from pg_stat_activity group by datname order by datname; Just to remind, I have around 13 apps running, that is, 13 websites, 13 databases. With this new configuration of every app using a pool size of 1, I restarted the database server and the webserver, and then I ran the previous SQL statement to see the total connections for every app, and I see 5 idle connections for every app, that is, for every website that has some visitors browsing the site. A couple of the websites almost never have visitors, so, for those websites, there were no idle connections. Then I go to the homepage of those websites, rechecked connections, and there I see 5 idle connections for those websites. I already checked and re-checked the code of my app to be shure that I'm setting pool_size parameter correctly. In the other hand, I've been testing pgbouncer on localhost, reading about it, and I'll be setting it for production. For what I've read, independently of the postgresql max connections, I can set pgbouncer to a max_client_conn of 2000 (for example) with a default_pool_size of 20. Then all the apps connect to pgbouncer, and pgbouncer will multiplex connections to postgres. However I don't want to mix things in this post, regardless of pgbouncer, I would like to understand why I can't get to work web2py's pooling mechanism. I'm really grateful for your help! I'll continue trying to figure it out. Any comment or suggestion will
[web2py] Re: Forcing download of generated PDF
With: return response.stream(open(path, 'rb')) You need save your file first, using tempfile maybe. On Wednesday, October 29, 2014 12:13:39 PM UTC-5, Jason Solack wrote: Hello everyone, i'm generating a PDF using pdfkit and i'd like my function to force the download of the pdf file i'm making. Here's some simple code demonstrating the PDF being made in memory: def make_pdf(): import pdfkit pdf = pdfkit.from_string(test, False) return pdf Ideally i would like to have an export button on my page and have that function called and then download the PDF i have made. Thank you in advance! Jason -- 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: Forking/multiprocessing bug triggered by Web2Py launch directory
Please open a ticket about this. On Sunday, 30 November 2014 02:03:18 UTC-6, Roshan Mathews wrote: It's been a month since my post, so I was wondering if anyone has any hints they might want to share about this. Thanks, rm On Friday, 31 October 2014 19:32:06 UTC+5:30, Roshan Mathews wrote: Hi, I have a weird bug that seems to be triggered when using the multiprocessing module, if web2py is launched from another directory. I've tried to isolate the issue. To reproduce the issue, take a clean web2py source tarball, and make the following changes: 1. to the end of *applications/welcome/controllers/default.py* add the lines: import alpha def bravo(): return alpha.charlie() 2. create a new file *applications\welcome\modules\alpha.py* with the following content from multiprocessing import Process, Manager def delta(output): output.append('Hello, world!') def charlie(): output = Manager().list() p = Process(target=delta, args=(output,)) p.start() p.join() return output[0] 3. run it normally, d:\code\temp\web2pypython web2py.py ... hit *http://127.0.0.1:8000/welcome/default/bravo http://127.0.0.1:8000/welcome/default/bravo* ... everything works 4. change the current working directory, and relaunch d:\code\temp\web2pycd .. d:\code\temppython web2py\web2py.py and you get an error. An unhelpful ticket, but the console has the following traceback: Traceback (most recent call last): File string, line 1, in module File D:\Python27\lib\multiprocessing\forking.py, line 380, in main prepare(preparation_data) File D:\Python27\lib\multiprocessing\forking.py, line 489, in prepare file, path_name, etc = imp.find_module(main_name, dirs) ImportError: No module named web2py If it helps, I put a print statement before File *D:\Python27\lib\multiprocessing\forking.py*, line 489, and it printed out: ['d:\\code\\temp\\web2py\\web2py'] Something is causing the path to add the directory web2py twice! If I run the code from one directory above that: d:\code\tempcd .. d:\codepython temp\web2py\web2py.py then the following is printed: ['d:\\code\\temp\\web2py\\temp\\web2py'] Again the path is repeated twice. Can anyone help me understand what is causing this issue? What is a potential fix? If it helps, the real bug got triggered when running web2py behind Apache on Windows (modwsgi), since the wsgi script was launched from some random Apache directory. Regards, Roshan Mathews -- http://about.me/rosh -- 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: Web2py's included connection pooling VS external pooling software
@lisandro: michele is right.. the pool_size parameter calculation are accurate only if there's one process per app. web2py can't coordinate pools among different processes... also, max_client_conn is exactly the maximum number of connection the pgbouncer process will allow coming in. Once over the max, others will be queued. What pgbouncer does is exactly what web2py does if it runs in a single process and with a single DAL connection: it keeps n connections open to the backend and recycles connections coming in. Once full, the latest coming in needs to wait for a connection to be freed. -- 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] nginx one ip two web2py applications two non web2py websites
Hi, I got one server with one ip. And I have a total of 4 websites. two web2py apps and two non web2py apps. I had that configured and working a year ago. and can't remember how I did it. I updatet web2py and now all web2py urls are redirected to one of the non web2py websites. Can anyone tell me wat went wrong. 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: Subclassing IS_IN_SET - one piece missing.
why reinventing the wheel ? IS_IN_DB takes a Set... gr = db.auth_group me = db.auth_membership us = db.auth_user theset = db( (us.id == me.user_id) (gr.id == me.group_id) (gr.role == 'roletest') ) Field('a_field', requires=IS_IN_DB(theset, 'auth_user.id', '%(first_name)s - %(last_name)s')) On Monday, December 1, 2014 4:04:32 PM UTC+1, Andrew Buchan wrote: Hi, I wanted to create a validator which creates a dropdown of users in a certain auth group. I figured I could shortcut this by inheriting from IS_IN_SET, see class below. This works fine for SQLFORMS in create mode (drop dow with just what I want to see) and for read-only mode (I see the user name, not the id) , but for a SQLFORM in edit mode which is pointing at an existing record, it doesn't pre-select the entry in the options drop-down. Any ideas on how I go about getting this to work, or is there a simpler solution? If you use this validator in the DAL, you can see the result the admin pages, so you have an easy way to test if you want to play around with it. Thanks, class IS_USER_IN_GROUP(IS_IN_SET): A validator that can be used like requires = IS_USER_IN_GROUP() Provides a drop down of users in that group. def __init__(self, group_name): keys = [] labels = [] staff_groups = db((db.auth_user.id==db.auth_membership.user_id) (db.auth_group.id==db.auth_membership.group_id)) rows = staff_groups(db.auth_group.role == group_name).select(db.auth_user.ALL, orderby=db.auth_user.first_name|db.auth_user.last_name) for user in rows: keys.append(user.id) labels.append('%s %s' % (user.first_name, user.last_name)) IS_IN_SET.__init__(self, keys, labels) def formatter(self, user_id): hits = db(db.auth_user.id == user_id).select() if len(hits) == 1: user = hits.first() return '%s %s' % (user.first_name, user.last_name) return '' -- 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: Web2py's included connection pooling VS external pooling software
What you have here is lighttpd starting 1 forking flup server. The important part is this: from flup.server.fcgi_fork import WSGIServer With that you have a python interpreter for each request, up to a maximum. The default is 5 spare children, the default maximum is 50. Under lighttpd is also possible to use fcgi_single and max_procs = 5 with similar results [I'd expect a slightly bigger memory footprint]. Since you have a forking/multiprocess configuration, you need to have a single connection in the web2py connection pool so pool_size=1 is what you need, anything more is just a waste of resources and postgres connections. The max number of open connections should be (max_num_wsgi_proc[flup] * pool_size[web2py DAL]) * (max_procs[lighttpd] * num_applications[lighttpd]). About pgbouncer, IMHO you should use it only if you have n client and m max postgresql connections, and you have n m. To speedup things you can use memcache/redis and/or a more complex setup with pgpoolII and multiple postgres backends. 2014-12-01 17:46 GMT+01:00 Lisandro Rostagno rostagnolisan...@gmail.com: Sorry about the delay. I recently installed pgbouncer. I let postgresql max_connection set to 80, and configure pgbouncer with a max_client_conn of 1000 and a default_pool_size of 20. Now when I check pg_stat_activity I can see different amounts of idle connections per app, more accordingly with that app's traffic. What I mean is that I can see more connections for the apps with higher volumes of traffic and less connections for the apps with lower volumes of traffic. What I still don't understand is the max_connections setting of postgresql vs the max_client_conn of pgbouncer. For what I've read in [1] and [2] it's ok to set those variables for example in the way I did, leting postgresql max_connections in an appropiated value (in my case, using pgtune, 80 max_connections) and using a high value for max_client_conn on pgbouncer configuration. What isnt' clear to me is: what will happen when one of the apps has more than 20 active connections to pgbouncer and requests keep coming in? The ideal (for me, in this case) would be that next requests just stay waiting (browser saying waiting for domain.com). In the other hand, related to Michele comment, right now I have every flup server running with max-procs set to 1, this is how my lighttpd virtual hosts look like: $HTTP[host] == diarioprimicia.com.ar { server.document-root = /var/www/diarioprimicia server.dir-listing = disable server.error-handler-404 = /diarioprimicia.fcgi server.kbytes-per-second = 256 connection.kbytes-per-second = 128 accesslog.filename = /var/log/lighttpd/diarioprimicia_access.log fastcgi.server = ( .fcgi = (localhost = ( check-local = disable, max-procs = 1, socket = /var/tmp/lighttpd/diarioprimicia.sock, bin-path = /var/www/diarioprimicia/diarioprimicia.fcgi) ) ) } Then the file indicated by bin-path contains the following: #!/usr/bin/python import sys import gluon.main from flup.server.fcgi_fork import WSGIServer application=gluon.main.wsgibase WSGIServer(application).run() Another strange thing I see (strange for me, because I don't fully understand in) is that, regardless of setting max-procs to 1, when I use pgrep to check for fastcgi processes I can see exactly 5 processes for every app. I'm sorry to mix all this stuff in this post, if you think that I should move it to other forums, let me know. Thank you very much! 2014-11-30 18:00 GMT-03:00 Michele Comitini michele.comit...@gmail.com: p.s. by no threading I mean to use processes in place of threads. The number of processes is something you must tune based on server resources, 2xn where n is the number of cores is a safe choice. 2014-11-30 20:04 GMT+01:00 Michele Comitini michele.comit...@gmail.com: pool_size==number of threads in a web2py process. I suggest to work around the problem by setting the number of threads to 1 in you flup server. I.e. no threading. You should also see smoother performance across applications on higher loads. 2014-11-30 15:51 GMT+01:00 Lisandro Rostagno rostagnolisan...@gmail.com : Yes in deed. I've restarted the webserver and the database server. Recently I've tried setting pool_size to 1 for every app, that is, for every website. Restarted postgresql and webserver (lighttpd). And then I used this SQL statement to check the total count of connections for every database (or what it is the same, for every app, because every app has its own database): select datname, count(*) from pg_stat_activity group by datname order by datname; Just to remind, I have around 13 apps running, that is, 13 websites, 13 databases. With this new configuration of every app using a pool size of 1, I restarted the database server and the webserver, and then I ran the previous SQL statement to see
[web2py] Re: nginx one ip two web2py applications two non web2py websites
as long as you have 4 sites stanzas I can't see where the issue could be server { listen 80 ; server_name blabla1.com .. } server { listen 80 ; server_name blabla2.com .. } server { listen 80 ; server_name blabla3.com .. } server { listen 80 ; server_name blabla4.com .. } On Monday, December 1, 2014 9:44:36 PM UTC+1, BlueShadow wrote: Hi, I got one server with one ip. And I have a total of 4 websites. two web2py apps and two non web2py apps. I had that configured and working a year ago. and can't remember how I did it. I updatet web2py and now all web2py urls are redirected to one of the non web2py websites. Can anyone tell me wat went wrong and how to set it up correctly? 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: nginx one ip two web2py applications two non web2py websites
If by two web2py apps you mean two different web2py installations (with the web2py code duplicated, so that they can run different versions of web2py, for example), then I can say: we recently followed this tutorial: http://www.techshinobi.com/index.php/multiple-web2py-instances-with-uwsgi-emperor-and-nginx/ and it worked for us. If your two web2py apps can share the web2py code, and you can arrange the routing staff to your satisfaction, you don't even need that. Have you tried to just define several sites in /etc/nginx/sites-available, one of them as in the web2py book, two of them like in the default nginx site? Then: what error do you get, can you post your conf files, etcetera? -- 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: nginx one ip two web2py applications two non web2py websites
I'm stupid. I had the $hostname still in the conf file in sites-available thanks Niphlod. On Monday, December 1, 2014 9:44:36 PM UTC+1, BlueShadow wrote: Hi, I got one server with one ip. And I have a total of 4 websites. two web2py apps and two non web2py apps. I had that configured and working a year ago. and can't remember how I did it. I updatet web2py and now all web2py urls are redirected to one of the non web2py websites. Can anyone tell me wat went wrong and how to set it up correctly? 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.
Re: [web2py] Re: Web2py's included connection pooling VS external pooling software
Thank you very much Niphlod and Michele for your help! Now I have a more clear understanding of all this. I understand now why I was seeing 5 fastcgi processes regardless of the max-procs configuration (that was because I was using fcgi_fork, and I was actually seeing one process and its 5 children). Michele, abount using pgbouncer when having more clients connections than max postgresql connections, I think that's my case (correct me if I'm wronk). All the sites I'm hosting are news sites, and ocassionally some of them have sudden spikes in traffic. The last time one of the sites presented a high peak on traffic, connections reached the postgresql max_connections limit and, therefor, **all** the applications started throwing intermitent HTTP 500 errors. So I started my research to see what could I do to **avoid compromising some apps when one of them is getting high traffic**. Above all, I want to be able to **control the limits for every app**. I started setting server.kbytes-per-second and connection.kbytes-per-second for every app. However that didn't resolve the problem of high database connection requests. With the last info you gave me, I think now I can achieve my goal playing around a little with this settings (please correct me if I'm worng): - max-procs for the fastcgi of every app: I could set it to 1 for apps with lower traffic, and set it to a higher value for apps with higher traffic (of course, always checking stats to see what happens). - pool_size pgbouncer parameter: I mean modifying this value for every database, using a larger pool for apps with higher traffic, and viceversa. The cool stuff here is that with pgbouncer I can check stats of clients, pools, etc. My goal here is to set a limit for an app, and if a new connection is requested but the pool is full, the client keeps waiting until a connection is freed (no http 500 error). I'll be trying these changes and I'll be posting here the results. As always, any comment is really appreciated. Thank you again for the help! 2014-12-01 17:56 GMT-03:00 Michele Comitini michele.comit...@gmail.com: What you have here is lighttpd starting 1 forking flup server. The important part is this: from flup.server.fcgi_fork import WSGIServer With that you have a python interpreter for each request, up to a maximum. The default is 5 spare children, the default maximum is 50. Under lighttpd is also possible to use fcgi_single and max_procs = 5 with similar results [I'd expect a slightly bigger memory footprint]. Since you have a forking/multiprocess configuration, you need to have a single connection in the web2py connection pool so pool_size=1 is what you need, anything more is just a waste of resources and postgres connections. The max number of open connections should be (max_num_wsgi_proc[flup] * pool_size[web2py DAL]) * (max_procs[lighttpd] * num_applications[lighttpd]). About pgbouncer, IMHO you should use it only if you have n client and m max postgresql connections, and you have n m. To speedup things you can use memcache/redis and/or a more complex setup with pgpoolII and multiple postgres backends. 2014-12-01 17:46 GMT+01:00 Lisandro Rostagno rostagnolisan...@gmail.com: Sorry about the delay. I recently installed pgbouncer. I let postgresql max_connection set to 80, and configure pgbouncer with a max_client_conn of 1000 and a default_pool_size of 20. Now when I check pg_stat_activity I can see different amounts of idle connections per app, more accordingly with that app's traffic. What I mean is that I can see more connections for the apps with higher volumes of traffic and less connections for the apps with lower volumes of traffic. What I still don't understand is the max_connections setting of postgresql vs the max_client_conn of pgbouncer. For what I've read in [1] and [2] it's ok to set those variables for example in the way I did, leting postgresql max_connections in an appropiated value (in my case, using pgtune, 80 max_connections) and using a high value for max_client_conn on pgbouncer configuration. What isnt' clear to me is: what will happen when one of the apps has more than 20 active connections to pgbouncer and requests keep coming in? The ideal (for me, in this case) would be that next requests just stay waiting (browser saying waiting for domain.com). In the other hand, related to Michele comment, right now I have every flup server running with max-procs set to 1, this is how my lighttpd virtual hosts look like: $HTTP[host] == diarioprimicia.com.ar { server.document-root = /var/www/diarioprimicia server.dir-listing = disable server.error-handler-404 = /diarioprimicia.fcgi server.kbytes-per-second = 256 connection.kbytes-per-second = 128 accesslog.filename = /var/log/lighttpd/diarioprimicia_access.log fastcgi.server = ( .fcgi = (localhost = ( check-local = disable, max-procs = 1,
[web2py] Re: Dynamic Upload Uploadfolder
Any ideas? Cheers On Monday, December 1, 2014 11:46:57 AM UTC+13, Massimo Di Pierro wrote: You cannot do this uploadfolder= lambda r:... But this is a chicken-egg problem. You want r to be the row but the row is not created until after the file is uploaded therefore you cannot specify the upload folder as function of something that happens after. Please explain to us in english of the folder should depend on the upload and perhaps we can suggest a way to do it. On Saturday, 29 November 2014 14:08:20 UTC-6, James Burke wrote: How do you create a dynamic uploadfolder for an upload Field? I tried using: uploadfolder= lambda r: db.repository(r.repository_id).directory but i get the error message, I guess it doesn't have the same functionality as compute: cannot concatenate 'str' and 'function' objects I'm also using custom_store/retreive to maintain the files original filename def store_file(file, filename=None, path=None): path = path # applications/init/uploads if not os.path.exists(path): os.makedirs(path) pathfilename = os.path.join(path, filename) dest_file = open(pathfilename, 'wb') try: shutil.copyfileobj(file, dest_file) finally: dest_file.close() return filename If I can set the uploadfolder dynamically then it's passed to store_file as path. I also tried: path = db.repository(db.workbench(db.workbench.name==filename).repository ).directory But it can't find a record, I guess because store_file is run before the record is created in the db. Any suggestions? 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] Displaying blob image on login page
Hi All, I need to display logo according to url in login page. I tried to display the logo but it always shows *404 not found* error on login page. My app settings are below: *models/db.py* db.define_table('company', Field('name', 'text', notnull=True), Field('abbrev', 'string', length=32), Field('logo', 'upload', uploadfield=True, requires=IS_IMAGE()), Field('timezone', 'string', requires=IS_IN_SET(all_timezones)), Field('url', 'string', requires=IS_URL()), format='%(name)s') *controllers/default.py* def user(): exposes: http:///[app]/default/user/login http:///[app]/default/user/logout http:///[app]/default/user/register http:///[app]/default/user/profile http:///[app]/default/user/retrieve_password http:///[app]/default/user/change_password http:///[app]/default/user/manage_users (requires membership in use @auth.requires_login() @auth.requires_membership('group name') @auth.requires_permission('read','table name',record_id) to decorate functions that need access control #set some default name abbrev_name = 'ASDF' company_rec = db(db.company.url.contains(request.env.http_host)).select().first() if company_rec: abbrev = company_rec['abbrev'] logo = IMG(_src = URL('default', 'show_logo', company_rec['logo'])) session.company_timezone = company_rec['timezone'] return dict(form=auth(), abbrev=abbrev, logo=logo) def show_logo(): return response.download(request, db) *views/default/user.html:* html head /head body div class=logo style=display: inline-block; h2 {{=logo}} /h2 h2{{=abbrev}}/h2 /div !-- some code for login / log_out / change_password -- /body /head It shows following error as: 1. Remote Address: 127.0.0.1:8000 2. Request URL: https://127.0.0.1:8000/default/show_logo/investor.logo.91f2753b1fabaab6.736571756f69615f6361706974616c5f6c6f676f2e676966.gif 3. Request Method: GET 4. Status Code: 404 NOT FOUND Is there any way to display blob image ? -- 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: Displaying blob image on login page
From http://stackoverflow.com/questions/22580518/display-image-from-database-in-the-html-form-using-php - you can try setting img src=data:image/gif;base64,' On Tuesday, December 2, 2014 12:09:25 PM UTC+5:30, Prasad Muley wrote: Hi All, I need to display logo according to url in login page. I tried to display the logo but it always shows *404 not found* error on login page. My app settings are below: *models/db.py* db.define_table('company', Field('name', 'text', notnull=True), Field('abbrev', 'string', length=32), Field('logo', 'upload', uploadfield=True, requires=IS_IMAGE()), Field('timezone', 'string', requires=IS_IN_SET(all_timezones)), Field('url', 'string', requires=IS_URL()), format='%(name)s') *controllers/default.py* def user(): exposes: http:///[app]/default/user/login http:///[app]/default/user/logout http:///[app]/default/user/register http:///[app]/default/user/profile http:///[app]/default/user/retrieve_password http:///[app]/default/user/change_password http:///[app]/default/user/manage_users (requires membership in use @auth.requires_login() @auth.requires_membership('group name') @auth.requires_permission('read','table name',record_id) to decorate functions that need access control #set some default name abbrev_name = 'ASDF' company_rec = db(db.company.url.contains(request.env.http_host)).select().first() if company_rec: abbrev = company_rec['abbrev'] logo = IMG(_src = URL('default', 'show_logo', company_rec['logo'])) session.company_timezone = company_rec['timezone'] return dict(form=auth(), abbrev=abbrev, logo=logo) def show_logo(): return response.download(request, db) *views/default/user.html:* html head /head body div class=logo style=display: inline-block; h2 {{=logo}} /h2 h2{{=abbrev}}/h2 /div !-- some code for login / log_out / change_password -- /body /head It shows following error as: 1. Remote Address: 127.0.0.1:8000 2. Request URL: https://127.0.0.1:8000/default/show_logo/investor.logo.91f2753b1fabaab6.736571756f69615f6361706974616c5f6c6f676f2e676966.gif 3. Request Method: GET 4. Status Code: 404 NOT FOUND Is there any way to display blob image ? -- 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: Displaying blob image on login page
http://stackoverflow.com/questions/16279856/converting-blob-stored-on-a-database-to-an-image-on-an-html-website On Tuesday, December 2, 2014 12:09:25 PM UTC+5:30, Prasad Muley wrote: Hi All, I need to display logo according to url in login page. I tried to display the logo but it always shows *404 not found* error on login page. My app settings are below: *models/db.py* db.define_table('company', Field('name', 'text', notnull=True), Field('abbrev', 'string', length=32), Field('logo', 'upload', uploadfield=True, requires=IS_IMAGE()), Field('timezone', 'string', requires=IS_IN_SET(all_timezones)), Field('url', 'string', requires=IS_URL()), format='%(name)s') *controllers/default.py* def user(): exposes: http:///[app]/default/user/login http:///[app]/default/user/logout http:///[app]/default/user/register http:///[app]/default/user/profile http:///[app]/default/user/retrieve_password http:///[app]/default/user/change_password http:///[app]/default/user/manage_users (requires membership in use @auth.requires_login() @auth.requires_membership('group name') @auth.requires_permission('read','table name',record_id) to decorate functions that need access control #set some default name abbrev_name = 'ASDF' company_rec = db(db.company.url.contains(request.env.http_host)).select().first() if company_rec: abbrev = company_rec['abbrev'] logo = IMG(_src = URL('default', 'show_logo', company_rec['logo'])) session.company_timezone = company_rec['timezone'] return dict(form=auth(), abbrev=abbrev, logo=logo) def show_logo(): return response.download(request, db) *views/default/user.html:* html head /head body div class=logo style=display: inline-block; h2 {{=logo}} /h2 h2{{=abbrev}}/h2 /div !-- some code for login / log_out / change_password -- /body /head It shows following error as: 1. Remote Address: 127.0.0.1:8000 2. Request URL: https://127.0.0.1:8000/default/show_logo/investor.logo.91f2753b1fabaab6.736571756f69615f6361706974616c5f6c6f676f2e676966.gif 3. Request Method: GET 4. Status Code: 404 NOT FOUND Is there any way to display blob image ? -- 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: update_or_insert error
In the error page I find the following in the arguments. *File F:\trr\web2py\web2py\gluon\dal.py in update_or_insert at line 9380* code arguments variables Function argument list (self=Table cms_meas_details (id,meas_id,agt_no,jcod,...,m_content,remarks,update_uid,update_dt,line_no), _key=Query (cms_meas_details.jcod = 'TR001') AND...hift = '1')) AND (cms_meas_details.line_no = 1)), **values={'agt_no': '10001', 'jcod': 'TR001', 'line_no': 1, 'loc_of_work': 'test', 'm_breadth': '', 'm_content': '2.000', 'm_depth': '', 'm_length': '', 'm_no': '1.0', 'm_times': '2.0', ...}) I do not know where to see the generated query. I am a newbie. Thank you for the interest shown. On Friday, November 28, 2014 10:56:16 AM UTC+5:30, T.R.Rajkumar wrote: When I do update_or_insert into a table in postgresql I get the following error. My code is below. class 'gluon.contrib.pg8000.errors.ProgrammingError' ('ERROR', '42601', 'syntax error at or near ') if form.process(keepvalues=True,onvalidation=validate_meas).accepted: j = 1 for i in range(1,n+1):#len(l)+1 if is_number(form.vars['txt%s%s' % (i,9)]): db.cms_meas_details.update_or_insert(db(db. cms_meas_details.agt_no==session.agt_no) (db.cms_meas_details.jcod== session.jcod) (db.cms_meas_details.meas_date==session.meas_date) (db. cms_meas_details.shift==session.shift) (db.cms_meas_details.line_no==j), meas_id=m_id,agt_no=session.agt_no, jcod=session.jcod, meas_date=session.meas_date, shift=session.shift, loc_of_work=form.vars['txt%s%s' % (i,1)], m_no=form.vars['txt%s%s' %(i,2)], m_times=form.vars['txt%s%s' %(i,3 )], m_length=form.vars['txt%s%s' %(i, 4)], m_breadth=form.vars['txt%s%s' %(i ,5)], m_depth=form.vars['txt%s%s' %(i,6 )], mat_code=form.vars['cmbMat%s%s' %(1,7)], unit_weight=form.vars['txt%s%s' %(i,8)], m_content=form.vars['txt%s%s' %(i ,9)], remarks=form.vars['txt%s%s' %(i, 10)], update_uid=e34789, update_dt=request.now, line_no=j) j = j + 1 def is_number(s): # Thanks a1an http://stackoverflow.com/questions/354038/how-do-i-check-if-a-string-is-a-number-in-python try: n=str(float(s)) if n == nan or n==inf or n==-inf : return False except ValueError: try: complex(s) # for complex except ValueError: return False return True Is this postgressql error? What should I do? How to debug and find what is wrong. Pl. help. -- 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: Displaying blob image on login page
I've tried both solutions and it's not working here 1) decode is giving me following error. 27.0.0.1.2014-12-02.13-01-39.af379677-6327-4f4c-bc93-5ed1e5e02ed8 class 'binascii.Error' Incorrect padding 2) Second option is not working. I've printed image path but it didn't display on login page. img src=data:image/gif;base64,/default/show_logo/company.logo.91f2753b1fabaab6.736571756f69615f6361706974616c5f6c6f676f2e676966.gif / On Tue, Dec 2, 2014 at 12:44 PM, Mandar Vaze mandarv...@gmail.com wrote: http://stackoverflow.com/questions/16279856/converting-blob-stored-on-a-database-to-an-image-on-an-html-website On Tuesday, December 2, 2014 12:09:25 PM UTC+5:30, Prasad Muley wrote: Hi All, I need to display logo according to url in login page. I tried to display the logo but it always shows *404 not found* error on login page. My app settings are below: *models/db.py* db.define_table('company', Field('name', 'text', notnull=True), Field('abbrev', 'string', length=32), Field('logo', 'upload', uploadfield=True, requires=IS_IMAGE()), Field('timezone', 'string', requires=IS_IN_SET(all_timezones)), Field('url', 'string', requires=IS_URL()), format='%(name)s') *controllers/default.py* def user(): exposes: http:///[app]/default/user/login http:///[app]/default/user/logout http:///[app]/default/user/register http:///[app]/default/user/profile http:///[app]/default/user/retrieve_password http:///[app]/default/user/change_password http:///[app]/default/user/manage_users (requires membership in use @auth.requires_login() @auth.requires_membership('group name') @auth.requires_permission('read','table name',record_id) to decorate functions that need access control #set some default name abbrev_name = 'ASDF' company_rec = db(db.company.url.contains(request.env.http_host)). select().first() if company_rec: abbrev = company_rec['abbrev'] logo = IMG(_src = URL('default', 'show_logo', company_rec['logo'])) session.company_timezone = company_rec['timezone'] return dict(form=auth(), abbrev=abbrev, logo=logo) def show_logo(): return response.download(request, db) *views/default/user.html:* html head /head body div class=logo style=display: inline-block; h2 {{=logo}} /h2 h2{{=abbrev}}/h2 /div !-- some code for login / log_out / change_password -- /body /head It shows following error as: 1. Remote Address: 127.0.0.1:8000 2. Request URL: https://127.0.0.1:8000/default/show_logo/investor. logo.91f2753b1fabaab6.736571756f69615f6361706974616c 5f6c6f676f2e676966.gif https://127.0.0.1:8000/default/show_logo/investor.logo.91f2753b1fabaab6.736571756f69615f6361706974616c5f6c6f676f2e676966.gif 3. Request Method: GET 4. Status Code: 404 NOT FOUND Is there any way to display blob image ? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/FndDA_sXQto/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Thanks and Regards Prasad M. Muley Programmer at One Delta Synergies Pvt Ltd. | PICT 2013 “Pretty much everything on the web uses those two things: *C* and *UNIX*,” - Dennis Ritchie *http://www.cs.bell-labs.com/who/dmr/* http://www.cs.bell-labs.com/who/dmr/ -- 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] Like the 1st example in the web2py book, can I customize my session.counter to count all sessions?
Please what I can do if I want to display the number of visits to each page of my site without restricting it to just individual sessions? Unlike the code below where it displays number of visits for a particular session, I want a situation where by I can put something like this at my footer. Since December 1, this page has been viewed 12499 times. Please help me with the code if you can, I tried everything possible to no avail. def index(): if not session.counter: session.counter = 1 else: session.counter += 1 return dict(message=Hello from MyApp, counter=session.counter) -- 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] dummy database to hold legacy db
Hi, I manage data from different people and display selected data on page. Therefore I work with a lot of legacy databases. I can automatic extract tables from these external dbs, then put them into a list of DAL objects. How can I unify the tables into one single db? Then the controller will see one dummy_db. when a request is made to dummy_db.table_one , the request will be wired to the real DAL object. I am not sure how I should proceed, any idea to share? Thanks, chuan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] web2py doesn't retrieve the latest user-memberships from ldap.
Hi Guys, I've a small question regarding the auth-module when using ldap. I know that when a user doesn't exist in the web2py tables, web2py will retrieve the user along it's membership into the db upon his first login. However i've noticed that web2py doesn't uypdate this info when the user is already known, but the memberships in ldap has been changed. Is this normal behaviour? And are there any known work-around for this? With kind regards. Jacobs Dennis. -- 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 a requirements file with a web2py application
Hello, i'm deploying some sites to apache and i'm wondering if there's built in support for a requirements file to ensure my project is using the correct versions of packages. I had a recent sitiuation where updating pandas created a bit of headache and i'd like to avoid that in the future by making sure my libraries don't update. Thank you for any advice! Jason -- 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 upload web2py code to git
Hi everyone, I am trying to figure out how to upload my code to GitHub from one of my applications on web2py. This must be simple to do without saving every file locally! Please help? 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: PostgreSQL migrate / fake_migrate_all failure with relation does not exists
Using the wiki as an example was a bit stupid. This happens to all my tables with a foreign key. The tables exist, but it happens when i add a field. As I understand fake_migrate it regenerates the meta data in databases. So if I first fake_migrate on the database that is exactly the same as my models. I expect turning on migrate to true to do nothing after the fake migrate. But it throws the error for every single table that have a foreign key. I have tried to empty the databases directory before the fake_migrate, but I'm still stuck. It still works on my production server. Copying to local with nothing changed throws the error as soon as I turn on migrate. (Also after fake migrate) I also downloaded and renamed the databases files from the server, to see if that would work. Thinking about it now, I have not fully deleted and recreate the entire local/develop pg_database / before import. Will try that next. Tom Ø. kl. 10:29:14 UTC+1 mandag 1. desember 2014 skrev Paolo Valleri følgende: Hi Tom, wiki's tables are not present. You have to include them during the migration, probably you have defined the wiki object in a controller? Paolo On Saturday, November 29, 2014 6:22:00 PM UTC+1, Tom Øyvind Hogstad wrote: My migrations suddenly failed with Error: class 'gluon.contrib.pg8000.errors.ProgrammingError' ('ERROR', '42P01', 'relation wiki_page does not exist') This will happen for any relation trying to commenting them out etc. Running a fake_migrate_all and the problem still persists, so I can not find a way around manually modify my PostgreSQL schema at the moment. Any suggestions? Web2Py: 2.9.11 PostrgeSQL: 9.3 Tom Ø. -- 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: form warning
Thank you Massimo, here is my situation: I would like to check if LastName and FirstName already exist in database and warn user but allow him to proceed (there are people with sam name and lastname). The idea is to issue a warning when user have just these two fields filled so that he do not fill whole form and finally find out that a person is already in database. Is javascript on client side with ajax call my best bet? Any sugestions? Dana ponedjeljak, 1. prosinca 2014. 07:18:54 UTC+1, korisnik Massimo Di Pierro napisao je: It depends on where you want to do. Personally I would not do this inside the validators. I would instead implement the checks after the form is accepted (since you want it to proceed anyway) form = SQLFORM.factory(Field('number','double')) if form.process().accepted: if not form.vars.number == int(form.vars.number): response.flash = 'ok but you did not insert an integer number' On Sunday, 30 November 2014 13:43:09 UTC-6, Alen Cerovic wrote: how to make a warning message in form based on some condition but allow to proceed validator? thnx -- 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: Getting Log details
Hi anybody knows how to view the log details in web2py framework? Let me know, i am waiting for the reply On Friday, November 28, 2014 4:12:32 PM UTC+5:30, Research Kamal wrote: Hi to all, I have an web2py framework and it is very good, and i want to know about some details like how to get user logs details, errors details, user management details and administration management. Thanks Mohemed -- 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] long running rpc call
Hi, We're making a number of rpc calls to other services using jsonrpc, and a few of them are particularly long running. I'd rather not use the scheduler, but instead was wondering if I could associate a jsonrpc httpclient in python to the current context so that longer tasks wouldn't block other incoming requests. I tried initially to just do a setattr on current (it's thread local storage as far as I understand), but that doesn't seem to work. Anyone have better ideas? Or am I just doing this completely wrong. Cheers, Matt -- 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: Displaying blob image on login page
Here: logo = IMG(_src = URL('default', 'show_logo', company_rec['logo'])) should be logo = IMG(_src = URL('default', 'show_logo', args=company_rec['logo'])) On Tuesday, 2 December 2014 00:39:25 UTC-6, Prasad Muley wrote: Hi All, I need to display logo according to url in login page. I tried to display the logo but it always shows *404 not found* error on login page. My app settings are below: *models/db.py* db.define_table('company', Field('name', 'text', notnull=True), Field('abbrev', 'string', length=32), Field('logo', 'upload', uploadfield=True, requires=IS_IMAGE()), Field('timezone', 'string', requires=IS_IN_SET(all_timezones)), Field('url', 'string', requires=IS_URL()), format='%(name)s') *controllers/default.py* def user(): exposes: http:///[app]/default/user/login http:///[app]/default/user/logout http:///[app]/default/user/register http:///[app]/default/user/profile http:///[app]/default/user/retrieve_password http:///[app]/default/user/change_password http:///[app]/default/user/manage_users (requires membership in use @auth.requires_login() @auth.requires_membership('group name') @auth.requires_permission('read','table name',record_id) to decorate functions that need access control #set some default name abbrev_name = 'ASDF' company_rec = db(db.company.url.contains(request.env.http_host)).select().first() if company_rec: abbrev = company_rec['abbrev'] logo = IMG(_src = URL('default', 'show_logo', company_rec['logo'])) session.company_timezone = company_rec['timezone'] return dict(form=auth(), abbrev=abbrev, logo=logo) def show_logo(): return response.download(request, db) *views/default/user.html:* html head /head body div class=logo style=display: inline-block; h2 {{=logo}} /h2 h2{{=abbrev}}/h2 /div !-- some code for login / log_out / change_password -- /body /head It shows following error as: 1. Remote Address: 127.0.0.1:8000 2. Request URL: https://127.0.0.1:8000/default/show_logo/investor.logo.91f2753b1fabaab6.736571756f69615f6361706974616c5f6c6f676f2e676966.gif 3. Request Method: GET 4. Status Code: 404 NOT FOUND Is there any way to display blob image ? -- 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: Displaying blob image on login page
Thanks Massimo, It works :) On Tue, Dec 2, 2014 at 1:13 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Here: logo = IMG(_src = URL('default', 'show_logo', company_rec['logo'])) should be logo = IMG(_src = URL('default', 'show_logo', args=company_rec['logo'])) On Tuesday, 2 December 2014 00:39:25 UTC-6, Prasad Muley wrote: Hi All, I need to display logo according to url in login page. I tried to display the logo but it always shows *404 not found* error on login page. My app settings are below: *models/db.py* db.define_table('company', Field('name', 'text', notnull=True), Field('abbrev', 'string', length=32), Field('logo', 'upload', uploadfield=True, requires=IS_IMAGE()), Field('timezone', 'string', requires=IS_IN_SET(all_timezones)), Field('url', 'string', requires=IS_URL()), format='%(name)s') *controllers/default.py* def user(): exposes: http:///[app]/default/user/login http:///[app]/default/user/logout http:///[app]/default/user/register http:///[app]/default/user/profile http:///[app]/default/user/retrieve_password http:///[app]/default/user/change_password http:///[app]/default/user/manage_users (requires membership in use @auth.requires_login() @auth.requires_membership('group name') @auth.requires_permission('read','table name',record_id) to decorate functions that need access control #set some default name abbrev_name = 'ASDF' company_rec = db(db.company.url.contains(request.env.http_host)). select().first() if company_rec: abbrev = company_rec['abbrev'] logo = IMG(_src = URL('default', 'show_logo', company_rec['logo'])) session.company_timezone = company_rec['timezone'] return dict(form=auth(), abbrev=abbrev, logo=logo) def show_logo(): return response.download(request, db) *views/default/user.html:* html head /head body div class=logo style=display: inline-block; h2 {{=logo}} /h2 h2{{=abbrev}}/h2 /div !-- some code for login / log_out / change_password -- /body /head It shows following error as: 1. Remote Address: 127.0.0.1:8000 2. Request URL: https://127.0.0.1:8000/default/show_logo/investor. logo.91f2753b1fabaab6.736571756f69615f6361706974616c 5f6c6f676f2e676966.gif https://127.0.0.1:8000/default/show_logo/investor.logo.91f2753b1fabaab6.736571756f69615f6361706974616c5f6c6f676f2e676966.gif 3. Request Method: GET 4. Status Code: 404 NOT FOUND Is there any way to display blob image ? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/FndDA_sXQto/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- Thanks and Regards Prasad M. Muley Programmer at One Delta Synergies Pvt Ltd. | PICT 2013 “Pretty much everything on the web uses those two things: *C* and *UNIX*,” - Dennis Ritchie *http://www.cs.bell-labs.com/who/dmr/* http://www.cs.bell-labs.com/who/dmr/ -- 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: SQLFORM.grid field is not empty if another field is full
Thanx. Nice solution On Monday, December 1, 2014 2:46:24 PM UTC+1, Anthony wrote: You can either use an onvalidation function or do something like: Field('end1', requires=IS_NOT_EMPTY() if request.post_vars.start1 else None) Anthony On Monday, December 1, 2014 8:27:30 AM UTC-5, Yebach wrote: Hello I have a SQLFORM.grid and I have to raise error for user if he inserts value into one field and not another. Example start 1 10:00 end 1 12:00 - has to show error if field is empty - start 2 16:00 - not necessary to be inserted end 2 20:00 - has to show error if start 2 is not empty What would be the best solution? 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.