[web2py] list:reference widget depends on order of define_table statements

2013-03-20 Thread Ricardo Cárdenas
I define two tables: category and product. Product can belong in multiple categories; M:M relationship expressed thus: db.define_table('category', Field('name')) db.define_table('product', Field('name'), Field('categories', 'list:reference category')) When I define the controller for adding a p

[web2py] "4 minutes ago"

2013-03-22 Thread Ricardo Cárdenas
My google-fu has not helped me come up with an answer... Django has a set of template filters they call "humanize" which will add a nice touch to data. (Java also has a lib called PrettyTime.) For example it will convert "Fri Mar 22, 20:23" into "4 minutes ago", or "Fri Mar 21" into "yesterday"

[web2py] Re: "4 minutes ago"

2013-03-22 Thread Ricardo Cárdenas
Got it - thanks. On Friday, March 22, 2013 8:27:32 PM UTC-5, Ricardo Cárdenas wrote: > > My google-fu has not helped me come up with an answer... > > Django has a set of template filters they call "humanize" which will add a > nice touch to data. (Java also has a li

[web2py] Re: 'list:reference', contains, Mysql, instr

2013-04-01 Thread Ricardo Cárdenas
Hi, I think I've run into this problem too (Web2py 2.4.5-stable, PostgreSQL 9.1.8.). I have a list of movies; each may be tagged with one or more genres. Each user in the system may show interest in one or more genres: db.define_table('genre', Field('name'), format='%(name)s') db.define_table('

[web2py] Re: 'list:reference', contains, Mysql, instr

2013-04-01 Thread Ricardo Cárdenas
ments before the latest commit by Massimo) was > supposed to take a "fixed" value, not a column. > > > On Monday, April 1, 2013 4:31:59 PM UTC+2, Massimo Di Pierro wrote: >> >> Fixed in trunk. Please check it out. >> >> On Monday, 1 April 2013 08:5

[web2py] Re: 'list:reference', contains, Mysql, instr

2013-04-03 Thread Ricardo Cárdenas
execute(*a, **b) File "/home/ricardo/src/web2py/gluon/dal.py", line 1756, in log_execute ret = self.cursor.execute(*a, **b) OperationalError: no such function: CONCAT thanks for your time. best regards -Ricardo On Monday, April 1, 2013 9:31:59 AM UTC-5, Massimo Di Pierro wrote: &

[web2py] upgrade to 2.4.6 breaks existing code. function replace in psycopg2

