[web2py] Re: I seem to block the server if I forget about dbg.set_trace
I can reproduce it and I think my observations above are completely correct. So I raised an issue. http://code.google.com/p/web2py/issues/detail?id=1313 -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: Create SQLFORM with one of its field's as ajax enabled
Hi Richardthanks for the link...the widget is working perfectly for all scenarios..:) On Thursday, 31 January 2013 10:29:29 UTC+5:30, newbie wrote: > Hi > I m a newbie working on web2py,and i want to create an SQLForm > with database Employee.The fields of db.Employee are name,campus,timzezone > .I want the user to input in the SQLform ,but the last filed of timezone > shud be such that when the user inputs in the field ,it shud present a > dropdown of fields from another database called 'timezone_countries'.The > user shud be able to select from the dropdown and submit the form .The code > i have written in DB,Default,and view are here respectively:- > DB.py > > db.define_table('Employee',Field('name'),Field('campus'),Field('timezone')) > > > db.define_table('timezone_countries',Field('countries')) > def timezone_countries_data(): > result = {} > result['countries'] = 'Brazil/Rio' > db.timezone_countries.insert(**result) > db.commit() > > DEFAULT.py > def timezone_countries_dataF(): > timezone_countries_data() > > def emp_input(): > form=SQLFORM(db.Employee) > return locals() > > def emp_selector(): > if not request.vars.emp_timezone: > --->where > > emp_timezone is the id of timezone in SQLFORM > return ' ' > pattern = request.vars.emp_timezone.capitalize() + '%' > selected = [row.countries for row in > db(db.timezone_countries.countries.like(pattern)).select()] > return ''.join([DIV(k, > _onclick="jQuery('#emp_timezone').val('%s')" % k, > _onmouseover="this.style.backgroundColor='yellow'", > _onmouseout="this.style.backgroundColor='white'" > ).xml() for k in selected]) > > View: > {{extend 'layout.html'}} > {{=form}} > > #suggestions { position: relative; } > .suggestions { background: white; border: solid 1px #55A6C8; } > .suggestions DIV { padding: 2px 4px 2px 4px; } > > >class="suggestions"> > > > > jQuery("#emp_timezone").keyup(function(){ > ajax('emp_selector', ['emp_timezone'], 'suggestions')}); > > > > Kindly help... > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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 seem to block the server if I forget about dbg.set_trace
dbg is the integrated web2py debugger in this case. The behaviour I observe is that rocket no longer reponds: I can't retrospectively open an admin session. I get no error tickets although maybe something is logged somewhere. I think it affects all users. This is running on windows, latest stable. I'll check more thoroughly and if I'm correct and if I can reproduce it, I'll file a report. On Friday, 1 February 2013 15:07:16 UTC+11, Tim Richardson wrote: > > I use dbg.set_trace for debugging. > Usually I remember to run an instance of web2py on an additional port and > use that for my debugging. > Sometime I forget to remove dbg.set_trace. > When I do that, I don't have a listening window open, so I guess rocket > stops but there is no one to hear it. > I'm on Windows. > When this happens, the server stops responding to all requests. I restart > the Windows service (which is basically python web2py.py) > > Is there a more elegant way of dealing with this situation? > > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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] create query for join multiple table
hi, how to create query for join multiple table? my goal is to select all data in company and show it in invoice page. *db.sale.created_by* refer to *db.auth_user.id* *db.auth_user.company_id* refer to *db.company.id* * * any suggestion, solutions or hints for this case? * * here is the model that i've used and some of query that i've tested in controller but have not work. *# model :* auth = Auth(db) db.define_table('company', Field('company_name', label=T('Company Name')), Field('address', 'text', label=T('address')), Field('zip', label=T('Zip')), Field('city', label=T('City')), Field('country', label=T('Country')), Field('phone', label=T('Phone')), Field('fax', label=T('Fax')), Field('email', label=T('Email')), Field('website', label=T('Website')), auth.signature, format='%(company_name)s') auth.settings.extra_fields['auth_user']=[ Field('address', 'text', label=T('address')), Field('zip', label=T('Zip')), Field('city', label=T('City')), Field('country', label=T('Country')), Field('phone', label=T('Phone')), Field('company_id', 'reference company', label=T('Company ID'))] auth.define_tables(username=False, signature=False) db.define_table('product', Field('product_name', label=T('Product Name')), Field('quantity', 'integer', label=T('Quantity')), Field('unit_price', 'double', label=T('Unit Price')), auth.signature, format='%(product_name)s') db.define_table('sale', Field('invoice_no', label=T('Invoice No.')), Field('product_id', 'reference product', label=T('Product ID')), Field('quantity', 'integer', label=T('Quantity')), Field('unit_price', 'double', label=T('Unit Price')), Field('total_price', 'double', label=T('Total Price')), Field('grand_total', 'double', label=T('Grand Total')), Field('note', 'text', label=T('Note')), auth.signature) the controller i've tried to use but have not run : *first* rows= db((db.company.id==db.auth_user.company_id)& (db.sale.created_by==db.auth_user.id)).select().first() *second* people_and_their_companies=db(db.auth_user.company_id==db.company.id) row=people_and_their_companies(db.sale.created_by==request.args (0)).select().first() *third* invoices_created_by=db(db.sale.invoice_no==request.args(0)).select(db.sale.created_by).first() query=(db.auth_user.id==invoices_created_by)&(db.auth_user.company_id==db.company.id) rows=db(query).select() *fourth* invoices_created_by=db(db.sale.invoice_no==request.args(0)).select(db.sale.created_by).first() companies=db(db.company.id==db.auth_user.company_id)&(db.company.id==invoices_created_by.created_by).select().first() thank you so much before -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: Unstructured table creation in DAL; akin to NoSQL?
On Fri, Feb 1, 2013 at 4:23 AM, Alan Etkin wrote: >> I am porting a library to web2py's DAL from pymongo; and looking > > > Sorry, may I ask what library? dal already has experimental support for > mymongo trough the MongoDBAdapter. Have you considered using/extending it? I am porting it to DAL from Mongo; allowing for Mongo + other DBs to be used + the DAL syntax and its many advantages (form generation & whatnot). Probably just 30 minutes of work left for it then another little bit for testing and it'll be ready. My fork is public and on github. Will post it on this list when it's fully tested + better documented. -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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] Create SQLFORM with one of its field's as ajax enabled
Hi Richard, Thanks for the answer. Actually i am able to achieve Ajax enabled text box in an SQLFORM...But the problem is the sqlform is auto generated by the SQLFORM.grid for that database. The code for SQLFORM which is working for normal tables is: DB.py db.define_table('tag',Field('name'),Field('campus'),Field('timezone')) def tag_data(): result = {} result['name'] = 'Neha' result['campus'] = 'Orion' result['timezone'] = 'America/newyork' db.tag.insert(**result) db.commit() db.define_table('timezone_list',Field('countries')) def timezone_list_data(): result = {} result['countries'] = 'Ireland' db.timezone_list.insert(**result) db.commit() def timezone_bulk(): db.timezone_list.bulk_insert([{'countries':'Africa/Abidjan'}, {'countries':'Africa/Accra'}, {'countries':'Africa/Addis_Ababa'}, {'countries':'Africa/Bamako'},{'countries':'America/Argentina/Buenos_Aires'}, {'countries':'America/Argentina/ComodRivadavia'}, {'countries':'America/Argentina/Rio_Gallegos'}, {'countries':'America/Cambridge_Bay'},{'countries':'America/Chicago'},{'countries':'America/Costa_Rica'},{'countries':'America/Detroit'}, {'countries':'Indian/Antananarivo'},{'countries':'Indian/Mahe'},{'countries':'Indian/Maldives'},{'countries':'Indian/Reunion'}, {'countries':'US/Hawaii'},{'countries':'US/Pacific'},{'countries':'UTC'},{'countries':'Zulu'}, {'countries':'Singapore'}]) db.commit() DEFAULT.py def month_input(): form=SQLFORM(db.tag) return locals() def month_selector(): if not request.vars.timezone: return '' pattern = request.vars.timezone.capitalize() + '%' selected = [row.countries for row in db(db.timezone_list.countries.like(pattern)).select()] return ''.join([DIV(k, _onclick="jQuery('#tag_timezone').val('%s'); jQuery('#suggestions').hide(); " % k, _onmouseover="this.style.backgroundColor='yellow'", _onmouseout="this.style.backgroundColor='white'", ).xml() for k in selected]) def timezone_list_dataF(): timezone_list_data() def timezone_bulkF(): timezone_bulk() month_input.html {{extend 'layout.html'}} {{=form}} #suggestions { position: relative; } .suggestions { background: white; border: solid 1px #55A6C8; } .suggestions DIV { padding: 2px 4px 2px 4px; } jQuery("#tag_timezone").keyup(function(){ jQuery('#suggestions').show(); ajax('month_selector', ['timezone'], 'suggestions')}); But i have to generate the same result for an auto generated SQLFORM.Actually we are using an sqlform.grid which has an inbuilt option for ADD.And on clicking on that an autogenerated SQLFORM for adding inputs opens.Now the goal is to add another field in that page which is ajax enabled.Can we do it?.Kindly helpThanks in advance.. On Thursday, 31 January 2013 20:32:13 UTC+5:30, Richard wrote: > Have you look at this plugin : > http://dev.s-cubism.com/plugin_lazy_options_widget > > It require a dependecy to suggest plugin as explained on the site, but you > can avoid using it. I already post answer to Jim on this list about that. > If you need more help with the integration of lazy option widget plugin let > me know... > > Richard > > > On Wed, Jan 30, 2013 at 11:59 PM, newbie >wrote: > >> Hi >> I m a newbie working on web2py,and i want to create an SQLForm >> with database Employee.The fields of db.Employee are name,campus,timzezone >> .I want the user to input in the SQLform ,but the last filed of timezone >> shud be such that when the user inputs in the field ,it shud present a >> dropdown of fields from another database called 'timezone_countries'.The >> user shud be able to select from the dropdown and submit the form .The code >> i have written in DB,Default,and view are here respectively:- >> DB.py >> >> db.define_table('Employee',Field('name'),Field('campus'),Field('timezone')) >> >> >> db.define_table('timezone_countries',Field('countries')) >> def timezone_countries_data(): >> result = {} >> result['countries'] = 'Brazil/Rio' >> db.timezone_countries.insert(**result) >> db.commit() >> >> DEFAULT.py >> def timezone_countries_dataF(): >> timezone_countries_data() >> >> def emp_input(): >> form=SQLFORM(db.Employee) >> return locals() >> >> def emp_selector(): >> if not request.vars.emp_timezone: >> --->where >> >> emp_timezone is the id of timezone in SQLFORM >> return ' ' >> pattern = request.vars.emp_timezone.capitalize() + '%' >> selected = [row.countries for row in >> db(db.timezone_countries.countries.like(pa
Re: [web2py] I seem to block the server if I forget about dbg.set_trace
If dbg is the integrated web2py debugger, you could just open a new interaction window (debug button in admin) and then continue. Rocket should not block or stop, except you exhaust all threads. If you get an error message or any other issue, please send it to us so we can review it. The more elegant way should be using breakpoints ;-) You can also pass a request.vars and enable set_trace only in that case. Best regards, Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Fri, Feb 1, 2013 at 1:07 AM, Tim Richardson wrote: > I use dbg.set_trace for debugging. > Usually I remember to run an instance of web2py on an additional port and > use that for my debugging. > Sometime I forget to remove dbg.set_trace. > When I do that, I don't have a listening window open, so I guess rocket > stops but there is no one to hear it. > I'm on Windows. > When this happens, the server stops responding to all requests. I restart > the Windows service (which is basically python web2py.py) > > Is there a more elegant way of dealing with this situation? > > > -- > > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from 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] I seem to block the server if I forget about dbg.set_trace
I use dbg.set_trace for debugging. Usually I remember to run an instance of web2py on an additional port and use that for my debugging. Sometime I forget to remove dbg.set_trace. When I do that, I don't have a listening window open, so I guess rocket stops but there is no one to hear it. I'm on Windows. When this happens, the server stops responding to all requests. I restart the Windows service (which is basically python web2py.py) Is there a more elegant way of dealing with this situation? -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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] Debugging in a server
AFAIK you could store the tickets in the db or coping the files and open them locally (maybe in another web2py instance) Code traces will go to your web server logging facility (if any). If you cannot access that, you could create a temp file and write the logs there. For more advanced methods, please check also the python logging module. Best regards, Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Wed, Jan 30, 2013 at 4:09 PM, Wonton wrote: > Hello everyone, > > Finally I have my project working in my local server so I've uploaded it to > the real server (via FTP to the applications directory). > It's working almost perfctly, but some features are giving errors and other > are simply not working (they return incorrect data). > > My problem, I have no admin access to the server (https is disabled by the > server admin and nowadays it's not possible to enable it). > > The errors return their tickets but the errors directories, both in my > project directory and in admin directory, are empty. > > In this environment how could I debug my project? Is there any way to check > the tickets? > And is there any way to insert code traces to check what is happening? I > inserted this code when debugging locally and saw the traces in my terminal, > but now, running web2py in the server, I can't launch it from a terminal, so > where could I see my traces?. > > Any help will be very appreciated. > > Kind regards! > > -- > > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from 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] Using the web2py online debugger
Can you send us a minimal example to reproduce this issue? The debugger uses the standard python debugger infrastructure (bdb), the same used by pdb. It should work correctly, but sometimes there are some subtle glitches maybe related to bdb. If you press continue, do you hit the breakpoint correctly? Best regards Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Thu, Jan 31, 2013 at 3:45 AM, Johann Spies wrote: > I have used other methods of debugging in the past including pdb. > > Today I have tried out for the first time the web2py online debugger and > there is something that I do not understand. > > I have set two temporary breakpoints in a controller. When that breakpoint > is reached, the debugger shows me the code of /usr/lib/python2.7/bdb.py line > 177 in the interact window and none of my local variables are available. > What is the point? > > Regards > > Johann > > -- > > Because experiencing your loyal love is better than life itself, > my lips will praise you. (Psalm 63:3) > > -- > > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from 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] DAL and MySQL indexing
Awesome, thanks for that! On Thursday, January 31, 2013 4:43:24 PM UTC-8, rochacbruno wrote: > > Since you have the indexes created on DB backend, The DAL will use this > for any query on that table, because the output of .select() is in fact a > pure SQL statement. > > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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] DAL and MySQL indexing
Since you have the indexes created on DB backend, The DAL will use this for any query on that table, because the output of .select() is in fact a pure SQL statement. -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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 and MySQL indexing
Simple question. My web2py app just received a heavy amount of traffic, and I was looking for ways I could optimize performance. I am currently using MySQL, and using a database query like rows = db(db.tablename.category=="category_name").select() I am aware that web2py does not automatically create indexes for the database table. After I've created indexes for the table, is it necessary to use Raw SQL through db.executesql() to take advantage of MySQL indexing, or can I still use the same DAL query? -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: sending mail to multiple clients
Thanks Bruno for your answer: > You should not do this on a "request" time. > > It needs to be done on background process. > > You can check the web2py book example on email chapter, the scheduler or > redis[3] > > > [3] http://rochacbruno.com.br/web2py-and-redis-queue/ > Maybe I can use the redis library. I have to check if my hosting provider can install it. But I'm confused about using a background task. Really I need is to get feedback about the status of every sending mail and when these were finally sending even if the user change of web page (controller). Regards. Thanks, your help is greatly appreciated. -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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] Modules not detecting functions
Hello everyone! I have a project in a server without admin access so it's difficult for me to debug it, I have a strange problem and I'm lost with it. Basically my default.py has something like this: import mymodule def index(): value = mymodule.function() return value And inside modules directory I have mymodule.py, that has something like this: attribute = 'hello world' def function(): return 'goodbye world' If I run myapp/default/index the project doesn't work. Sometimes it gives me an error ("mymodule has no object called function), and sometimes it doesn't return anything. But if I do this in default.py: import mymodule def index(): value = mymodule.attribute return value it works and return 'goobye world', so default detects the attribute but not the function, why is this? Maybe I'm not building the module correctly? I've tried to put the module inside site-packages and I've tried to import the module with local_import and in both cases the results where indentical (the attribute is read correctly but the function doesn't work). I don't know what could I try so any help will be very appreciated. Kind regards! -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: a spreadsheet-like-table for user inserting data
There is a spreadsheet example included in web2py. I haven't used it yet. It sounds like a good place to start. http://www.web2py.com/examples/spreadsheet/index -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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] Question on websockets, modules and EMTE
I am trying to get web2py set up as a WSGI server on pythonanywhere.com. That is really easy, but alongside a regular http server I also need websockets server support. Because I would like to use WAMP as protocol on top of websockets, I have chosen Autobahn, which uses Twisted. The server setup seem to be similar to the Tornado server of the EMTE example. Here is a script that starts up a Flash webapp and the Autobahn server: https://github.com/tavendo/AutobahnPython/blob/master/examples/websocket/echo_wsgi/server.py The script loading web2py on pythonanywhere basically just says "from gluon.main import wsgibase as application", but it will probably stop working if the "reactor.run()" line from the Autobahn server does not return. I have studied the EMTE example, where the matching server is implemented in the modules dir, but I have a few questions: 1) Modules seem to be normally used for logic code in web2py, to be imported/used in controllers . that's how it is explained on the slices site as well. But the EMTE matching server seem to be a stand alone python program, is this correct? It also seems that Massimo starts up the server manually in the Vimeo video. 2) If so, is there any way to have web2py start the matching server (or a similar websockets server) when web2py is started up from the WSGI script? Is there a method I can hook into, that is called at startup - that way I could start a thread that runs the WS server rather than the __main__ from the module. I would prefer this over running the Autobahn server from the WSGI script. And while we are at it, what about closedown? 3) The EMTE matching server seem to only receive/send websocket messages and not do any database access. Can the server just import DAL and read/write the database that the regular web2py server also use? Are there any potential thread/process concurrency issues with this if the database is an SQLite file, or should a client/server SQL DB be used instead? Thanks, Jens Kristian Jensen -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: contribute: db diagram for web2py appadmin
Very nice. Excellent work Paolo. Jose -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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] wiki: how to cache media files?
Hi all, today I discovered that wiki media, actually they are all images, they are always requested to the server and never cached by the client. In other words, even if I have already visited the page I do a get to download all the images instead of using those in the browser cache as commonly happens with for js or css. Is it a problem of my configuration or of wiki it self? paolo -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: Unstructured table creation in DAL; akin to NoSQL?
> > I am porting a library to web2py's DAL from pymongo; and looking > Sorry, may I ask what library? dal already has experimental support for mymongo trough the MongoDBAdapter. Have you considered using/extending it? -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Unstructured table creation in DAL; akin to NoSQL?
I am porting a library to web2py's DAL from pymongo; and looking through it I'll likely need to write something like these two lines (and the corresponding function): if not db[tablename]: create_my_tables() Which is fine; but got me thinking. Can we add support for unstructured data in DAL? - Specifically generalised key-value pair type things? Thanks for your consideration, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Preferred method for banning email domains from registering?
Yep, just tried it, and it appears to be working well! Thanks a lot, Andrew. -Lamps On Thursday, January 31, 2013 10:31:22 AM UTC-5, Andrew Buchan wrote: > > Lamps, > > I believe using banned is the best way of doing it. You would cover > multiple domains in the regex. > > The following snippet would ensure that addresses ending in gmail.com or > hotmail.com fail registration... > > auth_table.email.requires = [ > IS_EMAIL(error_message=auth.messages.invalid_email, > banned='^.*gmail\.com$|^.*hotmail\.com$'), > IS_NOT_IN_DB(db, auth_table.email) > ] > > Remember that the model files are plain python, so you could build up the > regex string from a list or external source before passing it to as a > parameter. > > regards, > > Andy. > > > On Thursday, January 31, 2013 12:29:18 PM UTC, Lamps902 wrote: >> >> Hi, web2py users. Is there a preferred method for banning a set of email >> domains from registering? I know that the IS_EMAIL() validator has a >> "banned" parameter, but is this the best way to go about this task? If so, >> is there a way to pass multiple domains to the "banned" parameter (I don't >> think it accepts a list)? Also, is this: >> ('^.*\domain_you_want_to_ban.com(|\..*)$') >> a reasonable regex for this purpose? Thank you. >> > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] converting URL to lowercase before dispatching
I have a web2py application say, at "http://127.0.0.1:8000/my_data";. I would like to make the URL case insensitive so that any users calling My_data, MY_Data, etc it gets remapped to the lowercase version of the URL. Any thoughts on how to do this? Olly -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: contribute: db diagram for web2py appadmin
Works nicely! +1 to adding this into appadmin and moving the static/view files into admin. It wouldn't need to replace the existing "graph model", there is plenty of space for another button next to it ;) Regards, Ales On Thursday, January 31, 2013 3:31:53 PM UTC+1, Paolo Caruccio wrote: > > first post updated: replaced following files > > db_diagram.html > corrected CDN links. Now the diagram works on https too > > db_diagram.py [please note that you must copy the code within this file > and paste at the bottom of web2py_app/controllers/appadmin.py] > deleted a print statement > > > > Il giorno mercoledì 30 gennaio 2013 17:23:21 UTC+1, Paolo Caruccio ha > scritto: >> >> I was not able to succesfully install pygraphviz on my windows7 64bit >> enviroment but I liked Jose's idea >> https://groups.google.com/d/topic/web2py/cFqD1M6rkc8/discussion, so I >> wrote a simple addendum to appadmin in order to show a graph representation >> of a database. >> It's not alternative to or a replacement of Jose's graph layout because >> there are substantial differences. >> "db diagram" is interactive (nodes are draggable and clickable) but you >> cannot save it as an image (anyway it's possible to use a third party >> application for screenshoots). >> Moreover it is customizable via css (you will find here attached a css >> theme for reference) and it's based on jqueryUI framewok. >> The nodes contain only the table name, so we can draw the layout of a >> database with (moderately) numerous tables. >> In order to see table data you have to click on the node. I added some >> infos like indexed columns (currently available only for sqlite but I think >> it's not hard to implement for other database engines), the list of other >> affected tables when we delete a row in cascade mode. >> The layout (the position of nodes on the screen) is generated trough a >> force-directed spring algorythm. Therefore the layout is generated >> dinamically and it will be different each time you refresh the page. >> For this scope, I adapted and translated to jQuery the original prototype >> source code freely distributed under the terms of a MIT-style license from >> http://snipplr.com/view/1950/graph-javascript-framework-version-001/ >> For a jquery version of this original source code you could visit >> http://www.graphdracula.net/ >> The edges are drawn by jsPlumb library ( >> http://www.jsplumb.org/jquery/demo.html ). All 1.x.x versions of jsPlumb >> are dual-licensed under both MIT and GPL version 2. >> Current main limitation: the database must have 'db' key in application >> databases dictionary. In other words in our model we must have >> db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all']) >> and not, for example, >> mydb = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all']) >> The screen dimensions are important too: the layout will be messed on >> small screens. >> The code has been tested on latest versions of Firefox, Chrome, Opera, >> IE(7,8,9) and on a very limited number of databases. So please check for >> errors and bugs. >> >> Installation: >> 1) append the code within in the attached db_diagram.py in >> your_application/controllers/appadmin.py file >> 2) put attached db_diagram.html in to your_application/views folder >> 3) create a new folder in your_application/static folder and name it >> "db_diagram" >> 4) in to latter put db_diagram.css, db_diagram_print.css, >> jquery.dbdiagram.js, pencildiagonals.png (an image create by me only for >> the css theme in bundle) (all these files are here attached) >> 5) download jsPlumb (jQuery release) from >> http://code.google.com/p/jsplumb/downloads/list and put >> jquery.jsPlumb-1.3.16-all-min.js file in your_application/static/db_diagram >> folder >> >> Usage: >> In your appadmin page you should see a new menu item "diagram" (see image >> 1), click on it and you should see the layout of your "db". >> >> That's all Folks! >> > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: Preferred method for banning email domains from registering?
Lamps, I believe using banned is the best way of doing it. You would cover multiple domains in the regex. The following snippet would ensure that addresses ending in gmail.com or hotmail.com fail registration... auth_table.email.requires = [ IS_EMAIL(error_message = auth.messages.invalid_email, banned = '^.*gmail\.com$|^.*hotmail\.com$'), IS_NOT_IN_DB(db, auth_table.email) ] regards, Andy. On Thursday, January 31, 2013 12:29:18 PM UTC, Lamps902 wrote: > > Hi, web2py users. Is there a preferred method for banning a set of email > domains from registering? I know that the IS_EMAIL() validator has a > "banned" parameter, but is this the best way to go about this task? If so, > is there a way to pass multiple domains to the "banned" parameter (I don't > think it accepts a list)? Also, is this: > ('^.*\domain_you_want_to_ban.com(|\..*)$') > a reasonable regex for this purpose? Thank you. > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Create SQLFORM with one of its field's as ajax enabled
Have you look at this plugin : http://dev.s-cubism.com/plugin_lazy_options_widget It require a dependecy to suggest plugin as explained on the site, but you can avoid using it. I already post answer to Jim on this list about that. If you need more help with the integration of lazy option widget plugin let me know... Richard On Wed, Jan 30, 2013 at 11:59 PM, newbie wrote: > Hi > I m a newbie working on web2py,and i want to create an SQLForm > with database Employee.The fields of db.Employee are name,campus,timzezone > .I want the user to input in the SQLform ,but the last filed of timezone > shud be such that when the user inputs in the field ,it shud present a > dropdown of fields from another database called 'timezone_countries'.The > user shud be able to select from the dropdown and submit the form .The code > i have written in DB,Default,and view are here respectively:- > DB.py > db.define_table('Employee',Field('name'),Field('campus'),Field('timezone')) > > > db.define_table('timezone_countries',Field('countries')) > def timezone_countries_data(): > result = {} > result['countries'] = 'Brazil/Rio' > db.timezone_countries.insert(**result) > db.commit() > > DEFAULT.py > def timezone_countries_dataF(): > timezone_countries_data() > > def emp_input(): > form=SQLFORM(db.Employee) > return locals() > > def emp_selector(): > if not request.vars.emp_timezone: > --->where > emp_timezone is the id of timezone in SQLFORM > return ' ' > pattern = request.vars.emp_timezone.capitalize() + '%' > selected = [row.countries for row in > db(db.timezone_countries.countries.like(pattern)).select()] > return ''.join([DIV(k, > _onclick="jQuery('#emp_timezone').val('%s')" % k, > _onmouseover="this.style.backgroundColor='yellow'", > _onmouseout="this.style.backgroundColor='white'" > ).xml() for k in selected]) > > View: > {{extend 'layout.html'}} > {{=form}} > > #suggestions { position: relative; } > .suggestions { background: white; border: solid 1px #55A6C8; } > .suggestions DIV { padding: 2px 4px 2px 4px; } > > >class="suggestions"> > > > > jQuery("#emp_timezone").keyup(function(){ > ajax('emp_selector', ['emp_timezone'], 'suggestions')}); > > > > Kindly help... > > -- > > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from 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: contribute: db diagram for web2py appadmin
first post updated: replaced following files db_diagram.html corrected CDN links. Now the diagram works on https too db_diagram.py [please note that you must copy the code within this file and paste at the bottom of web2py_app/controllers/appadmin.py] deleted a print statement Il giorno mercoledì 30 gennaio 2013 17:23:21 UTC+1, Paolo Caruccio ha scritto: > > I was not able to succesfully install pygraphviz on my windows7 64bit > enviroment but I liked Jose's idea > https://groups.google.com/d/topic/web2py/cFqD1M6rkc8/discussion, so I > wrote a simple addendum to appadmin in order to show a graph representation > of a database. > It's not alternative to or a replacement of Jose's graph layout because > there are substantial differences. > "db diagram" is interactive (nodes are draggable and clickable) but you > cannot save it as an image (anyway it's possible to use a third party > application for screenshoots). > Moreover it is customizable via css (you will find here attached a css > theme for reference) and it's based on jqueryUI framewok. > The nodes contain only the table name, so we can draw the layout of a > database with (moderately) numerous tables. > In order to see table data you have to click on the node. I added some > infos like indexed columns (currently available only for sqlite but I think > it's not hard to implement for other database engines), the list of other > affected tables when we delete a row in cascade mode. > The layout (the position of nodes on the screen) is generated trough a > force-directed spring algorythm. Therefore the layout is generated > dinamically and it will be different each time you refresh the page. > For this scope, I adapted and translated to jQuery the original prototype > source code freely distributed under the terms of a MIT-style license from > http://snipplr.com/view/1950/graph-javascript-framework-version-001/ > For a jquery version of this original source code you could visit > http://www.graphdracula.net/ > The edges are drawn by jsPlumb library ( > http://www.jsplumb.org/jquery/demo.html ). All 1.x.x versions of jsPlumb > are dual-licensed under both MIT and GPL version 2. > Current main limitation: the database must have 'db' key in application > databases dictionary. In other words in our model we must have > db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all']) > and not, for example, > mydb = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all']) > The screen dimensions are important too: the layout will be messed on > small screens. > The code has been tested on latest versions of Firefox, Chrome, Opera, > IE(7,8,9) and on a very limited number of databases. So please check for > errors and bugs. > > Installation: > 1) append the code within in the attached db_diagram.py in > your_application/controllers/appadmin.py file > 2) put attached db_diagram.html in to your_application/views folder > 3) create a new folder in your_application/static folder and name it > "db_diagram" > 4) in to latter put db_diagram.css, db_diagram_print.css, > jquery.dbdiagram.js, pencildiagonals.png (an image create by me only for > the css theme in bundle) (all these files are here attached) > 5) download jsPlumb (jQuery release) from > http://code.google.com/p/jsplumb/downloads/list and put > jquery.jsPlumb-1.3.16-all-min.js file in your_application/static/db_diagram > folder > > Usage: > In your appadmin page you should see a new menu item "diagram" (see image > 1), click on it and you should see the layout of your "db". > > That's all Folks! > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: Is there a way to use query in autocomplete with SQLFORM.factory?
For this reason I am using the auto complete jQuery UI provides: In the view: $(document).ready(function(){ $(function() { $("#no_table_computedName").autocomplete({ source: "{{=URL('jqueryui', 'elementnode_autocomplete')}}", minLength: 2 }); }); }); In a controller which I called jqueryui.py def elementnode_autocomplete(): rows=db((db.node.computedSubClass==SC_ORGANIZATION)&(db.node.computedName.like(request.vars.term+'%')))\ .select(db.node.computedName,distinct=True,orderby=db.node.computedName).as_list() result=[r['computedName']for r in rows] return response.json(result) Using Bootstrap's typeahead might also be an option. Kind regards, Annet -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: Redirect from inside a component
... and it works fine! Thank you Anthony Le jeudi 31 janvier 2013 14:52:21 UTC+1, Anthony a écrit : > > redirect(..., client_side=True) > > Instead of doing a regular redirect, that simply sends a Javascript > command to the browser instructing it to replace the whole page with the > new location. > > Anthony > > On Thursday, January 31, 2013 8:16:21 AM UTC-5, Loïc wrote: >> >> Thank you, but if I use "next" or "redirect" in my component's controler, >> the redirection is done in the component, not in the page that contains the >> component. >> >> For example, I have : >> -"Page1" which contains "component1" >> >> If I put redirect(URL('Page2')) in my "component1"'s controller, I will >> see: >> -"Page1" which contains "Page2" >> >> And I just want to see "Page2" >> >> Any idea? >> >> Le jeudi 31 janvier 2013 14:03:47 UTC+1, Lamps902 a écrit : >>> >>> Why not use the process() method's "next" parameter? >>> http://web2py.com/books/default/chapter/29/07?search=.accepted#The-process-and-validate-methods >>> >>> Otherwise, there's "redirect()" - >>> http://web2py.com/books/default/chapter/29/07?search=redirect%28#Forms-and-redirection >>> >>> >>> On Thursday, January 31, 2013 4:18:37 AM UTC-5, Loïc wrote: Hello All, I have a question about my application organized as follows: *A "main" page : render_page *A component "load_newsletter". This component displays a form with an "email" field and a "submit button" What I want to do : When the user fill the form in my component load_newsletter, I want to redirect the "main" page to an other page (full_newsletter) This other page contains a more complete form to add some information I don't know if I can redirect the page which contains a component, from inside this component? Example of code: ## View "render_page.html" ## {{extend 'layout.html'}} {{block right_sidebar}} {{=LOAD('default','load_newsletter.html',ajax=True)}} {{end}} ### ## Controller "load_newsletter" ## form=FORM(DIV(T('Your email'), _class='blueText'), INPUT(_name='email', _type='email', requires=IS_NOT_EMPTY()), INPUT(_type='submit')) if form.process().accepted: # > Here I want to redirect the page which contains me to "full_newsletter" < elif form.errors: response.flash = T('There was an error in the form') return dict(form=form) ### Thank you for your help -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: Redirect from inside a component
redirect(..., client_side=True) Instead of doing a regular redirect, that simply sends a Javascript command to the browser instructing it to replace the whole page with the new location. Anthony On Thursday, January 31, 2013 8:16:21 AM UTC-5, Loïc wrote: > > Thank you, but if I use "next" or "redirect" in my component's controler, > the redirection is done in the component, not in the page that contains the > component. > > For example, I have : > -"Page1" which contains "component1" > > If I put redirect(URL('Page2')) in my "component1"'s controller, I will > see: > -"Page1" which contains "Page2" > > And I just want to see "Page2" > > Any idea? > > Le jeudi 31 janvier 2013 14:03:47 UTC+1, Lamps902 a écrit : >> >> Why not use the process() method's "next" parameter? >> http://web2py.com/books/default/chapter/29/07?search=.accepted#The-process-and-validate-methods >> >> Otherwise, there's "redirect()" - >> http://web2py.com/books/default/chapter/29/07?search=redirect%28#Forms-and-redirection >> >> >> On Thursday, January 31, 2013 4:18:37 AM UTC-5, Loïc wrote: >>> >>> Hello All, >>> >>> I have a question about my application organized as follows: >>> *A "main" page : render_page >>> *A component "load_newsletter". This component displays a form with an >>> "email" field and a "submit button" >>> >>> What I want to do : >>> When the user fill the form in my component load_newsletter, I want to >>> redirect the "main" page to an other page (full_newsletter) >>> This other page contains a more complete form to add some information >>> >>> I don't know if I can redirect the page which contains a component, from >>> inside this component? >>> >>> Example of code: >>> >>> ## View "render_page.html" ## >>> {{extend 'layout.html'}} >>> {{block right_sidebar}} >>> {{=LOAD('default','load_newsletter.html',ajax=True)}} >>> {{end}} >>> ### >>> >>> ## Controller "load_newsletter" ## >>> form=FORM(DIV(T('Your email'), _class='blueText'), >>> INPUT(_name='email', _type='email', >>> requires=IS_NOT_EMPTY()), >>> INPUT(_type='submit')) >>> if form.process().accepted: >>> # > Here I want to redirect the page which contains me to >>> "full_newsletter" < >>> elif form.errors: >>> response.flash = T('There was an error in the form') >>> return dict(form=form) >>> ### >>> >>> Thank you for your help >>> >>> -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: Redirect from inside a component
Thank you, but if I use "next" or "redirect" in my component's controler, the redirection is done in the component, not in the page that contains the component. For example, I have : -"Page1" which contains "component1" If I put redirect(URL('Page2')) in my "component1"'s controller, I will see: -"Page1" which contains "Page2" And I just want to see "Page2" Any idea? Le jeudi 31 janvier 2013 14:03:47 UTC+1, Lamps902 a écrit : > > Why not use the process() method's "next" parameter? > http://web2py.com/books/default/chapter/29/07?search=.accepted#The-process-and-validate-methods > > Otherwise, there's "redirect()" - > http://web2py.com/books/default/chapter/29/07?search=redirect%28#Forms-and-redirection > > > On Thursday, January 31, 2013 4:18:37 AM UTC-5, Loïc wrote: >> >> Hello All, >> >> I have a question about my application organized as follows: >> *A "main" page : render_page >> *A component "load_newsletter". This component displays a form with an >> "email" field and a "submit button" >> >> What I want to do : >> When the user fill the form in my component load_newsletter, I want to >> redirect the "main" page to an other page (full_newsletter) >> This other page contains a more complete form to add some information >> >> I don't know if I can redirect the page which contains a component, from >> inside this component? >> >> Example of code: >> >> ## View "render_page.html" ## >> {{extend 'layout.html'}} >> {{block right_sidebar}} >> {{=LOAD('default','load_newsletter.html',ajax=True)}} >> {{end}} >> ### >> >> ## Controller "load_newsletter" ## >> form=FORM(DIV(T('Your email'), _class='blueText'), >> INPUT(_name='email', _type='email', >> requires=IS_NOT_EMPTY()), >> INPUT(_type='submit')) >> if form.process().accepted: >> # > Here I want to redirect the page which contains me to >> "full_newsletter" < >> elif form.errors: >> response.flash = T('There was an error in the form') >> return dict(form=form) >> ### >> >> Thank you for your help >> >> -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: Redirect from inside a component
Why not use the process() method's "next" parameter? http://web2py.com/books/default/chapter/29/07?search=.accepted#The-process-and-validate-methods Otherwise, there's "redirect()" - http://web2py.com/books/default/chapter/29/07?search=redirect%28#Forms-and-redirection On Thursday, January 31, 2013 4:18:37 AM UTC-5, Loïc wrote: > > Hello All, > > I have a question about my application organized as follows: > *A "main" page : render_page > *A component "load_newsletter". This component displays a form with an > "email" field and a "submit button" > > What I want to do : > When the user fill the form in my component load_newsletter, I want to > redirect the "main" page to an other page (full_newsletter) > This other page contains a more complete form to add some information > > I don't know if I can redirect the page which contains a component, from > inside this component? > > Example of code: > > ## View "render_page.html" ## > {{extend 'layout.html'}} > {{block right_sidebar}} > {{=LOAD('default','load_newsletter.html',ajax=True)}} > {{end}} > ### > > ## Controller "load_newsletter" ## > form=FORM(DIV(T('Your email'), _class='blueText'), > INPUT(_name='email', _type='email', > requires=IS_NOT_EMPTY()), > INPUT(_type='submit')) > if form.process().accepted: > # > Here I want to redirect the page which contains me to > "full_newsletter" < > elif form.errors: > response.flash = T('There was an error in the form') > return dict(form=form) > ### > > Thank you for your help > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: a spreadsheet-like-table for user inserting data
> > Now, i thought this would be easy but it has been harder than it seemed. > How can i define an array (of 15*50 for example) that accepts numeric > values, doesn't need to store them anywhere apart from that session, and > doesn't need to allow calculation with them as the spreadsheets i've seen? > I just want to define the website version of an numpy array! > My approach: tools: TABLE, FORM, INPUT, SELECT, OPTION code: # I assume only text input needed table = TABLE(*[TR(*[TD(INPUT(_type="text", _name="%s_%s" % (n, m))) for m in range()]) for r in range()]) form = FORM(SELECT(*[OPTION() for f in ], _name="function"), table) if form.process().accepted: """Do calculations. The function name is retrieved with form.vars.function Form data is accesible with form.vars["%s_%s" % (n, m)] Then apply changes to form.vars values""" ... return dict(form=form) -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] How do you check user-uploaded files for malware?
Has anybody had success using a malware/virus-scanning module/tool to scan user-uploaded files on their web2py page? Any suggestions as to how to go about doing this? Thanks! -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] a spreadsheet-like-table for user inserting data
Hi folks. I'm completely new to web2py, having discovered it only this week, so i apologize if this question has been ansewered already or if it is too basic. I'm working a on putting a simple assessment tool on the web, for a scientific goal. I have written a dozen of functions that act on a simple array(matrix like) of data in numeric values. The idea is for the users to be able to access a simple webpage that has an array for them to fill with their desired data, select the functions they want to compute, and the table and some constants go in to the functions wich return the updated table. Now, i thought this would be easy but it has been harder than it seemed. How can i define an array (of 15*50 for example) that accepts numeric values, doesn't need to store them anywhere apart from that session, and doesn't need to allow calculation with them as the spreadsheets i've seen? I just want to define the website version of an numpy array! thanks for your help! -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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] Preferred method for banning email domains from registering?
Hi, web2py users. Is there a preferred method for banning a set of email domains from registering? I know that the IS_EMAIL() validator has a "banned" parameter, but is this the best way to go about this task? If so, is there a way to pass multiple domains to the "banned" parameter (I don't think it accepts a list)? Also, is this: ('^.*\domain_you_want_to_ban.com(|\..*)$') a reasonable regex for this purpose? Thank you. -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Coding of the future?
On 31 January 2013 13:03, Jason Brower wrote: > Interesting that we have coding tools built into our framework. > http://www.webdesignerdepot.com/2013/01/web-ides-the-future-of-coding/ > > When webeditors become as good as emacs, vim, bluefish, I will consider it. For now I did not find any editor that can compete with them. Regards. Johann Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: Is there a way to use query in autocomplete with SQLFORM.factory?
Currently autocomplete does not have a parameter to create a subset, but it would be a nice addition. On Thursday, January 24, 2013 6:14:56 AM UTC-5, Dragan Matic wrote: > > I would like autocomplete to show just a subset of data, not all rows in > table. Is it possible to use query in autocomplete like this? > > > query = db.recipe.user_id==auth.user_id > > form=SQLFORM.factory(Field('title', 'string', required=True, requires= > IS_NOT_EMPTY()), > Field('type', 'string', > widget=SQLFORM.widgets.autocomplete(request, db(query).select > (db.recipe.type), limitby=(0, 10), min_length=2)), > Field('body', 'text')) > > > This currently throws the following exception: > 'Rows' object has no attribute > 'tablename' > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: Autocomplete problem ...
Not an easy one. For the widget to work properly the field names should be created at call time not at init time but the callback uses the one from init. Minimizing backward incompatibilities is another concern. As an additional enhancement it could take a query to define a subset of the values. On Tuesday, January 29, 2013 9:18:31 AM UTC-5, Massimo Di Pierro wrote: > > Can you submit a patch? > > On Tuesday, 29 January 2013 05:36:53 UTC-6, DenesL wrote: >> >> >> You have found a bug. >> >> The problem is that identical field names are being generated in the form >> for both Relation fields: >> > name="_autocomplete_Person_name_aux" ... >> > name="_autocomplete_Person_name_aux" ... >> > value="" /> >> > value="" /> >> >> >> >> -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: Interesting about JSON license...
> > The best option would be to have this fixed by simplejson/json, ... I opened a new thread for the spacing issue: https://groups.google.com/d/topic/web2py-developers/LyoEi-wJ_OQ/discussion -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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] Create SQLFORM with one of its field's as ajax enabled
Hi I m a newbie working on web2py,and i want to create an SQLForm with database Employee.The fields of db.Employee are name,campus,timzezone .I want the user to input in the SQLform ,but the last filed of timezone shud be such that when the user inputs in the field ,it shud present a dropdown of fields from another database called 'timezone_countries'.The user shud be able to select from the dropdown and submit the form .The code i have written in DB,Default,and view are here respectively:- DB.py db.define_table('Employee',Field('name'),Field('campus'),Field('timezone')) db.define_table('timezone_countries',Field('countries')) def timezone_countries_data(): result = {} result['countries'] = 'Brazil/Rio' db.timezone_countries.insert(**result) db.commit() DEFAULT.py def timezone_countries_dataF(): timezone_countries_data() def emp_input(): form=SQLFORM(db.Employee) return locals() def emp_selector(): if not request.vars.emp_timezone: --->where emp_timezone is the id of timezone in SQLFORM return ' ' pattern = request.vars.emp_timezone.capitalize() + '%' selected = [row.countries for row in db(db.timezone_countries.countries.like(pattern)).select()] return ''.join([DIV(k, _onclick="jQuery('#emp_timezone').val('%s')" % k, _onmouseover="this.style.backgroundColor='yellow'", _onmouseout="this.style.backgroundColor='white'" ).xml() for k in selected]) View: {{extend 'layout.html'}} {{=form}} #suggestions { position: relative; } .suggestions { background: white; border: solid 1px #55A6C8; } .suggestions DIV { padding: 2px 4px 2px 4px; } jQuery("#emp_timezone").keyup(function(){ ajax('emp_selector', ['emp_timezone'], 'suggestions')}); Kindly help... -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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] Redirect from inside a component
Hello All, I have a question about my application organized as follows: *A "main" page : render_page *A component "load_newsletter". This component displays a form with an "email" field and a "submit button" What I want to do : When the user fill the form in my component load_newsletter, I want to redirect the "main" page to an other page (full_newsletter) This other page contains a more complete form to add some information I don't know if I can redirect the page which contains a component, from inside this component? Example of code: ## View "render_page.html" ## {{extend 'layout.html'}} {{block right_sidebar}} {{=LOAD('default','load_newsletter.html',ajax=True)}} {{end}} ### ## Controller "load_newsletter" ## form=FORM(DIV(T('Your email'), _class='blueText'), INPUT(_name='email', _type='email', requires=IS_NOT_EMPTY()), INPUT(_type='submit')) if form.process().accepted: # > Here I want to redirect the page which contains me to "full_newsletter" < elif form.errors: response.flash = T('There was an error in the form') return dict(form=form) ### Thank you for your help -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: Interesting about JSON license...
> > I do not think any of the existing libraries handle it. One option is > fixed in simplejson and submit a patch to the authors. Another option is to > fix in gluon.serializers. A third option is to fix in the jsonp view (as > the article suggests). > The best option would be to have this fixed by simplejson/json, however, I don't think they will accept it, because this is not a specific json encode/decode issue, unless they want to add the feature to catch the bad javascript. I think web2py should handle this instead. Wouldn't be better to prevent users from using those characters in json input? (not a rhetorical question) -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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] Coding of the future?
Interesting that we have coding tools built into our framework. http://www.webdesignerdepot.com/2013/01/web-ides-the-future-of-coding/ BR, Jason Brower -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: What is the Salt used in web2py
search in web2py sources may be here https://github.com/web2py/web2py/blob/master/gluon/validators.py -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: Example JSON Code
did you try opening directly the url that is failing through ajax ? that 404 could be originated by an incorrect/mispelled url. On Thursday, January 31, 2013 12:36:56 AM UTC+1, pal...@gmail.com wrote: > > We just started using web2py where I work. We created our 1st webpage and > it uses JSON calls: One to retrieve database info and the second to status > the selected info. We created a 2nd screen using the 1st as a template. > On the 2nd screen, our JSON call to retrieve database info works. > However, the 2nd JSON call to perform the status won't work. It returns > the following: > > *errMsg =Requested page not found. [404]* > *status =error* > *errorThrown =NOT FOUND* > *xhr.status= 404* > > The HTML, jQuery and Python code are very similar to the working screen. > The one difference is that we are using an *.ajax* call instead of a * > .post* because I couldn't figure out how to write the error handling for > the .post statement. Also, I read somewhere that *.post* calls *.ajax*so it > really shouldn't matter > > What else should we look at besides the error code and text? > > Is there an example .html and .py file with JSON calls that we can look at? > > I've searched the web for Javascript, web2py, jQuery and JSON examples and > tried dozens of example but we can't figure out why this call won't work. > > Is there something else we should be looking at? > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: What is the Salt used in web2py
How can i do it without the validate function or what do the validate function do exactly ? am working with an API so am using another language , so i need to do what the validate dose . regards, On Thu, Jan 31, 2013 at 11:16 AM, Vasile Ermicioi wrote: > lets say you want to control manually if some string is the password of > the user > > email='some@email' > pwd='12312312' > hashed_pwd = db.auth_user.password.validate(pwd)[0] # I suppose this is > what you want > if > db(((db.auth_user.password==hashed_pwd)&(db.auth_user.email==email)).count(): > #do something > > > -- > > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from 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: https at webfaction.
The function: request.requires_https() might be what you're looking for. On Wednesday, January 30, 2013 2:46:08 PM UTC, Annet wrote: > > I the past I hosted a web2py application at Webfaction. I had a dedicated > IP address, and added: > > domains: mydomain.com, www.mydomain.com and admin.mydomain.com > application: web2py > websites: a normal and an encrypted website. > > and added domains mydomain.com and www.domain.com and application web2py > to the normal website > and domain admin.mydomain.com and application web2py to the encrypted > website. > > For some reason this was sufficient to access my application and access > appadmin, I didn't have to add > any additional code. > > Today I posted the following question: > > > I am developing a web application in web2py, the controllers follow the > pattern: > addressbook/cmsaddressbook > about/cms/about > calendar/cmscalendar > I know I can create a secure website, however, I don't want the entire > site to be secure, > just cmsaddressbook, cmsabout and cmscalendar. Is that possible? > > > I got the following reply: > > > Yes, this can be done by redirecting to HTTPS in your application for the > needed URLs. > To do so, your application must still have an HTTPS version with an HTTPS > website record, > and you'll need an SSL certificate installed. > > Once that's done, you can redirect to HTTPS for certain URLs based on > context. This would > be similar to the following: > http://community.webfaction.com/questions/3211/apache-conf-http-and-https > In short, your application can use the value of the > %{HTTP:X-Forwarded-SSL} HTTP variable to > determine if the user arrived via HTTP or HTTPS, and then redirect to > HTTPS for only the pages you > want to use HTTPS for. > > > I think I do understand the first part of this reply, but I have no idea > how the second part is related to > web2py's features. How does appadmin make me arrive via https? > > > Kind regards, > > Annet. > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: What is the Salt used in web2py
lets say you want to control manually if some string is the password of the user email='some@email' pwd='12312312' hashed_pwd = db.auth_user.password.validate(pwd)[0] # I suppose this is what you want if db(((db.auth_user.password==hashed_pwd)&(db.auth_user.email==email)).count(): #do something -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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: What is the Salt used in web2py
If you do db.auth_user.validate_and_insert(...) to insert a new record, it will run all the validators just like when a form is submitted, so it should handle the hashing as usual (there's also a .validate_and_update()method for updates). Anthony On Thursday, January 31, 2013 2:53:46 AM UTC-5, Hassan Alnatour wrote: > > Dear ALL , > > How can i find the salt used in web2py to encrypt the passwords ? now as i > understand if i want to encrypt the password manually i need to do it like > this ? > > CRYPT(digest_alg='md5',key='mykey',salt=True) > > is this correct , am a bit lost !! i need to understand how can i do the > same password encryption done to the passwords in the auth_user > table manually ? > > Best Regards , > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from 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.