[web2py] Returning a controller function with an integer causes Thread issues

2015-11-04 Thread Calvin
Hi I was working on the a controller function where the end result was the row id following a def insert_record() id= db[f].insert(**data) operaton return id As it turns out, this works without a hitch on my mac running python 2.7.10 and Web2py Version

[web2py] IOError(11, 'Resource temporarily unavailable')

2015-10-01 Thread Calvin
. Any suggestions on how to debug/troubleshoot this would be most appreciated! Calvin -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received

[web2py] Re: IOError(11, 'Resource temporarily unavailable')

2015-10-01 Thread Calvin
I have an error handler within web2py that provides the error trace. One hypothesis offered was that nginx is closing the socket as uwsgi is taking too long to serve data. I've increased the keepalive_timeout parameter from 60 to 600 but this does not help. Where else could the problem be?

[web2py] Re: Prince - Print Python Html to PDF

2015-04-21 Thread Calvin
Or why not http://html2pdfrocket.com instead? It's free. On Tuesday, 21 April 2015 03:52:10 UTC+8, Ovidio Marinho wrote: Has anyone tried to use it with web2py? http://www.princexml.com/doc/9.0/python/ [image: http://itjp.net.br] http://itjp.net.br

[web2py] wiki_editor group added to impersonated account

2015-02-23 Thread Calvin
Hi When I access the wiki function with an impersonated account, the impersonated account automatically gets added to the wiki_editor group at least for the duration of the account being impersonated. Is this the desired behaviour? Thanks Calvin -- Resources: - http://web2py.com - http

[web2py] db.Table no longer available in recent modularised DAL update

2014-10-07 Thread Calvin
' object has no attribute 'Table' This used to work before (Version 2.9.6-stable+timestamp.2014.09.02.10.10.07) Would this functionality be removed moving forward or is this an unintended omission? Thanks Calvin -- Resources: - http://web2py.com - http://web2py.com/book (Documentation

[web2py] Re: putting in a custom render function with T.M()

2014-08-26 Thread Calvin
to internationalize this? On Friday, 22 August 2014 10:33:28 UTC-5, Calvin wrote: Hi Massimo Here's an example: T.M(hello ``you``:custom, extra=dict(custom=lambda x: SPAN(x, _style= font-size:0.8em))) which throws *** TypeError: M() got an unexpected keyword argument 'extra' Calvin

[web2py] Re: putting in a custom render function with T.M()

2014-08-22 Thread Calvin
Hi Massimo Here's an example: T.M(hello ``you``:custom, extra=dict(custom=lambda x: SPAN(x, _style= font-size:0.8em))) which throws *** TypeError: M() got an unexpected keyword argument 'extra' Calvin -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http

[web2py] putting in a custom render function with T.M()

2014-08-20 Thread Calvin
Hi I am wondering if it is possible to customise the render function within a ``code`` segment with T.M(). I have tried adding the extra keyword as documented in the Markmin documentation but this is generating out a keyword not recognised error. Thanks in advance! Calvin -- Resources

Re: [web2py] March 4 Lab 8

2014-03-04 Thread Calvin Morrison
I am so glad I am not taking intro to programming ever again. I hate string manipulation! Massimo - you might want to resend this to your actual students Calvin On 4 March 2014 14:20, Massimo Di Pierro massimo.dipie...@gmail.com wrote: During lab today you will begin writing the solutions

Re: [web2py] trying to help young son learn Python, and...

2014-03-04 Thread Calvin Morrison
Hi, http://web2py.com/books/default/chapter/29/13/deployment-recipes this page offers different deployment recipes for hosting like PythonAnywhere. If your host (i am unfamiliar with go-daddy) provides you root/shell access to a linux box, you shouldn't have any trouble. I am Running my web2py

Re: [web2py] Best practices for using mercurial within web2py

2014-02-21 Thread Calvin Morrison
Also, relatedly, I was trying to restart apache from within a web2py app. That was giving me errors, so I'm doing something else. Is there a way to do this? you can do it from the shell. Look up your relevant distro information on init scripts. usually it's something like sudo service

Re: [web2py] Using Homemade task queues

2014-01-30 Thread Calvin Morrison
Look at the scheduler documentation. I have mine called this way from my db.py. This calls a few different tasks, adding file size and also calling a task called unzip / untar which are functions i have written to handle zipping and unzipping. Hopefully this explains it somewhat def