2013-04-13 Thread Ricardo Cárdenas
Just upgraded to 2.4.6-stable+timestamp.2013.04.12.23.32.51. Code that worked in my prior version (I think trunk 2013.04.02? sorry don't have the exact version on-hand) now breaks. I get the following error: function replace(integer, unknown, unknown) does not exist LINE 1: ...ost.groups AS CH

[web2py] Re: upgrade to 2.4.6 breaks existing code. function replace in psycopg2

2013-04-13 Thread Ricardo Cárdenas
db(..)._select() with the underscore) ? > > On Saturday, April 13, 2013 4:28:55 PM UTC+2, Ricardo Cárdenas wrote: >> >> Just upgraded to 2.4.6-stable+timestamp.2013.04.12.23.32.51. >> >> Code that worked in my prior version (I think trunk 2013.04.02? sorry

[web2py] Re: upgrade to 2.4.6 breaks existing code. function replace in psycopg2

2013-04-15 Thread Ricardo Cárdenas
> http://www.postgresql.org/docs/8.1/static/functions-string.html > > On Saturday, 13 April 2013 15:23:04 UTC-5, Ricardo Cárdenas wrote: >> >> Hi niphlod, here's the code: >> >> p = db.my_post >> g = db.my_group >> m = db.my_membershi

[web2py] hiding a column in smartgrid

2013-05-27 Thread Ricardo Cárdenas
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 user to be able to visit the URL directly from the grid. So I use the 'links' parameter to SQLFORM.smartgrid. It works very nicely: links=[dict(header="

Re: [web2py] database shootout

2013-05-27 Thread Ricardo Cárdenas
Among RDBMSs, I personally prefer Postgres too, for many of the reasons mentioned - quality of build and add-ons, platform availability, SQL compliance, optional commercial support, Oracle compatibility. But another factor to consider is deployment on IaaS/PaaS options. Heroku and OpenShift can

Re: [web2py] Re: hiding a column in smartgrid

2013-05-27 Thread Ricardo Cárdenas
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 wh

Re: [web2py] Re: database shootout

2013-05-28 Thread Ricardo Cárdenas
Just got email from a PA developer saying they're hoping to have Postgres 9.2 out next month. Good news! On Tue, May 28, 2013 at 8:23 AM, Cliff Kachinske wrote: > They [PythonAnywhere] list Psycopg2 among the installed gadgets. This > will definitely push me in their direction. -- --- You

[web2py] Re: how to use last()?

2013-08-26 Thread Ricardo Cárdenas
Hello Dave, You're almost there actually. You are correct that last() gives you a row object instead of a rows object. Then, the as_dict() converts the row object to a Python dict object, an object which maps keys (the field na

[web2py] geocode() return value

2013-09-24 Thread Ricardo Cárdenas
Hi, The gluon.tools geocode() function is great. A minor suggestion. Right now it returns (0,0) on any execption. It would be nice if the function distinguished between *unable to geocode this address* and other problems (such as quota reached). Use case: I geocode addresses as they come in a

Re: [web2py] geocode() return value

2013-09-24 Thread Ricardo Cárdenas
38 AM UTC-5, Manuele wrote: > > Il 24/09/13 15:13, Ricardo Cárdenas ha scritto: > > The gluon.tools geocode() function is great. > > A minor suggestion. Right now it returns (0,0) on any execption. It > would be nice if the function distinguished between *unable to geocode &g

[web2py] batch script - best way to reopen a closed database connection?

2013-09-24 Thread Ricardo Cárdenas
I have a web2py app running fine on pythonanywhere. I have a minor problem - I think I understand why it is happening, but would seek your advice as to how best to fix it. The app itself works fine. But I also run a scheduled task using PA's scheduler, by executing "python web2py.py -S appname

[web2py] Re: batch script - best way to reopen a closed database connection?

2013-09-24 Thread Ricardo Cárdenas
, you should open a new connection. You'd > think there is a large overhead in creating a connection, but there isn't. > > On Tuesday, September 24, 2013 2:33:24 PM UTC-7, Ricardo Cárdenas wrote: >> >> I have a web2py app running fine on pythonanywhere. I have a minor &g

Re: [web2py] Re: batch script - best way to reopen a closed database connection?

2013-09-24 Thread Ricardo Cárdenas
tion is taken > from the pool and *tested* for being functioning. > If the connection is dead it's replaced by a new one. Then a transaction > is started on that connection. > > mic > > > 2013/9/24 Ricardo Cárdenas > > >> Derek, thanks for your sugges

[web2py] Re: batch script - best way to reopen a closed database connection?

2013-09-24 Thread Ricardo Cárdenas
@niphlod - db.reconnect() method does not exist, but db._adapter.reconnect() does. I'll try it now - though I'm a little reluctant to use an underscore_attribute that was probably meant to be private :) On Tuesday, September 24, 2013 5:23:31 PM UTC-5, Niphlod wrote: > > if I'm not mistaken a s

[web2py] Re: batch script - best way to reopen a closed database connection?

2013-09-24 Thread Ricardo Cárdenas
@Derek - makes sense - I'll try this. thanks again. On Tuesday, September 24, 2013 5:14:28 PM UTC-5, Derek wrote: > > import db.py always, that should be your first line of a function. > > On Tuesday, September 24, 2013 2:55:21 PM UTC-7, Ricardo Cárdenas wrote: >> &g

Re: [web2py] Re: batch script - best way to reopen a closed database connection?

2013-09-25 Thread Ricardo Cárdenas
ep in the pool" [ :-) ] when > there is a commit. > When one starts operating on the DAL instance (db) a connection is taken > from the pool and *tested* for being functioning. > If the connection is dead it's replaced by a new one. Then a transaction > is started on that

Re: [web2py] Re: batch script - best way to reopen a closed database connection?

2013-09-26 Thread Ricardo Cárdenas
ction: return self.connection.rollback() _mysql_exceptions.OperationalError: (2006, 'MySQL server has gone away') On Wednesday, September 25, 2013 8:36:01 AM UTC-5, Michele Comitini wrote: > > > > -- Forwarded message ------ > From: Michele Comitini >

[web2py] contributing patches

2013-09-27 Thread Ricardo Cárdenas
(Apologies if this has been asked before.) Kudos for web2py and for this community; happy to have found you. Web2py's very useful for my projects; even enjoyable! I'd like to pay it back, starting with minor patches that I think could be useful to others. I can fork and watch on github, and gen

[web2py] Re: Help with production deployment on virtual server

2013-10-22 Thread Ricardo Cárdenas
Hello curious, I'l assume you're using web2py 2.6 (you reference the handlers/ directory, which is new). Please review handlers/README. wsgihandler.py (all handlers in fact) is meant to be copied to web2py's root directory. Hope this helps, please report back... best regards -Ricardo On Tues

[web2py] Re: Issue with defaultdict(list)

2018-05-20 Thread Ricardo Cárdenas
Hi Drew and all, I saw the same exact problem Drew saw with *defaultdict(list)*. For the benefit of any future debuggers, I thought I'd document what went wrong in our case. One of the functions in the controller was inappropriately named *list()*, thus overriding the definition of *list()* it

Re: [web2py] web2py conference - online talks

2014-05-19 Thread Ricardo Cárdenas
Kudos to everyone involved in the web2py conference! I'm having trouble watching the videos - maybe it's my connection, but often the video stops and the pointer resets to the beginning of the video. I'm having to refresh the browser and start over. I don't know if others are having these probl