[web2py] sqlform custom fails to hide errors

2013-04-25 Thread yashar
i set form.errors = dict() at the end of controller but i still get errors, is this a bug or i'm doing a wrong way? -- --- 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

[web2py] Count and distinct

2013-04-25 Thread Domagoj Kovač
Hi, i have a count problem. I have two queries. assets = db((db.asset.asset_class_id == asset_class_id) & (db.asset_value.asset_id == db.asset.id) & (db.asset_value.location_value == location_id)).select(db.asset.ALL,

[web2py] Re: Count and distinct

2013-04-25 Thread Domagoj Kovač
In documentation i see: >>> count = db.person.id.count() >>> for row in db(db.person.id==db.thing.owner_id).select( db.person.name, count, groupby=db.person.name): print row.person.name, row[count] Alex 2 Bob 1 but i need to limit the number of rows -- --- You received this m

Re: [web2py] Re: REF: Generated SQLFORM form behavior sought

2013-04-25 Thread Teddy Nyambe
Hey cheers!!! exactly what am looking for On Thu, Apr 25, 2013 at 8:40 AM, Johann Spies wrote: > What about using the keepvalues option: > > From the book: > > form.accepts(vars, session=None, formname='default', > keepvalues=False, onvalidation=None, > dbio=True, h

[web2py] REF: file upload not working when form is rendered using LOAD() or component=()

2013-04-25 Thread Teddy Nyambe
I am having a nightmare getting file upload to work when the form is loaded using LOAD or component=(URL, tarrget=div). The file fails to be uploaded but the record is added to the DB without the file record. It does also not appear in the upload folder -- ...

[web2py] Connecting to remote database - ERROR', '42P07', 'relation "mytable" already exists

2013-04-25 Thread at
Hi, I am trying to connect to a remote postgres database running on a ubuntu server. The application is hosted on windows 7 server. Getting following error on application startup: ('ERROR', '42P07', 'relation "mytable" already exists') The strange thing is in databases folder, I already have

[web2py] Re: REF: file upload not working when form is rendered using LOAD() or component=()

2013-04-25 Thread Leonel Câmara
You need to use some ajax file upload mechanism. Here's an example: http://www.web2pyslices.com/slice/show/1438/ajax-file-upload-in-loadweb2py-components If you follow that example, I recommend you put the javascript directly on the webpages that will use it so you don't have to deal with versio

[web2py] Re: twitter error using recipe from admin page

2013-04-25 Thread Leonel Câmara
Well the local variable 'r' referenced before assignment seems obvious, if you have no data, like it is happening now (the response has "results":[]), then r never gets defined. You could fix this setting r = [] before the for. Quarta-feira, 24 de Abril de 2013 10:01:05 UTC+1, 黄祥 escreveu: > >

[web2py] Re: Connecting to remote database - ERROR', '42P07', 'relation "mytable" already exists

2013-04-25 Thread Niphlod
you may have the mytable file but the connection string when it was generated was different (there's a hash in front of all .table files just for this). Anyway, if you're sure that you don't need to trigger any migration, just set fake_migrate_all=True for one request and all .table files will

[web2py] Re: Count and distinct

2013-04-25 Thread Niphlod
what's the purpose of limiting the number of rows you have to count ? On Thursday, April 25, 2013 11:39:50 AM UTC+2, Domagoj Kovač wrote: > > In documentation i see: > > >>> count = db.person.id.count() > >>> for row in db(db.person.id==db.thing.owner_id).select( > db.person.name, count,

[web2py] Re: REF: File Upload does not work on a component loaded using ajax....

2013-04-25 Thread Niphlod
http://web2py.com/books/default/chapter/29/12?search=uploads *Because Ajax post does not support multipart forms, i.e. file uploads, upload fields will not work with the LOAD component. You could be fooled into thinking it would work because upload fields will function normally if POST is done

[web2py] Re: Count and distinct

2013-04-25 Thread Domagoj Kovač
You misunderstood me. In the post above there is a regular select without limitby clause, i want to limit number of records in that select, so i assume count will be also limit? -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubsc

Re: [web2py] Re: REF: File Upload does not work on a component loaded using ajax....

2013-04-25 Thread Teddy Nyambe
Thanx!!! will check it out. On Thu, Apr 25, 2013 at 2:09 PM, Niphlod wrote: > http://web2py.com/books/default/chapter/29/12?search=uploads > > *Because Ajax post does not support multipart forms, i.e. file uploads, > upload fields will not work with the LOAD component. You could be fooled > int

[web2py] Combining inner and left outer joins in a query

2013-04-25 Thread Philip Kilner
Hi, I have three tables, say "parent", "child" and "grandchild", and want to do an inner join on parent and child, and left outer join on child & grandchild. So, all parents with children, and all grandchildren if they exist. However, I can't accomplish this in a single query, and have been

[web2py] Re: sqlform custom fails to hide errors

2013-04-25 Thread Anthony
During validation, each input gets its own reference to form.errors, so if you simply replace form.errors, each input will still refer to the original form.errors. So, instead of replacing form.errors, you have to alter it: form.errors.clear() Anyway, this shouldn't be necessary, because you ca

[web2py] Re: sqlform custom fails to hide errors

2013-04-25 Thread yashar
thanks, what is the difference between hideerror in sqlform and form.process? i noticed errors hide only if i use hideerror in sqlform not in form.process On Thursday, April 25, 2013 5:16:27 PM UTC+4:30, Anthony wrote: > > During validation, each input gets its own reference to form.errors, so i

Re: [web2py] Re: REF: file upload not working when form is rendered using LOAD() or component=()

2013-04-25 Thread Teddy Nyambe
This is not cool, its giving me a weird behaviour and its not even working. On Thu, Apr 25, 2013 at 1:19 PM, Leonel Câmara wrote: > You need to use some ajax file upload mechanism. > > Here's an example: > > http://www.web2pyslices.com/slice/show/1438/ajax-file-upload-in-loadweb2py-components >

Re: [web2py] Re: REF: File Upload does not work on a component loaded using ajax....

2013-04-25 Thread Teddy Nyambe
Can I have an example looked at a slice it does not work either! On Thu, Apr 25, 2013 at 2:18 PM, Teddy Nyambe wrote: > Thanx!!! will check it out. > > > On Thu, Apr 25, 2013 at 2:09 PM, Niphlod wrote: > >> http://web2py.com/books/default/chapter/29/12?search=uploads >> >> *Because Ajax post do

[web2py] Re: sqlform custom fails to hide errors

2013-04-25 Thread Anthony
Technically, hideerror is an argument of the .accepts() method of FORM (and therefore SQLFORM) -- it is also an argument of .validate() and .process(), which ultimately call .accepts(). Because of the way it is implemented, you can also pass hideerror directly to FORM() and SQLFORM(). It should

[web2py] custom widget dont work

2013-04-25 Thread Alexandre Andrade
I am trying to customize a json field to use a widget to be used at SQLFORM.smartgrid that: 1. create a custom number of inputs to receive quantity of items for each month of project 2. put this values on json field 3. update them at database. the 2 first i could put to work, using the code below

[web2py] Datetime calculations and some genearal functionality advice

2013-04-25 Thread Trevor Overman
So for the website that I'm developing I want my users to be able to set "availabilities," and after they have expired, I want them to be set as inactive . Also another feature would be validating the form to make sure the start and end time contained a vaild availibility (ex. the start time <

Re: [web2py] Combining inner and left outer joins in a query

2013-04-25 Thread Richard Vézina
I think your mistake is the following : db(where clauses).select(tables and join) So your query should read like this : rows=db(WHERE CLAUSE IF YOU HAVE SOME OTHER THAN THE JOIN).select(db.parent.ALL, db.child.ALL, db.grandchild.ALL, join=db.child.on(db.child.**parent_id== db.parent.id), left=db

[web2py] Re: Datetime calculations and some genearal functionality advice

2013-04-25 Thread 黄祥
for form validation and list user i think you can do something like : e.g. using sqlform.grid (you can modified it if you want to use sqlform) def __onvalidation_booking(form): if form.vars.start_availability > form.vars.end_availability: form.errors.end_availability = 'End Availabili

[web2py] Re: saving UPS shipping labels

2013-04-25 Thread Christian Foster Howes
how are you setting self.accept_result.dict_response? if it is request args or vars web2py does some checking to prevent various code injection attacks. maybe that is mucking with your binary data? On Friday, April 19, 2013 1:51:29 PM UTC-7, Jim Gregory wrote: > > I'm working on a script to ge

[web2py] Re: Use DAL connection pool for MongoDB?

2013-04-25 Thread Alan Etkin
> > DAL now supports MongoDB which is nice for auth and forms. But I'd like to > use the MongoDB query facilities (and maybe GridFS). > Is it possible to obtain a connection to the database through DAL or > should just use pymongo's MongoClient, as if it was another application? > A possible s

Re: [web2py] Re: REF: file upload not working when form is rendered using LOAD() or component=()

2013-04-25 Thread Leonel Câmara
It's not working because you're doing something wrong. Probably because you're just copy pasting things without thinking. Here is an example of a working view using it, you can replace {{=form}} with your LOAD. {{extend 'layout.html'}} {{block head}} http://malsup.github.com/jquery.form.js";>

[web2py] compute field insert/update

2013-04-25 Thread Ivan Šandrk
I'm using a compute field to set uid's for model instances. The problem is that the compute function gets called on INSERT and on each subsequent UPDATE operation. I don't want the UPDATE's to change this field - can I somehow detect where there's an INSERT or an UPDATE in progress? I thought a

[web2py] Re: CAS provider: additional fields only picked up at creation of local user

2013-04-25 Thread Massimo Di Pierro
auth_user stores the information about users auth_cas stores the tickets used by CAS to determine whether a user is logged in or not. It is used for the CAS server, not client. On Wednesday, 24 April 2013 14:00:17 UTC-5, mjm wrote: > > The docs at > http://web2py.com/books/default/chapter/29/09

[web2py] Query doesn't select the proper range

2013-04-25 Thread David S
I've got a query which looks like this: (db.tracking.number >= 0) & (db.tracking.number <= 22000) where number is an integer. And this should select everything with numberbetween 0 and 22000 but it doesn't. For example, if I set the query to just (db.tracking.number >= 0) as expected it grab

[web2py] seems to be a bug in dal v 2.4.2

2013-04-25 Thread Cliff Kachinske
Code very similar to this has worked in prior versions of Web2py. pertinent code from controller: PRODS = db.purchased_products POPRODS = db.purchase_order_products #base query just does a join q = LOTS.product_id==PRODS.id # find out if we need to add to the base query field = request.get_vars

[web2py] Re: Connecting to remote database - ERROR', '42P07', 'relation "mytable" already exists

2013-04-25 Thread at
Thanks for the help. It worked. After regeneration of .table files, fake_migrate_all flag should be set to False again, right? Regards On Thursday, 25 April 2013 17:04:15 UTC+5, Niphlod wrote: > > you may have the mytable file but the connection string when it was > generated was different (t

[web2py] Re: Bootstrap typeahead

2013-04-25 Thread Annet
Thank you both for your replies. The reason I asked was I want to narrow the number of third party JavaScript plugins down as much as I can. Furthermore, the autocomplete/typeahead source is a table containing 5000+ records, that's why my source is a json one. For now I'll stick with a customiz

[web2py] Re: Connecting to remote database - ERROR', '42P07', 'relation "mytable" already exists

2013-04-25 Thread Niphlod
yes ideally you run in production with migrate=False. When you need to change table models, than migrate=True. When you run into sync problems, and only then, fake_migrate_all is there to help. On Thursday, April 25, 2013 6:47:35 PM UTC+2, at wrote: > > > Thanks for the help. It worked. > >

[web2py] Re: seems to be a bug in dal v 2.4.2

2013-04-25 Thread Niphlod
prepare a table model and a select() to reproduce the issue please... PS: I'm not sure that &= is recommended/supported. -- --- 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, sen

[web2py] Re: Query doesn't select the proper range

2013-04-25 Thread Niphlod
As long as web2py "goes", it issues a select to your database engine and that one is responsible for picking up the records you want. Is the select generated by web2py correct ? If yes, then it's a problem either with your backend or your data. If not, then pack an app to reproduce the issue. PS

[web2py] Re: compute field insert/update

2013-04-25 Thread Niphlod
a computed field gets calculated on update by design. it's something "dependant" on all other rows values, so if they change, the computed value needs to change also. If you want to calculate it only on insert, why don't you just set a default value ? If the case is more complicated, I urge

[web2py] Re: Count and distinct

2013-04-25 Thread Niphlod
that's more or less exactly what I don't understand. you usually count() something without any limits because you don't know the cardinality of your wanted resultset. If you limit your resultset to n rows, what's the purpose of counting ? That's why there's no db(query).count(limitby=(0,n))

[web2py] Re: compute field insert/update

2013-04-25 Thread Ivan Šandrk
Ah silly me, I totally overlooked the default functionality. And those triggers seem useful. Thanks :-) On Thursday, April 25, 2013 8:23:24 PM UTC+2, Niphlod wrote: > > a computed field gets calculated on update by design. it's something > "dependant" on all other rows values, so if they cha

[web2py] Re: Query doesn't select the proper range

2013-04-25 Thread David S
I am using SQLite and had changed from string->int so I deleted all of the database files in /myapp/databases and then reloaded all of the data. The issue persisted :( The select generated is correct. I think you're right in saying it's something wrong with the backend. Thanks! David -- --

[web2py] wymeditor

2013-04-25 Thread Annet
Does any one use wymeditor in web2py? I downloaded version 0.5 and put it in the static folder, and included the following tag in layout.html and used the following function: $(document).ready(function(){ $('#promo_text').wymeditor(); }); For some reason this doesn't turn the promo_text

[web2py] Re: Count and distinct

2013-04-25 Thread Domagoj Kovač
count = db.person.id.count() I understand this line of code, it is obvious that limitby clause here would be stupid. >>> for row in db(db.person.id==db.thing.owner_id).select( db.person.name, count, groupby=db.person.name): print row.person.name, row[count] Alex 2 Bob 1 I don'

[web2py] Re: Alternative to SQLFORM for Angular

2013-04-25 Thread RHC
Thanks to all of you for your suggestions. I'm not sure which way I'll tackle this, but I have a good understanding now of what my options are to tweak the SQLFORM feature. Your help is much appreciated. -- --- You received this message because you are subscribed to the Google Groups "web2py

[web2py] Re: Count and distinct

2013-04-25 Thread Derek
Yeah, I agree. I read the documentation and I have no clue what is happening there. Are there two people named Alex? Does 'Alex' own two items? Why is it grouping by person name instead of person id? Why is 'count' assigned as a count of person IDs, used as an argument in the select (presumably

[web2py] Re: Use DAL connection pool for MongoDB?

2013-04-25 Thread mjm
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_o

[web2py] Re: How hide comments column (w2p_fc) from SQLFORM.grid() when edit some record

2013-04-25 Thread Christian Espinoza
Thanks Mark! -- --- 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

[web2py] Re: Count and distinct

2013-04-25 Thread Anthony
db.person.id.count() returns an Expression object. It generates SQL like "COUNT(person.id)". When it is passed to the .select(), the count is returned as one of the columns in the result. The key used to identify the count column in each Row object of the result is the count SQL itself (i.e., "

Re: [web2py] Re: getting data from query with SQLFORM.grid

2013-04-25 Thread Christian Espinoza
Hi Massimo, I'm wondering how apply this change, I tried with the last version, but isn't work yet, I thought that was implemented in gluon\sqlhtml.py line 2242... I'm trying to call it on this way: grid = SQLFORM.grid() return dict(form=form, grid=grid, license_plate=license_plate, summary=

[web2py] Re: onvalidation in SQLFORM.grid (V2.0.9)

2013-04-25 Thread Martín Miranda
Hiding errors in SQLFORM.grid? for example: form = SQLFORM(db.table): if form.accepts(request.vars, hideerror=True): In SQLFORM.grid? El viernes, 14 de septiembre de 2012 08:25:45 UTC-3, Gerd escribió: > > Hi! > > I receive the following error > > Traceback (most recent call last): >

[web2py] Re: seems to be a bug in dal v 2.4.2

2013-04-25 Thread Massimo Di Pierro
&= is now in trunk but one cannot do query = date_field < "4/1/13 and 4/5/13" On Thursday, 25 April 2013 13:16:52 UTC-5, Niphlod wrote: > > prepare a table model and a select() to reproduce the issue please... > > PS: I'm not sure that &= is recommended/supported. > -- --- You received this

[web2py] Re: Load testing Web2py application under GAE using gatling: session cookie is not recogonized

2013-04-25 Thread Aravindan Rs
I raised the issue https://code.google.com/p/web2py/issues/detail?id=1462 Thanks and warm regards, Aravindan. On Wednesday, 24 April 2013 09:54:01 UTC+5:30, Massimo Di Pierro wrote: > > This is reasonable request and we may be able to accommodate it. Please > open a ticket on google code. > > ht

[web2py] Re: seems to be a bug in dal v 2.4.2

2013-04-25 Thread Anthony
On Thursday, April 25, 2013 7:11:17 PM UTC-4, Massimo Di Pierro wrote: > &= is now in trunk but one cannot do I think it's always been possible to do &= with Query objects because the __and__ method is defined. What was recently added was __rand__ and __ror__, which according to http://docs.p

[web2py] Re: seems to be a bug in dal v 2.4.2

2013-04-25 Thread Cliff Kachinske
The &= is working on other query clauses, just not the ones I said were giving problems. I'll get dal.py from trunk tomorrow AM and try it. @Massimo, perhaps I wasn't clear. This query = date_field < "4/1/13 and 4/5/13" stuff isn't what I wrote, it's what dal.py emitted. On Thursday, April 2

[web2py] recaptcha in custom forms

2013-04-25 Thread 黄祥
hi is it possible to use recaptcha in custom forms? i've already tested it but it return an error : Traceback 1. 2. 3. 4. 5. 6. 7. 8. Traceback (most recent call last): File "/home/stifank/Desktop/web2py/gluon/restricted.py", line 212, in restricted exec ccode in environment File "/hom

[web2py] Re: twitter error using recipe from admin page

2013-04-25 Thread 黄祥
it's work now, thank you so much for your hint leonel. for the recipe in admin page it seems have limitation, because when i use it, no tweets showed up, when i use the twitter widget it can show up. -- --- You received this message because you are subscribed to the Google Groups "web2py-use

[web2py] Re: seems to be a bug in dal v 2.4.2

2013-04-25 Thread Massimo Di Pierro
I do not think the problem is &== but the data you are comparing (a date with a string). On Thursday, 25 April 2013 21:13:09 UTC-5, Cliff Kachinske wrote: > > The &= is working on other query clauses, just not the ones I said were > giving problems. > > I'll get dal.py from trunk tomorrow AM and

Re: [web2py] Re: REF: file upload not working when form is rendered using LOAD() or component=()

2013-04-25 Thread Teddy Nyambe
Thanx buddy!!! its working. I will go through the code and go through Massimo's book and understand why it does not work when using ajax. I still dont understand the code, but it works now. Thanx a lot! On Thu, Apr 25, 2013 at 5:37 PM, Leonel Câmara wrote: > It's not working because you're doin

Re: [web2py] Combining inner and left outer joins in a query

2013-04-25 Thread Philip Kilner
Hi Richard, On 25/04/13 15:35, Richard Vézina wrote: I think your mistake is the following : db(where clauses).select(tables and join) I've not seen it summarised quite like that before - very helpful, thank you. I've got a bit of a mental block about this (as evidenced by the fact that

[web2py] Re: Count and distinct

2013-04-25 Thread Domagoj Kovač
I understand now, there are two pepople named Alex and one named Bob. Much better example would be to put example like: >>> for row in db(db.person.id==db.thing.owner_id).select( db.person.name, count, groupby=db.person.name): print row.person.name, row[count] Alex 2 Bob 4 Here