[web2py] Selects as_trees

2014-01-28 Thread Calvin
Hi I am looking for a way to expand all referenced fields and have read about the as_trees() method for selecting rows. I do not quite understand the parent field requirement, but say we have the following tables/relationships, was looking for a nested dict output which could be JSONified as

[web2py] Re: caching TAG()

2014-01-28 Thread Calvin
( 'World')).xml(), time_expire=100)) {{=myoutput}} On Monday, January 27, 2014 10:06:59 AM UTC-5, Calvin wrote: Thanks Leonel-I tried this without any success. It still rendering incorrectly but this time consistently before and after caching. On Tuesday, 21 January

[web2py] Re: caching TAG()

2014-01-28 Thread Calvin
filled. Perplexed! On Wednesday, 29 January 2014 14:12:05 UTC+8, Anthony wrote: On Wednesday, January 29, 2014 12:19:54 AM UTC-5, Calvin wrote: Thanks Anthony. It still appears to be returning the string result rather than the HTML object - even for the first time the function is called

[web2py] Re: caching TAG()

2014-01-27 Thread Calvin
Thanks Leonel-I tried this without any success. It still rendering incorrectly but this time consistently before and after caching. On Tuesday, 21 January 2014 03:34:39 UTC+8, Leonel Câmara wrote: You can use {{=XML(output, sanitize=False)}} to get the correct rendering -- Resources: -

[web2py] Slow response

2014-01-27 Thread Calvin Morrison
web2p in the background for wsgi so that it's not so slow? Calvin -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you

[web2py] CentOS install notes

2014-01-27 Thread Calvin Morrison
I've been having trouble with centOS getting a 503 Service unavailable using Apache's httpd. If anyone else is seeing this same problem, I found that this solved my problem: adding this to my main httpd.conf: WSGISocketPrefix /var/run/wsgi -- Resources: - http://web2py.com -

Re: [web2py] Printing statements from Python

2014-01-26 Thread Calvin Morrison
A ghetto way: just open a file and use regular write commands On Jan 26, 2014 1:30 PM, horridohobbyist horrido.hobb...@gmail.com wrote: I'm looking for a simple way to print out statements in Python. I understand the 'print' function outputs to the console on the server side, but once web2py

[web2py] caching TAG()

2014-01-15 Thread Calvin
recreate it: SMALL = lambda x, **kwargs: TAG.small(x, **kwargs) cache.disk('Hello', lambda: CAT(P('Hello'), SMALL('World')), time_expire=100 ) Any ideas? Calvin -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https

[web2py] Re: caching TAG()

2014-01-15 Thread Calvin
Thanks Leonel! That works. I ended up doing it as follows: SMALL = lambda x, **kwargs: XML(TAG.small(x, **kwargs).xml()) cache.disk('Hello', lambda: CAT(P('Hello'), SMALL('World')), time_expire=100 ) However, with such an approach, the retrieved cache value is a string rather than an XML

Re: [web2py] Re: Writing Web2Py specification and finding free lance Web2Py coders

2014-01-13 Thread Calvin Morrison
elance.com? On 11 January 2014 23:04, Simon Ashley gregs...@gregsier.com.au wrote: Often thought that it would be good to push this to another level. We have projects from time to time that would be good to outsource, if people were interested. Something like a project post board, with

Re: [web2py] Multiple Uploads using jQuery-File-Upload: Javascript/CSS Conflict?

2014-01-09 Thread Calvin Morrison
Brando, Thanks for working this out! it would be good to make a web2py slice or add it to the documentation/ examples Calvin On 8 January 2014 14:35, Brando bhe...@trustcc.com wrote: This works, added the requires statement for form validation: def submit(): import datetime form

Re: [web2py] Multiple Uploads using jQuery-File-Upload: Javascript/CSS Conflict?

