[web2py] Re: FDB (firebird) adapter can't store blobs greater than 64k
Bummer, than it's probably a problem within the driver itself... need to debug it or wait that someone picks it and see what's going on. Il giorno martedì 2 luglio 2013 00:55:43 UTC+2, Raul Monares ha scritto: I'm using python fdb 1.4. The field is defined as blob sub_type 0, because I'm storing PDF's On Monday, July 1, 2013 1:23:42 PM UTC-6, Niphlod wrote: what driver are you using ? DAL creates 'blob' fields as BLOB SUB_TYPE 1 can you please check that the field is created indeed as BLOB SUB_TYPE 1 watching your databases/sql.log file ? This is an excerpt from firebird documentation *Sub-type is 1.** * *This blob field sub-type is designed for the storage and manipulation of text. Typically, this is free-form memo or notes data. Typically you would use this blob field sub-type is for storing large amounts of text data. This is more convenient that a large VARCHAR because, unlike a VARCHAR, there is no 32K limit.* On Monday, July 1, 2013 7:21:03 PM UTC+2, Raul Monares wrote: When trying to store a value greater than 64k in a Blob Field, I get this error: class 'fdb.fbcore.DatabaseError' ('Error while preparing SQL statement:\n- SQLCODE: -104\n- Dynamic SQL Error\n- SQL error code = -104\n- Unexpected end of command - line 1, column 25', -104, 335544569) But with blobs smaller than 64k works fine. -- --- 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: Select table in drop down import the file and edit
Your code includes: web2py_component({{=URL('default', 'form.load')}} + / + jQuery(this).val(), target='form') That will issue an ajax request. I was asking what URL ends up getting requested by the browser. Anthony On Thursday, June 27, 2013 1:12:00 AM UTC-4, Rohitraj Sharma wrote: Hi Anthony I am not able to get your question. I have one form controller with one view. http://127.0.0.1:8000/tracker/default/form when i run this url its show 404 error. Actually what is my requirement, I have one csv file. which i have to upload. Before saving the file in database, i want to edit in browser. After editing i want to save in database. Is there any method to do. Thanks On Wednesday, 26 June 2013 19:09:00 UTC+5:30, Anthony wrote: Using the browser developer tools, what URL gets requested when the ajax call is made? On Wednesday, June 26, 2013 2:44:18 AM UTC-4, Rohitraj Sharma wrote: I want to select some particular table from database in a drop dowan. Then import csv file. edit that file and update. . Can Any one can help me plz i am using the fallowing code for that View script jQuery(function() { jQuery('#table').change(function() { web2py_component({{=URL('default', 'form.load')}} + / + jQuery(this).val(), target='form') })})/script {{=SELECT('Select a table', *db.tables, _id='table')}}div id=form/div Controller def form(): if request.args(0) in db.tables: response.generic_patterns = ['load'] return dict(form=SQLFORM(db[request.args(0)]).process()) else: raise HTTP(404) every time it toll else part. can any one help me. -- --- 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] Help with query with count not showing values for zero
Hi everyone. I want to show the number of logins for every user in the last 7 days in a view. I'm using this query: log_count=db.auth_event.id.count() usrs = db((db.auth_event.user_id==db.auth_user.id)(db.auth_event.time_stampdatetime_start)(db.auth_event.time_stampdatetime_end)(db.auth_event.description.contains('Logged-in'))).select(db.auth_user.ALL,log_count) This is working, except that user that have not logged in in the last 7 days won't show up as a result in my query. Could some one help correct my query? I have search through out the forum and docs but couldn't find and answer. And when googling for an answer in SQL it talks about COALESCE and also DISTINCT and tried both but had no luck. 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] Error in User Management via privileged users
Hello All I try to implement User Management via privileged users ( http://web2py.com/books/default/chapter/29/09?search=User+Management+via+privileged+users#User-Management-via-privileged-users-%28Experimental%29 ) In my db.py, I added the following line after creating my auth object auth.settings.manager_group_role = 'manager' I also copy/paste the new appadmin controller and the new appadmin.html view from Welcome app In the menu I added the appadmin link URL('appadmin','auth_manage') But when I log in my app with a manager user and I clic on appadmin link I got an error : type 'exceptions.AttributeError' 'NoneType' object has no attribute '_plural' Version web2py™ Version 2.5.1-stable+timestamp.2013.06.06.15.39.19 Python Python 2.7.3: C:\Python27\python.exe (prefix: C:\Python27) Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Traceback (most recent call last): File C:\Users\___\Google Drive\web2py\gluon\restricted.py, line 212, in restricted exec ccode in environment File C:/Users/___/Google Drive/web2py/applications/ud/controllers/appadmin.py http://127.0.0.1:8000/admin/default/edit/udsp25/controllers/appadmin.py, line 615, in module File C:\Users\___\Google Drive\web2py\gluon\globals.py, line 194, in lambda self._caller = lambda f: f() File C:/Users/___/Google Drive/web2py/applications/ud/controllers/appadmin.py http://127.0.0.1:8000/admin/default/edit/udsp25/controllers/appadmin.py, line 590, in auth_manage auth.settings.table_user._plural = T('Users') AttributeError: 'NoneType' object has no attribute '_plural' Do you know where I am wrong? 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] Horrifically slow AJAX -- how to debug?
I have an issue, but my question is really a meta issue about the issue... I'm developing a large database application which uses a postgres server which is separate from the web2py installation (on nginx). When geting pages currently the time to fetch a page is 2-10 seconds! I have profiled the database -- it's returning the data in about 100ms. I profiled the controller (including the database) and it's responding in 200-400ms. So my task is to find the extra 1.5 to 9.5 seconds. Which leads to my question -- how to debug issues like this? I'm familiar with postgres and the tools there to analyze and explain a query. I can instrument my web2py code and have it tell me the resulting time to run a controller. But the overall application, with the interaction of two computers, browsers, etc. is just too fragmented for me to see where the time is going and it's too complicated to post a simple example here and have one of you geniuses tell me the problem. I really need some strategies for debugging these system issues myself. Any tips or tools I should be looking at? (For example I have an use WingIDE which has been very helpful with some issues but not this one so much.) Joe -- --- 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] web2py.com down, showing error ticket links
The site is showing error ticket links regardless of the site section (home page, book, etc) ...:( -Jim -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Database row update problem !
wow!! many many thanks.. :) On Tue, Jul 2, 2013 at 10:15 AM, Anthony abasta...@gmail.com wrote: You left out some critical code from the original question -- your Javascript sends each post request twice: function send_data(id){ $.post({{=URL('contest','flip_contest_status')}}, {id: id} ); $.post({{=URL('contest','flip_contest_status')}}, {id: id} ) .done(function(data) { window.location.replace({{URL('contest','configure')}}); }); } If you delete that first $.post line, everything seems to work fine. One other problem, though: def flip_contest_status(): id = request.post_vars. id row = db(db.contest.id == 13).select(db.contest.running, db.contest. name).first() You probably forgot to revert after debugging, but above you have hard-coded and id of 13 into the query. Anthony On Monday, July 1, 2013 10:55:17 PM UTC-4, Ahmad Faiyaz wrote: here is the database definition: db.define_table('contest', Field('name', length=128 ), Field('contest_host', length=128,), Field('duration', 'time' ), Field('time_passed','time', default = 0), Field('rank_frozen','time', default = 0), Field('running',length= 10, readable=False, default = no), Field('lang')) db.contest.name.requires = [IS_NOT_IN_DB(db,db.contest.**namehttp://db.contest.name), IS_NOT_EMPTY()] db.contest.contest_host.**requires = [IS_NOT_EMPTY()] db.contest.duration.requires = [IS_NOT_EMPTY()] db.contest.lang.requires=IS_**IN_SET(['C', 'C++', 'JAVA', 'Python'], multiple=True) db.contest.lang.widget = hmultiselect_widget then here is my controller which will show the SQLFORM Grid: @auth.requires_permission('**manage') def configure(): grid = SQLFORM.grid(db.contest,fields = [db.contest.id, db.contest.name, db.contest.contest_host, db.contest.duration, db.contest.time_passed , db.contest.rank_frozen],**create=False, links = [contest_buttons] , details=False ) return dict(grid = grid) Then here is my code which will flip the value of db.contest.running def flip_contest_status(): id = request.post_vars.id row = db(db.contest.id == id).select(db.contest.running, db.contest.name).first() value = if row.running == 'no': value = 'yes' #session.flash = row.running elif row.running == 'yes': value = 'no' #session.flash = row.running else: abd = sd db(db.contest.id == id).update(running = value) session.flash = row.running return locals() Here is my db.contest table: contest.idhttp://localhost:8000/SAI_BETA/appadmin/select/db?orderby=contest.id contest.namehttp://localhost:8000/SAI_BETA/appadmin/select/db?orderby=contest.name contest.contest_hosthttp://localhost:8000/SAI_BETA/appadmin/select/db?orderby=contest.contest_host contest.durationhttp://localhost:8000/SAI_BETA/appadmin/select/db?orderby=contest.duration contest.time_passedhttp://localhost:8000/SAI_BETA/appadmin/select/db?orderby=contest.time_passed contest.rank_frozenhttp://localhost:8000/SAI_BETA/appadmin/select/db?orderby=contest.rank_frozen contest.runninghttp://localhost:8000/SAI_BETA/appadmin/select/db?orderby=contest.running contest.langhttp://localhost:8000/SAI_BETA/appadmin/select/db?orderby=contest.lang 13 http://localhost:8000/SAI_BETA/appadmin/update/db/contest/13 Testme 07:33:5306:33:54 06:33:55no|C++| 14http://localhost:8000/SAI_BETA/appadmin/update/db/contest/14 faiyaz26 me06:34:2307:34:2206:34:25 no|C| I used session.flash to check what kind of value is fetching, and it is showing *yes* for contest.id = 13 and 14 If i update the value of db.contest.running for db.contest.id =13 to yes from no, it shows *no* then what to do then ? You can download the whole w2p file from here: https://dl.dropboxusercontent.**com/u/34972503/web2py.app.SAI_**BETA.w2phttps://dl.dropboxusercontent.com/u/34972503/web2py.app.SAI_BETA.w2p username: administrator pass: admin1234 then go to contest/configure to check !! use start , stop button to update the status. On Tue, Jul 2, 2013 at 8:40 AM, Anthony abas...@gmail.com wrote: Can you show the code you are now using and describe the workflow of how the record gets updated and how you are then attempting to view the updated record? Anthony On Monday, July 1, 2013 8:37:32 PM UTC-4, Ahmad Faiyaz wrote: weird things happening, when i check the db table with appadmin, it shows for contest.running = yes [ updated the value with sqlform.grid ] , but when i fetch the row with DAL on app, it shows contest.running = no [ which is the default ] why ? On Tue, Jul 2, 2013 at 6:18 AM, Ahmad Faiyaz faiy...@gmail.com wrote: thanks, but it sometimes work, sometimes doesn't !! what can be the problem ! On Tue, Jul 2, 2013 at 5:34 AM, Alex mrau...@gmail.com wrote: from the documentation: update_record should not be confused with row.update(name='Curt') because for a single row, the method update
Re: [web2py] Help with query with count not showing values for zero
Your problem is about SQL. You need to use LEFT JOIN. This will help you: http://web2py.com/books/default/chapter/29/06#Left-outer-join On Mon, Jul 1, 2013 at 9:49 PM, Francisco Betancourt franci...@betanetweb.com wrote: Hi everyone. I want to show the number of logins for every user in the last 7 days in a view. I'm using this query: log_count=db.auth_event.id.count() usrs = db((db.auth_event.user_id==db.auth_user.id)(db.auth_event.time_stampdatetime_start)(db.auth_event.time_stampdatetime_end)(db.auth_event.description.contains('Logged-in'))).select(db.auth_user.ALL,log_count) This is working, except that user that have not logged in in the last 7 days won't show up as a result in my query. Could some one help correct my query? I have search through out the forum and docs but couldn't find and answer. And when googling for an answer in SQL it talks about COALESCE and also DISTINCT and tried both but had no luck. 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. -- --- 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] zero value in SQLFORM.factory
Hello all I a controller, I define a contact form like this : form=SQLFORM.factory( Field('your_name',requires=IS_NOT_EMPTY(), label=T('Your name')), Field('your_email',requires=IS_EMAIL(), label=T('Your email')), Field('subject',requires=IS_NOT_EMPTY(), label=T('Subject')), Field('person', requires=IS_EMPTY_OR(IS_IN_DB(db, db.contact.id, '%(name)s', zero=T('Empty'))), label=T('Contact')), Field('message', 'text',requires=IS_NOT_EMPTY(), label=T('Message')) ) When the contact form is displayed, I got a dropdown list for person value, but the default value is blank instead of 'Empty' How could I get a default value when the dropdown list is empty? Thank you -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Horrifically slow AJAX -- how to debug?
Did you try the {{=response.toolbar()}} ? On Tuesday, 2 July 2013 05:18:27 UTC-5, Joe Barnhart wrote: I have an issue, but my question is really a meta issue about the issue... I'm developing a large database application which uses a postgres server which is separate from the web2py installation (on nginx). When geting pages currently the time to fetch a page is 2-10 seconds! I have profiled the database -- it's returning the data in about 100ms. I profiled the controller (including the database) and it's responding in 200-400ms. So my task is to find the extra 1.5 to 9.5 seconds. Which leads to my question -- how to debug issues like this? I'm familiar with postgres and the tools there to analyze and explain a query. I can instrument my web2py code and have it tell me the resulting time to run a controller. But the overall application, with the interaction of two computers, browsers, etc. is just too fragmented for me to see where the time is going and it's too complicated to post a simple example here and have one of you geniuses tell me the problem. I really need some strategies for debugging these system issues myself. Any tips or tools I should be looking at? (For example I have an use WingIDE which has been very helpful with some issues but not this one so much.) Joe -- --- 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: web2py.com down, showing error ticket links
I restarted the server. Not sure what the problem was. On Tuesday, 2 July 2013 06:20:13 UTC-5, Jim Gregory wrote: The site is showing error ticket links regardless of the site section (home page, book, etc) ...:( -Jim -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Horrifically slow AJAX -- how to debug?
For visualizing network latency etc, Firebug is great (available for Firefox). I think all major browsers have a similar development tool. On Tuesday, 2 July 2013 11:18:27 UTC+1, Joe Barnhart wrote: I have an issue, but my question is really a meta issue about the issue... I'm developing a large database application which uses a postgres server which is separate from the web2py installation (on nginx). When geting pages currently the time to fetch a page is 2-10 seconds! I have profiled the database -- it's returning the data in about 100ms. I profiled the controller (including the database) and it's responding in 200-400ms. So my task is to find the extra 1.5 to 9.5 seconds. Which leads to my question -- how to debug issues like this? I'm familiar with postgres and the tools there to analyze and explain a query. I can instrument my web2py code and have it tell me the resulting time to run a controller. But the overall application, with the interaction of two computers, browsers, etc. is just too fragmented for me to see where the time is going and it's too complicated to post a simple example here and have one of you geniuses tell me the problem. I really need some strategies for debugging these system issues myself. Any tips or tools I should be looking at? (For example I have an use WingIDE which has been very helpful with some issues but not this one so much.) Joe -- --- 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] websocket_messaging.py example: browser WebSocket connection error
Chrome error log says: WebSocket connection to 'ws://127.0.0.1:/realtime/mygroup' failed: Unexpected response code: 426 the mesagges from serverside (python) reach tornado (I see in console) I run w2p locally. Tested with FF (21.0) and Chrome (26.0.1410.63 ), which work OK with http://www.websocket.org/echo.html -- --- 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: Web2py uploads and downloads
For the moment i will leave this upload with DAL, in the future i will make upload class. I still have a problem with this: def nt_download(): return response.stream(open(os.path.join(request.folder, 'uploads', request.args(0))), attachment=True) This code doesn't work properly for files like pdf, xls, docx, png. How i can fix this? On my file system file is ok, but when i try to download it trough browser i always end up with 0 bytes file. -- --- 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: Horrifically slow AJAX -- how to debug?
You mention ajax but then discuss time to load a whole page. Are there multiple ajax requests coming from the page? If so, does each ajax request require the session (locking of the session file will force the ajax requests to be handled serially instead of in parallel)? If not, you can do session.forget(response) early in the ajax request to unlock the session file and allow the next ajax request to start processing. Anthony On Tuesday, July 2, 2013 6:18:27 AM UTC-4, Joe Barnhart wrote: I have an issue, but my question is really a meta issue about the issue... I'm developing a large database application which uses a postgres server which is separate from the web2py installation (on nginx). When geting pages currently the time to fetch a page is 2-10 seconds! I have profiled the database -- it's returning the data in about 100ms. I profiled the controller (including the database) and it's responding in 200-400ms. So my task is to find the extra 1.5 to 9.5 seconds. Which leads to my question -- how to debug issues like this? I'm familiar with postgres and the tools there to analyze and explain a query. I can instrument my web2py code and have it tell me the resulting time to run a controller. But the overall application, with the interaction of two computers, browsers, etc. is just too fragmented for me to see where the time is going and it's too complicated to post a simple example here and have one of you geniuses tell me the problem. I really need some strategies for debugging these system issues myself. Any tips or tools I should be looking at? (For example I have an use WingIDE which has been very helpful with some issues but not this one so much.) Joe -- --- 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: Web2py uploads and downloads
First of all i would like to avoid using DAL when saving images. image = db.entry.entry_label.store(file, filename) Does web2py have any mechanism for uploading? I would be great to have a class that handles uploads For my point of view framework needs to be set of tools for the developer, although storing images this way could be nice in some case, i think upload and download must not be connected to DAL. I want to store my image on the filesystem, i don't see what that has to do with DAL. web2py renames all uploaded files in order to prevent directory traversal attacks and to prevent access of known filenames. Once you do that, you need a way to identify the renamed file on the file system, so the database is used for that purpose. If you just want to directly store an uploaded file on the file system without renaming the file or involving a database, you can do that with a line or two of Python code. Anthony -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Specific SQLForm Field Selection and Variables
This might be sort of an easy question so I apologize. I am making an application where the user selects from a drop down list of template messages and then the program sends a text where the message body depends on what item was selected from the drop down. I.e If I selected 6 from the drop down list the message would send string update or if it selected 3 it might send the word lock. This is relationship is defined in a Table and then called in a field in a separate table. So there are two tables, one that has the Message type and the corresponding word as fields, and then Table 2 which is displayed for the user to enter information in, has a field that calls IS_IN_DB to the message type in Field 1. My problem is I can't seem to figure out how to send a message that sends the corresponding word based on which message type the user selects from the drop down. I tried reading about validators and the database abstraction layer but I didn't find anything that would really help me. The code is here but it doesn't quite work. @auth.requires_login() def send_message(): form1=SQLFORM(db.t_sms, fields=['f_service','f_messagevar1']) form2=SQLFORM(db.t_sms, fields=['f_service','f_messagevar2']) if request.vars.f_service: servicetype1 = db(db.t_messagetype.id==request.vars.f_service).select().f_servicenumber if form1.process(formname='form_one').accepted: session.flash = 'form accepted' account = account number token = token number client = TwilioRestClient(account, token) message = client.sms.messages.create(to=+to phone number, from_=from phone number, body= 'Service' + ' ' + str(form1.vars.f_messagevar1) + ' ' + str(servicetype1) -- --- 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] Is web2py.com down today?
On Sun, Jun 30, 2013 at 2:07 AM, Alan Etkin spame...@gmail.com wrote: I can confirm it is down. Not sure why. I tried restart it but did not restart. I have emailed the pythonanywhere support. It works! It seems it's still down. Any ideas? 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. -- Gökçen Eraslan -- --- 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] Manual Insertion of file in database
Hi Folks, I am making an app that does some text processing. I want to process the text and write the output to a file. While I can write the output to the directories and even make them available for download that will not allow me to maintain the file WELL in the database(of course i can just save the name of the file but then again that's not a well knit method). Apart from that I also want to give the user an option to upload a file to be processed or directly input the text in a text field. So when I input from a textfield, I would like to store it into a text file in my database! In both the scenarios, I have to be able to save some text in a temp file and then maually upload into the database, using code. Thats what I'm not able to figure out. Thanks in advance! Cheers Abhirath -- --- 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: zero value in SQLFORM.factory
Looks like a bug in IS_EMPTY_OR -- it ignores the zero argument to IS_IN_DB and instead forces the zero choice to be ''. Please file a Google Code issue. For now, here's a workaround: form.element('option[value=]').append(T('empty')) Anthony On Tuesday, July 2, 2013 7:22:50 AM UTC-4, Loïc wrote: Hello all I a controller, I define a contact form like this : form=SQLFORM.factory( Field('your_name',requires=IS_NOT_EMPTY(), label=T('Your name')), Field('your_email',requires=IS_EMAIL(), label=T('Your email')), Field('subject',requires=IS_NOT_EMPTY(), label=T('Subject')), Field('person', requires=IS_EMPTY_OR(IS_IN_DB(db, db.contact.id, '%(name)s', zero=T('Empty'))), label=T('Contact')), Field('message', 'text',requires=IS_NOT_EMPTY(), label=T('Message' )) ) When the contact form is displayed, I got a dropdown list for person value, but the default value is blank instead of 'Empty' How could I get a default value when the dropdown list is empty? 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] Bootstrap modal window with date widget
Hi Anyone using a date widget in a twitter bootstrap modal window? I just tried it and the calendar popup pops up behind the modal window. web2py version 2.5.1-stable+timestamp.2013.06.21.06.43.49 -Jim -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Is web2py.com down today?
Not down for me. On Tuesday, 2 July 2013 06:00:39 UTC-5, Gökçen Eraslan wrote: On Sun, Jun 30, 2013 at 2:07 AM, Alan Etkin spam...@gmail.comjavascript: wrote: I can confirm it is down. Not sure why. I tried restart it but did not restart. I have emailed the pythonanywhere support. It works! It seems it's still down. Any ideas? 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+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Gökçen Eraslan -- --- 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] Proper way to send multiple emails in Background
Hi all, Is there a proper way to send multiple emails in the background of your application? I would not want the user to wait while the emails are being sent. I am considering using a threads, but I would like to hear from the community if this is the best approach. Thanks. -- Kevin Miller -- --- 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: FDB (firebird) adapter can't store blobs greater than 64k
According to the FDB documentation, an insert or update has to pass parameters using an file-like object, like this: cur.execute(insert into blob_test values (?), (StringIO('abcdef'),)) It appears that currently the DAL passes the parameter as a very long string, and Firebird has a 64k limit on the size of the parameters. On Tuesday, July 2, 2013 12:26:17 AM UTC-6, Niphlod wrote: Bummer, than it's probably a problem within the driver itself... need to debug it or wait that someone picks it and see what's going on. Il giorno martedì 2 luglio 2013 00:55:43 UTC+2, Raul Monares ha scritto: I'm using python fdb 1.4. The field is defined as blob sub_type 0, because I'm storing PDF's On Monday, July 1, 2013 1:23:42 PM UTC-6, Niphlod wrote: what driver are you using ? DAL creates 'blob' fields as BLOB SUB_TYPE 1 can you please check that the field is created indeed as BLOB SUB_TYPE 1 watching your databases/sql.log file ? This is an excerpt from firebird documentation *Sub-type is 1.** * *This blob field sub-type is designed for the storage and manipulation of text. Typically, this is free-form memo or notes data. Typically you would use this blob field sub-type is for storing large amounts of text data. This is more convenient that a large VARCHAR because, unlike a VARCHAR, there is no 32K limit.* On Monday, July 1, 2013 7:21:03 PM UTC+2, Raul Monares wrote: When trying to store a value greater than 64k in a Blob Field, I get this error: class 'fdb.fbcore.DatabaseError' ('Error while preparing SQL statement:\n- SQLCODE: -104\n- Dynamic SQL Error\n- SQL error code = -104\n- Unexpected end of command - line 1, column 25', -104, 335544569) But with blobs smaller than 64k works fine. -- --- 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] Proper way to send multiple emails in Background
See http://web2py.com/books/default/chapter/29/08#Sending-messages-using-a-background-task. You can use the built-in scheduler rather than a homemade task queue if you prefer. You might also consider doing some ajax polling from the browser to check the status of the mail send in order to notify the user of success or failure. Anthony On Tuesday, July 2, 2013 11:36:11 AM UTC-4, dundee wrote: Hi all, Is there a proper way to send multiple emails in the background of your application? I would not want the user to wait while the emails are being sent. I am considering using a threads, but I would like to hear from the community if this is the best approach. Thanks. -- Kevin Miller -- --- 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: Help with query with count not showing values for zero
I ended up doing two querys. Never got the left (with the count working) If some one has a better alternative I would like to know it. Thanks guys. log_count=db.auth_event.id.count() usrs = db((db.auth_event.user_id==db.auth_user.id)(db.auth_event.time_stampdatetime_start)(db.auth_event.time_stampdatetime_end)(db.auth_event.description.contains('Logged-in'))).select(db.auth_user.ALL,log_count,orderby=~log_count,groupby=db.auth_user.id) active_ids=[usr.auth_user.id for usr in usrs] inactive = db(~db.auth_user.id.belongs(active_ids)).select(db.auth_user.ALL) -- --- 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: Error in User Management via privileged users
I think it's because you are using lazy tables. This has been fixed in trunk, and in fact, the whole thing as changed -- for details, see https://groups.google.com/forum/?fromgroups=#!topic/web2py/HdvSyZCJad4. Anthony On Tuesday, July 2, 2013 4:07:53 AM UTC-4, Loïc wrote: Hello All I try to implement User Management via privileged users ( http://web2py.com/books/default/chapter/29/09?search=User+Management+via+privileged+users#User-Management-via-privileged-users-%28Experimental%29 ) In my db.py, I added the following line after creating my auth object auth.settings.manager_group_role = 'manager' I also copy/paste the new appadmin controller and the new appadmin.html view from Welcome app In the menu I added the appadmin link URL('appadmin','auth_manage') But when I log in my app with a manager user and I clic on appadmin link I got an error : type 'exceptions.AttributeError' 'NoneType' object has no attribute '_plural' Version web2py™ Version 2.5.1-stable+timestamp.2013.06.06.15.39.19 Python Python 2.7.3: C:\Python27\python.exe (prefix: C:\Python27) Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Traceback (most recent call last): File C:\Users\___\Google Drive\web2py\gluon\restricted.py, line 212, in restricted exec ccode in environment File C:/Users/___/Google Drive/web2py/applications/ud/controllers/appadmin.py http://127.0.0.1:8000/admin/default/edit/udsp25/controllers/appadmin.py, line 615, in module File C:\Users\___\Google Drive\web2py\gluon\globals.py, line 194, in lambda self._caller = lambda f: f() File C:/Users/___/Google Drive/web2py/applications/ud/controllers/appadmin.py http://127.0.0.1:8000/admin/default/edit/udsp25/controllers/appadmin.py, line 590, in auth_manage auth.settings.table_user._plural = T('Users') AttributeError: 'NoneType' object has no attribute '_plural' Do you know where I am wrong? Thank you -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Horrifically slow AJAX -- how to debug?
Hi Massimo -- Yes, I added the response.toolbar() to my ajax response and placed it at the bottom of the served page. It basically confirmed the Postgres tools -- my page is served in around 30ms for a typical request (actually faster than explain analyze predicted). But the wall clock says it takes between 2-10 seconds to serve the page. Maybe web2py is so fast I'm experiencing time dilation. ;-) My guess is that the slowness comes from the interplay of the pieces in my total setup. So far I have: 1. A 6-core AMD processor running Linux 2. Postgres running on top of it 3. Virtualbox running, with 3 guests. 4. Web2py and nginx in a virtualbox guest, on Linux 5. Host-only networking for speedy web2py-postgress communications between VB host and guest 6. Bridged networking for external communication to web2py instance So far the loading is one user, so I know I'm not getting too many requests. The networking setup works very well since i use the same channels for development on the web2py virtualbox -- host-only when at my Linux box and bridged when at a different computer. Response is snappy and immediate in all cases. Only the web2py-nginx-postgres path seems to be excessively slow, and only when I'm using jQuery AJAX requests. On Tuesday, July 2, 2013 4:49:31 AM UTC-7, Massimo Di Pierro wrote: Did you try the {{=response.toolbar()}} ? On Tuesday, 2 July 2013 05:18:27 UTC-5, Joe Barnhart wrote: I have an issue, but my question is really a meta issue about the issue... I'm developing a large database application which uses a postgres server which is separate from the web2py installation (on nginx). When geting pages currently the time to fetch a page is 2-10 seconds! I have profiled the database -- it's returning the data in about 100ms. I profiled the controller (including the database) and it's responding in 200-400ms. So my task is to find the extra 1.5 to 9.5 seconds. Which leads to my question -- how to debug issues like this? I'm familiar with postgres and the tools there to analyze and explain a query. I can instrument my web2py code and have it tell me the resulting time to run a controller. But the overall application, with the interaction of two computers, browsers, etc. is just too fragmented for me to see where the time is going and it's too complicated to post a simple example here and have one of you geniuses tell me the problem. I really need some strategies for debugging these system issues myself. Any tips or tools I should be looking at? (For example I have an use WingIDE which has been very helpful with some issues but not this one so much.) Joe -- --- 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: Horrifically slow AJAX -- how to debug?
Hi villas -- Yes, I've used both Firefox and Chrome to try and understand what's going on. Both tools show the actual time for the AJAX response -- seconds insted of milliseconds. But they can't give me any detail of what's going on during the request. They only show the time waiting for the AJAX response. Hence my quandry. -- Joe On Tuesday, July 2, 2013 5:24:16 AM UTC-7, villas wrote: For visualizing network latency etc, Firebug is great (available for Firefox). I think all major browsers have a similar development tool. On Tuesday, 2 July 2013 11:18:27 UTC+1, Joe Barnhart wrote: I have an issue, but my question is really a meta issue about the issue... I'm developing a large database application which uses a postgres server which is separate from the web2py installation (on nginx). When geting pages currently the time to fetch a page is 2-10 seconds! I have profiled the database -- it's returning the data in about 100ms. I profiled the controller (including the database) and it's responding in 200-400ms. So my task is to find the extra 1.5 to 9.5 seconds. Which leads to my question -- how to debug issues like this? I'm familiar with postgres and the tools there to analyze and explain a query. I can instrument my web2py code and have it tell me the resulting time to run a controller. But the overall application, with the interaction of two computers, browsers, etc. is just too fragmented for me to see where the time is going and it's too complicated to post a simple example here and have one of you geniuses tell me the problem. I really need some strategies for debugging these system issues myself. Any tips or tools I should be looking at? (For example I have an use WingIDE which has been very helpful with some issues but not this one so much.) Joe -- --- 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: Horrifically slow AJAX -- how to debug?
I basically have tried two AJAX requests and one request. Both have resulted in the same outcome. I also tried the session._unlock(response) suggestion but without any measurable result. Clearly something in my setup is snarled but finding it is proving difficult. -- Joe On Tuesday, July 2, 2013 6:48:59 AM UTC-7, Anthony wrote: You mention ajax but then discuss time to load a whole page. Are there multiple ajax requests coming from the page? If so, does each ajax request require the session (locking of the session file will force the ajax requests to be handled serially instead of in parallel)? If not, you can do session.forget(response) early in the ajax request to unlock the session file and allow the next ajax request to start processing. Anthony On Tuesday, July 2, 2013 6:18:27 AM UTC-4, Joe Barnhart wrote: I have an issue, but my question is really a meta issue about the issue... I'm developing a large database application which uses a postgres server which is separate from the web2py installation (on nginx). When geting pages currently the time to fetch a page is 2-10 seconds! I have profiled the database -- it's returning the data in about 100ms. I profiled the controller (including the database) and it's responding in 200-400ms. So my task is to find the extra 1.5 to 9.5 seconds. Which leads to my question -- how to debug issues like this? I'm familiar with postgres and the tools there to analyze and explain a query. I can instrument my web2py code and have it tell me the resulting time to run a controller. But the overall application, with the interaction of two computers, browsers, etc. is just too fragmented for me to see where the time is going and it's too complicated to post a simple example here and have one of you geniuses tell me the problem. I really need some strategies for debugging these system issues myself. Any tips or tools I should be looking at? (For example I have an use WingIDE which has been very helpful with some issues but not this one so much.) Joe -- --- 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] Record Representation
I just implemented record representation such as the table below. My question is, is record representation supposed to save the value in the database? I am trying to create a price override field in my product table because the price can be changed within the series of a product (on the series table) or within the product itself on discriminatory occasions. Is Record Representation what I need??? Thanks db.define_table('series', Field('seriesname'), Field('seriesdescription'), Field('colorgroup','reference colorgroup'), Field('material', 'reference material'), Field('price') db.series.seriesname.requires = IS_NOT_IN_DB(db,db.series.seriesname) db.series.colorgroup.requires = IS_IN_DB(db,db.colorgroup.id,'%(groupname)s' ) db.series._singular = Series db.series._plural = +Series db.define_table('product', Field('series', 'reference series'), Field('finish', 'reference finish'), Field('cut', 'reference cut'), Field('price') db.product.series.requires = IS_EMPTY_OR(IS_IN_DB(db,db.series.id, '%(seriesname)s')) db.product.finish.requires = IS_EMPTY_OR(IS_IN_DB(db,db.finish.id,'%(name)s' )) db.product.cut.requires = IS_EMPTY_OR(IS_IN_DB(db,db.cut.id,'%(name)s')) db.product.price.represent = lambda id,row: db.series(row.series).price -- --- 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] Invalid literal error
I am getting the error invalid literal for long() with base 10: 'test'. When testing to find the problem it is interesting that I get this error with a simple print statement. I have searched the group and found several issues with this same error but none that seem to provide the answer. here is more details: type 'exceptions.ValueError' invalid literal for long() with base 10: 'test'Versionweb2py™Version 2.5.1-stable+timestamp.2013.06.06.15.39.19 Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. Traceback (most recent call last): File /home/mdipierro/make_web2py/web2py/gluon/restricted.py, line 212, in restricted File C:/Users/Home/Desktop/web2py/applications/service/controllers/employee.py http://127.0.0.1:8000/admin/default/edit/service/controllers/employee.py, line 283, in module File /home/mdipierro/make_web2py/web2py/gluon/globals.py, line 194, in lambda File /home/mdipierro/make_web2py/web2py/gluon/tools.py, line 3022, in f File /home/mdipierro/make_web2py/web2py/gluon/tools.py, line 3022, in f File C:/Users/Home/Desktop/web2py/applications/service/controllers/employee.py http://127.0.0.1:8000/admin/default/edit/service/controllers/employee.py, line 240, in customers File C:/Users/Home/Desktop/web2py/applications/service/controllers/employee.py http://127.0.0.1:8000/admin/default/edit/service/controllers/employee.py, line 102, in getCustomerInfo File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 9662, in __repr__ File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 1366, in expand File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 1276, in EQ File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 1376, in expand File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 1830, in represent ValueError: invalid literal for long() with base 10: 'test' Relevant part of code: 101. myquery=(db.Job.Company==CompanyName) 102. print (myquery: , myquery) Anyone know why I am getting this error and how I can correct it? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Invalid literal error
Resolution found. I looked for an answer all morning before finally posting the question and 10 min after posting I figured it out. I'm still not sure why it gave me an error on a print command, but the problem was because I was searching the wrong table. Once I corrected it that fixed the problem. I hate it when I spend all day looking for an answer that is right in front of my face! On Tuesday, July 2, 2013 3:13:18 PM UTC-4, Youngblood wrote: I am getting the error invalid literal for long() with base 10: 'test'. When testing to find the problem it is interesting that I get this error with a simple print statement. I have searched the group and found several issues with this same error but none that seem to provide the answer. here is more details: type 'exceptions.ValueError' invalid literal for long() with base 10: 'test'Versionweb2py™Version 2.5.1-stable+timestamp.2013.06.06.15.39.19 Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. Traceback (most recent call last): File /home/mdipierro/make_web2py/web2py/gluon/restricted.py, line 212, in restricted File C:/Users/Home/Desktop/web2py/applications/service/controllers/employee.py http://127.0.0.1:8000/admin/default/edit/service/controllers/employee.py, line 283, in module File /home/mdipierro/make_web2py/web2py/gluon/globals.py, line 194, in lambda File /home/mdipierro/make_web2py/web2py/gluon/tools.py, line 3022, in f File /home/mdipierro/make_web2py/web2py/gluon/tools.py, line 3022, in f File C:/Users/Home/Desktop/web2py/applications/service/controllers/employee.py http://127.0.0.1:8000/admin/default/edit/service/controllers/employee.py, line 240, in customers File C:/Users/Home/Desktop/web2py/applications/service/controllers/employee.py http://127.0.0.1:8000/admin/default/edit/service/controllers/employee.py, line 102, in getCustomerInfo File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 9662, in __repr__ File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 1366, in expand File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 1276, in EQ File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 1376, in expand File /home/mdipierro/make_web2py/web2py/gluon/dal.py, line 1830, in represent ValueError: invalid literal for long() with base 10: 'test' Relevant part of code: 101. myquery=(db.Job.Company==CompanyName) 102. print (myquery: , myquery) Anyone know why I am getting this error and how I can correct it? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Horrifically slow AJAX -- how to debug?
Use the 'network' tab on chrome... button... right click, save as HAR, attach it here. On Tuesday, July 2, 2013 11:02:37 AM UTC-7, Joe Barnhart wrote: I basically have tried two AJAX requests and one request. Both have resulted in the same outcome. I also tried the session._unlock(response) suggestion but without any measurable result. Clearly something in my setup is snarled but finding it is proving difficult. -- Joe On Tuesday, July 2, 2013 6:48:59 AM UTC-7, Anthony wrote: You mention ajax but then discuss time to load a whole page. Are there multiple ajax requests coming from the page? If so, does each ajax request require the session (locking of the session file will force the ajax requests to be handled serially instead of in parallel)? If not, you can do session.forget(response) early in the ajax request to unlock the session file and allow the next ajax request to start processing. Anthony On Tuesday, July 2, 2013 6:18:27 AM UTC-4, Joe Barnhart wrote: I have an issue, but my question is really a meta issue about the issue... I'm developing a large database application which uses a postgres server which is separate from the web2py installation (on nginx). When geting pages currently the time to fetch a page is 2-10 seconds! I have profiled the database -- it's returning the data in about 100ms. I profiled the controller (including the database) and it's responding in 200-400ms. So my task is to find the extra 1.5 to 9.5 seconds. Which leads to my question -- how to debug issues like this? I'm familiar with postgres and the tools there to analyze and explain a query. I can instrument my web2py code and have it tell me the resulting time to run a controller. But the overall application, with the interaction of two computers, browsers, etc. is just too fragmented for me to see where the time is going and it's too complicated to post a simple example here and have one of you geniuses tell me the problem. I really need some strategies for debugging these system issues myself. Any tips or tools I should be looking at? (For example I have an use WingIDE which has been very helpful with some issues but not this one so much.) Joe -- --- 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: Record Representation
The represent attribute does not affect the value stored in the database -- it just affects the display of the value in the grid, SQLTABLE, and read-only forms. If you want to set the value in the database, use a compute field. Anthony On Tuesday, July 2, 2013 3:06:06 PM UTC-4, greenpoise wrote: I just implemented record representation such as the table below. My question is, is record representation supposed to save the value in the database? I am trying to create a price override field in my product table because the price can be changed within the series of a product (on the series table) or within the product itself on discriminatory occasions. Is Record Representation what I need??? Thanks db.define_table('series', Field('seriesname'), Field('seriesdescription'), Field('colorgroup','reference colorgroup'), Field('material', 'reference material'), Field('price') db.series.seriesname.requires = IS_NOT_IN_DB(db,db.series.seriesname) db.series.colorgroup.requires = IS_IN_DB(db,db.colorgroup.id, '%(groupname)s') db.series._singular = Series db.series._plural = +Series db.define_table('product', Field('series', 'reference series'), Field('finish', 'reference finish'), Field('cut', 'reference cut'), Field('price') db.product.series.requires = IS_EMPTY_OR(IS_IN_DB(db,db.series.id, '%(seriesname)s')) db.product.finish.requires = IS_EMPTY_OR(IS_IN_DB(db,db.finish.id, '%(name)s')) db.product.cut.requires = IS_EMPTY_OR(IS_IN_DB(db,db.cut.id,'%(name)s')) db.product.price.represent = lambda id,row: db.series(row.series).price -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to set permissions for db table loaded from flat file
I should also add that if I add this line- auth.add_permission(1, 'read', r.id) so that it reads- if db(db.man.id 0).isempty(): for line in open('database.txt', 'rU'): fieldname1,fieldname2,id1,id2 = line.strip().split('\t') r = db.man.insert(fieldname1=fieldname1, fieldname2=fieldname2, id1=id1, id2=id2) auth.add_permission(1, 'read', r.id) db.commit() ...I get a ticket w/ type 'exceptions.AttributeError' 'DAL' object has no attribute 'auth_permission' On Monday, July 1, 2013 5:30:10 PM UTC-7, Jordan Ladora wrote: Hi, From a file, I'm loading a table that I would like to make accessible to any logged in user.. Here's the model- db.define_table('man', Field('fieldname1', requires=IS_NOT_EMPTY(), label=fieldname1), Field('fieldname2', requires=IS_NOT_EMPTY(), label=fieldname2), Field('id1', requires=IS_NOT_EMPTY(), label=label1), Field('id2', requires=IS_NOT_EMPTY(), label=label1), format = '%(fieldname1)s %(fieldname2)s %(id1)s %(id2)s' ) At the end of the models file, I have this code to fill the table from a flat file, if it is empty- if db(db.man.id 0).isempty(): for line in open('database.txt', 'rU'): fieldname1,fieldname2,id1,id2 = line.strip().split('\t') r = db.man.insert(fieldname1=fieldname1, fieldname2=fieldname2, id1=id1, id2=id2) db.commit() What is the best way now set the permissions for all the records in this table, so any logged in user can access them? Thanks for any help! -JL -- --- 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: Bootstrap modal window with date widget
Try edit the calendar.css and increase the value of z-index. On Tuesday, 2 July 2013 10:25:22 UTC-5, Jim S wrote: Hi Anyone using a date widget in a twitter bootstrap modal window? I just tried it and the calendar popup pops up behind the modal window. web2py version 2.5.1-stable+timestamp.2013.06.21.06.43.49 -Jim -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: FDB (firebird) adapter can't store blobs greater than 64k
please open a ticket. On Tuesday, 2 July 2013 10:43:07 UTC-5, Raul Monares wrote: According to the FDB documentation, an insert or update has to pass parameters using an file-like object, like this: cur.execute(insert into blob_test values (?), (StringIO('abcdef'),)) It appears that currently the DAL passes the parameter as a very long string, and Firebird has a 64k limit on the size of the parameters. On Tuesday, July 2, 2013 12:26:17 AM UTC-6, Niphlod wrote: Bummer, than it's probably a problem within the driver itself... need to debug it or wait that someone picks it and see what's going on. Il giorno martedì 2 luglio 2013 00:55:43 UTC+2, Raul Monares ha scritto: I'm using python fdb 1.4. The field is defined as blob sub_type 0, because I'm storing PDF's On Monday, July 1, 2013 1:23:42 PM UTC-6, Niphlod wrote: what driver are you using ? DAL creates 'blob' fields as BLOB SUB_TYPE 1 can you please check that the field is created indeed as BLOB SUB_TYPE 1 watching your databases/sql.log file ? This is an excerpt from firebird documentation *Sub-type is 1.** * *This blob field sub-type is designed for the storage and manipulation of text. Typically, this is free-form memo or notes data. Typically you would use this blob field sub-type is for storing large amounts of text data. This is more convenient that a large VARCHAR because, unlike a VARCHAR, there is no 32K limit.* On Monday, July 1, 2013 7:21:03 PM UTC+2, Raul Monares wrote: When trying to store a value greater than 64k in a Blob Field, I get this error: class 'fdb.fbcore.DatabaseError' ('Error while preparing SQL statement:\n- SQLCODE: -104\n- Dynamic SQL Error\n- SQL error code = -104\n- Unexpected end of command - line 1, column 25', -104, 335544569) But with blobs smaller than 64k works fine. -- --- 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: Bootstrap modal window with date widget
Thanks Massimo, I raised it to 9 and it now works. -Jim On Tuesday, July 2, 2013 10:25:22 AM UTC-5, Jim S wrote: Hi Anyone using a date widget in a twitter bootstrap modal window? I just tried it and the calendar popup pops up behind the modal window. web2py version 2.5.1-stable+timestamp.2013.06.21.06.43.49 -Jim -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Bootstrap modal window with date widget
FYI - the modal window had a z-index of 1050. -Jim On Tuesday, July 2, 2013 5:01:20 PM UTC-5, Jim S wrote: Thanks Massimo, I raised it to 9 and it now works. -Jim On Tuesday, July 2, 2013 10:25:22 AM UTC-5, Jim S wrote: Hi Anyone using a date widget in a twitter bootstrap modal window? I just tried it and the calendar popup pops up behind the modal window. web2py version 2.5.1-stable+timestamp.2013.06.21.06.43.49 -Jim -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to set permissions for db table loaded from flat file
I should also add that if I add this line- auth.add_permission(1, 'read', r.id) Perhaps this is obvious, but, have you enabled the Auth tables (they are by default in the scaffolding app)?. In order to use rbac, you should have something like this in your model auth = Auth(db)# authentication/authorization ... auth.define_tables() # creates all needed tables Also, it is necessary to specify the kwarg record_id=id or else add the tablename argument to the method call. Something like auth.add_permission(1, 'read', record_id=r.id) or auth.add_permission(1, 'read', , r.id) # the void string is de method tablename default For a more complete reference, check the access control section of the book. http://www.web2py.com/book/default/chapter/09 -- --- 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] OT: Python Tools for Visual Studio
I'm sure this is old hat to the grizzled veterans on here but for a newbie like me this was an interesting write-up: http://www.hanselman.com/blog/OneOfMicrosoftsBestKeptSecretsPythonToolsForVisualStudioPTVS.aspx -- --- 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: Specific SQLForm Field Selection and Variables
This might be sort of an easy question so I apologize. I am making an application where the user selects from a drop down list of template messages and then the program sends a text where the message body depends on what item was selected from the drop down. I.e If I selected 6 from the drop down list the message would send string update or if it selected 3 it might send the word lock. It is not clear to me why you need to expose to db crud forms instead of using a fale one and process the request accordingly. I'd use something like def action(): form = SQLFORM.factory(...) if form.process().accepted: here you process the message with the submitted values return dict(form=form, ...) Note that you can use actual database tables/fields and their validators with the form factory. http://www.web2py.com/book/default/chapter/07#SQLFORM.factory -- --- 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: Invalid literal error
Resolution found. I looked for an answer all morning before finally posting the question and 10 min after posting I figured it out. I'm still not sure why it gave me an error on a print command, but the problem was because I was searching the wrong table. Once I corrected it that fixed the problem. I hate it when I spend all day looking for an answer that is right in front of my face! I think you were building a query of type db.mytable.reference == string which produces a representation error because there is an unexpected value specified for the reference field type -- --- 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.