2014-01-08 Thread Calvin Morrison
I just wrote my own way to do it yesterday which worked great. I would love it to go upstream. It's just a standard file upload with the multiple attribute. here's the entire thing: it spits out a form. my db looks like this: db.define_table('uploads', Field('username', 'string'),

Re: [web2py] Multiple Uploads using jQuery-File-Upload: Javascript/CSS Conflict?

2014-01-08 Thread Calvin Morrison
or not, i have that weird is in then len() 0 but i don't think it's the best. Whoever is a maintainer/developer of web2py - could we integrate this somehow? Calvin On 8 January 2014 10:40, Brando bhe...@trustcc.com wrote: Calvin, you are awesome. I will try this on my end and report back

Re: [web2py] Multiple Uploads using jQuery-File-Upload: Javascript/CSS Conflict?

2014-01-08 Thread Calvin Morrison
it to the local disk? On Wednesday, January 8, 2014 7:18:28 AM UTC-8, Calvin Morrison wrote: I just wrote my own way to do it yesterday which worked great. I would love it to go upstream. It's just a standard file upload with the multiple attribute. here's the entire thing: it spits out

Re: [web2py] Multiple Uploads using jQuery-File-Upload: Javascript/CSS Conflict?

2014-01-08 Thread Calvin Morrison
Yes I am getting that same problem here. Like I said, I don't really know how to properly test if the variable has been set. Any input from more wise web2pyers would be great Calvin On 8 January 2014 14:03, Brando bhe...@trustcc.com wrote: Calvin, I'm getting this error when I select only 1

Re: [web2py] Multiple Uploads using jQuery-File-Upload: Javascript/CSS Conflict?

2014-01-08 Thread Calvin Morrison
that'd be a Jquery thing. jQuery(input#fileid).change(function () { alert(jQuery(this).val()) }); On 8 January 2014 14:36, Brando bhe...@trustcc.com wrote: Question, how could I make it so I don't have to click the submit button. How could i make it to where they choose the files and

Re: [web2py] Re: custom widgets

2014-01-07 Thread Calvin Morrison
great thanks! On 7 January 2014 15:18, Anthony abasta...@gmail.com wrote: 1. Where should I put my custom widget logic? Right now i have it grossely stored in my db.py You can always put it in a module file and import it. 2. Can i pass more information to my widget other than field,

[web2py] Happy New Year everybody!

2014-01-04 Thread Calvin
Happy New year Massimo and all the contributors who have made web2py so awesome! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this

[web2py] require based on another field.

2014-01-02 Thread Calvin Morrison
Hi! I have a field called Job Type, and another field database that depends on the type. If the user selects Train for Job Type, they don't need to enter a database (a integer id), but i don't know how to make validators do this for me. Right now I have this: db.jobs.db.requires =

Re: [web2py] Re: save upload filename in database

2013-12-31 Thread Calvin Morrison
Here is my solution! if hasattr(request.vars['up_file'],filename): form.vars.filename = request.vars['up_file'].filename if form.process().accepted: redirect(URL('data', 'index')) elif form.errors: response.flash = form has errors On 28 December 2013 17:08, Calvin Morrison

Re: [web2py] Re: save upload filename in database

2013-12-28 Thread Calvin Morrison
=[IS_NOT_EMPTY(), IS_UPLOAD_FILENAME(extension=ext_regex)]), You can submit a form that does not upload a file into up_file? On Thursday, 26 December 2013 13:21:35 UTC-6, Calvin Morrison wrote: I'm following the documentation trying to figure out how to correctly save a filename to my uploads

[web2py] Re: save upload filename in database

2013-12-28 Thread Calvin Morrison
('up_file', 'upload', uploadseparate=True, requires =[IS_NOT_EMPTY(), IS_UPLOAD_FILENAME(extension=ext_regex)]), You can submit a form that does not upload a file into up_file? On Thursday, 26 December 2013 13:21:35 UTC-6, Calvin Morrison wrote: I'm following the documentation trying to figure

[web2py] save upload filename in database

2013-12-27 Thread Calvin Morrison
I'm following the documentation trying to figure out how to correctly save a filename to my uploads database. Basically i have the same code as the website shows in it's examples def submit(): import datetime form = SQLFORM(db.uploads, fields=['up_file', notes], deletable=True)

[web2py] Re: how to hide the [wiki] menu option in auth.wiki

2013-11-26 Thread Calvin
I'm using web2py 2.7.4-stable+timestamp.2013.11.25.15.21.21 but it doesn't appear that the patch for this is in yet. However, instead of doing the removal of the Wiki link with jQuery on the client, which is susceptible to being hacked by a savvy user, the following may be more secure: To

[web2py] Re: Adding custom operators to DAL

2013-06-27 Thread Calvin
Thanks for the clarification but in any case, I thought it was Google acting up! -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to

[web2py] generic WHERE clause in DAL

2013-06-26 Thread Calvin
I would like to suggest a generic query which could allow queries within the DAL framework for functions supported by the database but not web2py's DAL by feeding in the raw query as would be expected in SQL native to a particular database. While DAL hides alot of subtle differences in

[web2py] Re: Adding custom operators to DAL

2013-06-26 Thread Calvin
:25 UTC+8, Massimo Di Pierro wrote: Can you show an example of how you plan to use something like this. I believe there is already a method db(Expression(db, ... raw query ...)).select() perhaps I do not understand. On Tuesday, 25 June 2013 22:36:45 UTC-5, Calvin wrote: I think it would

[web2py] Re: Adding custom operators to DAL

2013-06-26 Thread Calvin
Not sure why it says my previous reply has been deleted but here it is again: Hi Massimo I am not familiar with the method you suggested but when I tried it, I got the following error: print db(Expression(db,business_view.loc ST_MakeEnvelope(42.179139323652443, 141.20906066894531,

[web2py] Re: Adding custom operators to DAL

2013-06-26 Thread Calvin
Thanks Anthony and Massimo. It all works now! On Thursday, 27 June 2013 00:42:26 UTC+8, Anthony wrote: from gluon.dal import Expression Anthony On Wednesday, June 26, 2013 11:53:34 AM UTC-4, Calvin wrote: Not sure why it says my previous reply has been deleted but here it is again: Hi

[web2py] Adding custom operators to DAL

2013-06-25 Thread Calvin
I think it would be nice to specify custom operators that can be used with the DAL as I believe this would allow for operators that are currently yet to be supported with a built-in DAL operator... From dal.py, I am thinking this should be relatively easy to implement, and code would be along

[web2py] Re: Preventing repeated submissions, or rate limiting submissions

2013-05-29 Thread Calvin
Just wondering if a cache decorator would work here? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options,

[web2py] Re: Preventing repeated submissions, or rate limiting submissions

2013-05-29 Thread Calvin
Just wondering if a cache decorator would work here? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options,

[web2py] Re: Preventing repeated submissions, or rate limiting submissions

2013-05-29 Thread Calvin
Just wondering if a cache decorator would work here? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options,

[web2py] Re: hiding a column in smartgrid

2013-05-27 Thread Calvin
before the call to SQLFORM.smartgrid, add db.tablename.linkfield.readable=False On Monday, 27 May 2013 23:57:31 UTC+8, Ricardo Cárdenas wrote: Hi, My model contains a URL field, and I'm displaying the model in a SQLFORM.smartgrid. I don't want to show the whole URL, but I do want the

[web2py] edit static content from web interface nginx

2013-05-19 Thread Calvin
Check the file permissions for the static folder to see if it's own by uwsgi (if you're using that... or whichever wsgi)? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it,

[web2py] edit static content from web interface nginx

2013-05-19 Thread Calvin
Check the file permissions for the static folder to see if it's own by uwsgi (if you're using that... or whichever wsgi)? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it,

[web2py] Re: How to store data records for recurrent jQuery call

2013-05-19 Thread Calvin
I've not verified the code but something along the lines of: script var rec = JSON.parse('{{=json.dumps(db(db.xyz.id0).select().as_list())}}'); /script You could then write some javascript to populate block 2 using the rec object created... On Sunday, 19 May 2013 11:32:40 UTC+8, Lio wrote:

[web2py] sending an image file to client without a temp file

2013-05-15 Thread Calvin
I was searching for the above functionality and found a solution using Flask and StringIO as below (short code snippet attached for convenience). Is there a way to do the same with web2py? http://flask.pocoo.org/snippets/32/ #!/usr/bin/env python # Thanks to Dan Jacob for a part of the code

[web2py] Re: sending an image file to client without a temp file

2013-05-15 Thread Calvin
Thanks 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

[web2py] Re: IS_IN_DB orderby natural sort?

2013-05-13 Thread Calvin
How about doing your own widget: import re def natural_key(string_): return [int(s) if s.isdigit() else s for s in re.split(r'(\d+)', string_)] items = db(db.item_type.id 0).select() sorted_items= items.sort(key=natural_key(items.name)) db.item.item_type.widget = lambda f, v:

[web2py] distinct keyword for SQLFORM.grid

2013-04-10 Thread Calvin
in SQLFORM.grid is by design? Many thanks Calvin -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options

[web2py] Re: Override _autocomplete function

2013-03-11 Thread Calvin
If of interest to anyone, eventually, I made my own autocomplete based on Bootstrap Typeahead: def bs_typeahead(f, v, **kwargs): options = {'_data-provide':'textahead'} options.update(kwargs) return CAT( INPUT(_type=text, _class=string, _id=%s_%s_ac % (f._tablename,f .name),

[web2py] Override _autocomplete function

2013-03-08 Thread Calvin
I have been using the autocomplete widget which makes is really convenient. However, there are times where I would like to customise what is shown in the SELECT say with a custom expression rather than being limited to each OPTION being the value of the field in the row. It appears that the

[web2py] Re: Rows object not returning reference fields

2013-02-27 Thread Calvin
? On Wednesday, February 27, 2013 1:59:38 AM UTC-5, Calvin wrote: I am encountering a strange observation in that when accessing the Rows object for a given table, the object returns all the fields except for those that are of the reference type. I am using the HEAD version... Is this a bug

[web2py] Rows object not returning reference fields

2013-02-26 Thread Calvin
I am encountering a strange observation in that when accessing the Rows object for a given table, the object returns all the fields except for those that are of the reference type. I am using the HEAD version... Is this a bug? -- --- You received this message because you are subscribed to

Re: [web2py] How to restrict choices in an OPTIONS widget based on values in that row or the default value

2013-01-03 Thread Calvin
the countries form is shown, I am wondering if there is a way to add a filter to the options widget? On Wednesday, 2 January 2013 20:13:46 UTC+8, viniciusban wrote: Ajax will help you. You need to load countries HTML OPTION's when continent changes. On Wed, Jan 2, 2013 at 3:26 AM, Calvin

[web2py] Re: SQLFORM widget support for wider range of input types

2013-01-01 Thread Calvin
variable and use the widget method of the base class? Massimo On Sunday, 30 December 2012 12:01:06 UTC-6, Calvin wrote: Hi Massimo Here is a patch which updates the date, time and datetime widget. If this approach is acceptable, I am happy to provide a patch for the other types as well

[web2py] How to restrict choices in an OPTIONS widget based on values in that row or the default value

2013-01-01 Thread Calvin
Say I have a look-up tables as follows: db.define_table('continent', Field('name') ) db.define_table('country', Field('name'), Field('in_continent', db.continent, requi) ) Now, if I then have a table as defined: I would then like to have an SQLFORM in which field country presents a

[web2py] Re: SQLFORM widget support for wider range of input types

2012-12-30 Thread Calvin
Hi Massimo Here is a patch which updates the date, time and datetime widget. If this approach is acceptable, I am happy to provide a patch for the other types as well. Calvin On Sunday, 30 December 2012 00:50:59 UTC+8, Massimo Di Pierro wrote: I think this would be a good idea but somebody

[web2py] SQLFORM widget support for wider range of input types

2012-12-29 Thread Calvin
WHATWG (*Web Hypertext Application Technology Working Grouphttp://www.whatwg.org/ ) list a wide range of input types in * http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#states-of-the-type-attribute Could we update SQLFORM.widgets so that a whole

[web2py] How to get T() to work within a module?

2012-11-27 Thread Calvin
I would like to get the translation function T() working within a module in web2py but I am not sure how one would go abouts importing the necessary modules to do that. Could someone enlighten me on this? Many thanks in advance! Calvin --

Re: [web2py] How do you I use geo-spatial types in Web2py DAL?

2012-10-01 Thread Calvin
further clues? many thanks Calvin - On Thursday, 27 September 2012 18:14:49 UTC+8, Manuele wrote: Il 27/09/2012 05:02, Calvin ha scritto: Hi I am a big fan of Web2py and would like to use the DAL for capturing location specific information. I use MySQL as a back-end

[web2py] How do you I use geo-spatial types in Web2py DAL?

2012-09-26 Thread Calvin
. For instance, how could I get the DAL to define a field as a WKT point? Many thanks Calvin --

[web2py] SQLTABLE param headers=None bug - Web2py 1.99.2 (2011-09-26 06:55:33) stable

2011-10-26 Thread Calvin
(_width=c['width']) if c['class']!=: attrcol.update(_class=c['class']) row.append(TH(c['label'],**attrcol)) components.append(THEAD(TR(*row))) +else: + headers={} Cheers Calvin