[web2py] How to restrict file type to pdf

2014-08-06 Thread 'sasogeek' via web2py-users
How can I restrict the uploaded file type to only pdf? I know that with images i could use the IS_IMAGE() validator, I don't know how to do same for pdf files though. help...? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source co

Re: [web2py] Re: web2py on heroku getting "InternalError: current transaction is aborted..." Ticket

2014-08-06 Thread Louis Amon
Got the same issue as well. Apparently the problem has to do with the "UseDatabaseStoredFile" class inherited by the "HerokuPostgresAdapter". It is designed to store the filesystem ("databases" folder and files) in a table instead, and was created for GAE but doesn't seem to work on Heroku. Th

[web2py] reLOAD only if modified

2014-08-06 Thread Martin Weissenboeck
What I want: I use a LOAD helper, which refreshes a page every second. But it would be better to transfer this page only if it has changed. Anthony wrote on http://stackoverflow.com/questions/14515313/how-to-modify-web2py-download-function-to-return-304-not-modified-in-case-the how to change the h

[web2py] Is there a way to find ID of inserted row if there is trigger after insert?

2014-08-06 Thread Dragan Matic
If I do something like this: new_id = db.table1.insert(...) and there is a trigger that inserts row in another table (table2) based on insert in table1 then the value of new_id is the id that is inserted in table2 instead of table1. Is this a bug or a feature? If it is a feature how can I get

[web2py] Re: How to restrict file type to pdf

2014-08-06 Thread Leonel Câmara
requires = IS_UPLOAD_FILENAME(extension='pdf') -- 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 are subscribed to the

[web2py] Re: Is there a way to find ID of inserted row if there is trigger after insert?

2014-08-06 Thread Leonel Câmara
Check _after_insert it's probably what you want. http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#before-and-after-callbacks -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.g

[web2py] Re: Is there a way to find ID of inserted row if there is trigger after insert?

2014-08-06 Thread Niphlod
it doesn't have to do with after_insert . it's something "broken" at the backend level. what backend are you using dragan ? On Wednesday, August 6, 2014 12:24:15 PM UTC+2, Leonel Câmara wrote: > > Check _after_insert it's probably what you want. > > > http://www.web2py.com/books/default/c

[web2py] Re: Is there a way to find ID of inserted row if there is trigger after insert?

2014-08-06 Thread Dragan Matic
Version 2.9.5-stable+timestamp.2014.03.16.02.35.39 Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(pg8000), IMAP(imaplib) Postgresql 9.3 on linux mint 17. trigger is BEFORE_INSERT On Wednesday, August 6, 2014 12:30:30 PM UTC+2, Niphlod wrote: > > it doesn't have to do w

[web2py] Re: Is there a way to find ID of inserted row if there is trigger after insert?

2014-08-06 Thread Dragan Matic
I have found what causes it, in dal.py in PostgreSqlAdapter this method is supposed to return last inserted id: def lastrowid(self,table = None): self.execute("select lastval()") return int(self.cursor.fetchone()[0]) This here http://stackoverflow.com/questions/17819001/postgres

[web2py] web2py with google visualisation app.

2014-08-06 Thread Avi A
Hi, I just wanted to share a short video of an app I made. What it does in short; I do mobile automated tests locally. I use selenium/appium and applitools (awesome startup) which does screenshots comparison for me and when the test ends, they send a json with failed/passed counts info. when tes

Re: [web2py] Web2py Forms and Javascript

2014-08-06 Thread Richard Vézina
Ok, so the list is a should be a dropbox in your app where you can pick the service or the pieces in you invoice? I guess it is now an kind of check list you receive to create the invoice? There is a lot of wording in your business you could start by simplifying all the concept the use and figure

[web2py] SQLFORM cache? Cacheable=True?

2014-08-06 Thread LoveWeb2py
Hello, I'm trying to understand the cacheable=True option. Does this just make the database cacheable or does it actually cache it. When I check web2py's cache status it says nothing is in the cache so I'm guessing it doesn't actually cache anything. Is it possible to cache a SQLFORM? I'm hopi

[web2py] Re: SQLFORM cache? Cacheable=True?

2014-08-06 Thread Niphlod
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=cacheable#Caching-selects On Wednesday, August 6, 2014 4:19:12 PM UTC+2, LoveWeb2py wrote: > > Hello, > > I'm trying to understand the cacheable=True option. Does this just make > the database cacheable or does it

[web2py] Re: SQLFORM cache? Cacheable=True?

2014-08-06 Thread LoveWeb2py
That is the best answer. Sorry about the question. I swear I searched through the book before asking, but this really does a nice job of explaining it. Thanks, Niphlod! On Wednesday, August 6, 2014 10:51:05 AM UTC-4, Niphlod wrote: > > > http://web2py.com/books/default/chapter/29/06/the-databas

[web2py] Re: web2py vs others. Status of 2014

2014-08-06 Thread Cliff Kachinske
Modernizr? Do you think that tall corn interferes with the purchase of new equipment? Whiskey Tango Foxtrot? On Tuesday, August 5, 2014 3:35:50 AM UTC-4, Joe Barnhart wrote: > > I look forward to Massimo's improvements. > > One of the continuing thorns in my side is that a significant number of

[web2py] ajax posts text input twice when name and id are identical

2014-08-06 Thread Cliff Kachinske
This is not supposed to happen and I don't know why it did. The js looks like this: $('#products_on_order').on('click', '.edit_bound_container', function(e){ //alert(this.id); var container_id = this.id.split('__')[1] var count_field = 'bound_container_count_edit__' + con

[web2py] Re: How to add CSS class to SQLFORM.grid??

2014-08-06 Thread Cliff Kachinske
I would go the other way and override the attributes of the existing classes with my own css. Just make sure your css loads last. On Tuesday, August 5, 2014 5:17:42 PM UTC-4, greenpoise wrote: > > How can I make use of my own td classes for SQLFORM.grid?? > > Thanks > -- Resources: - http://

[web2py] Somewhat confused about the way session is updated when using ajax

2014-08-06 Thread Spokes
I've got a page in which ajax is used to update the main content (a bunch of articles), and a variable stored in session is used as an index (let's say there are X articles per page, and the first article shown corresponds to the current index). Regardless of how far the user has scrolled, the

[web2py] How do you display created_by and modified_by names and not id's when using lazy tables?

2014-08-06 Thread Michael Beller
When I set lazy_tables=True in the DAL, all my signatures fields show the user_id and not the user name. I also set db.auth_user._format = '%(last_name)s' which I thought would force the auth_user definition with lazy tables but my signatures still show id's. Any thoughts on what I'm missing?

[web2py] Re: Somewhat confused about the way session is updated when using ajax

2014-08-06 Thread Anthony
The session is handled the same with ajax requests as with any other requests. Hard to say what's going on in this case without seeing any code. Presumably the DOM element you are checking for the session value is not something that is being updated by your Ajax call. Anthony On Wednesday, Aug

[web2py] Re: web2py with google visualisation app.

2014-08-06 Thread lyn2py
Thank you for sharing the short clip! I was wondering how you did the auto-loading of the content within each drop down menu at the top? I always thought that to be difficult and have not ventured far in that area yet. I hope you can share how you did it! Thanks :) On Wednesday, August 6, 2014

[web2py] Re: reLOAD only if modified

2014-08-06 Thread Dave S
On Wednesday, August 6, 2014 2:35:15 AM UTC-7, mweissen wrote: > > [...] > request.now gives the actual time, but if "Last-Modified" and "ETag" are > always the same I think I should see the same time on each call. > > I'm confused by this part of your post ... I think it means 1) request.now

[web2py] Re: How to restrict file type to pdf

2014-08-06 Thread Dave S
On Wednesday, August 6, 2014 3:09:48 AM UTC-7, Leonel Câmara wrote: > > requires = IS_UPLOAD_FILENAME(extension='pdf') > > That would cover the common case where the extension and the filetype agree, but to be sure that it is a valid PDF file probably requires a tool that reads PDF format and ve

[web2py] Re: ajax posts text input twice when name and id are identical

2014-08-06 Thread Anthony
Can you show the relevant HTML? What does the post data look like? On Wednesday, August 6, 2014 5:48:33 PM UTC+2, Cliff Kachinske wrote: > > This is not supposed to happen and I don't know why it did. > > The js looks like this: > $('#products_on_order').on('click', '.edit_bound_container', func

[web2py] Re: How to add CSS class to SQLFORM.grid??

2014-08-06 Thread Dave S
On Tuesday, August 5, 2014 2:17:42 PM UTC-7, greenpoise wrote: > > How can I make use of my own td classes for SQLFORM.grid?? > > Thanks > Does this post help? (credit to Anthony) /dps -- Resources: - http://web2py.com - htt

[web2py] Re: web2py with google visualisation app.

2014-08-06 Thread Avi A
When ever you change an option in one of the dropdown filtering options above, the attached function runs, which sends two of the built in web2py Ajax load function, to two different controllers, and the data is rendered back on the page: $(document).ready(function(){

[web2py] Re: How to add CSS class to SQLFORM.grid??

2014-08-06 Thread greenpoise
I saw that. I think I am going to follow Cliff suggestion. I was thinking to use web2py_grid call and just plug in my css that way I dont lose anything when there is a version update. Thanks! On Wednesday, August 6, 2014 11:13:25 AM UTC-7, Dave S wrote: > > > > On Tuesday, August 5, 2014 2:17

[web2py] Re: How to add CSS class to SQLFORM.grid??

2014-08-06 Thread greenpoise
thanks!! I will do this On Wednesday, August 6, 2014 8:57:37 AM UTC-7, Cliff Kachinske wrote: > > I would go the other way and override the attributes of the existing > classes with my own css. > > Just make sure your css loads last. > > On Tuesday, August 5, 2014 5:17:42 PM UTC-4, greenpois

[web2py] Re: Is there a way to find ID of inserted row if there is trigger after insert?

2014-08-06 Thread Leonel Câmara
I don't think this "bug" is just in PostgreSQL. For instance MSSQL should probably use OUTPUT INSERTED.ID to get the id and Oracle can use RETURNING like PostgreSQL too. Basically any kind of lastval variant can be problematic. -- Resources: - http://web2py.com - http://web2py.com/book (Doc

[web2py] Re: SQLFORM cache? Cacheable=True?

2014-08-06 Thread Niphlod
we stand on the shoulders of giants documenting web2py ;-P On Wednesday, August 6, 2014 5:29:00 PM UTC+2, LoveWeb2py wrote: > > That is the best answer. Sorry about the question. I swear I searched > through the book before asking, but this really does a nice job of > explaining it. > > Thanks,

[web2py] Re: Is there a way to find ID of inserted row if there is trigger after insert?

2014-08-06 Thread Niphlod
not really (scouting through code and docs seems that we're using only for postgresql something that isn't that "stable" when triggers are involved), but it's anyway fixable. On Wednesday, August 6, 2014 8:24:24 PM UTC+2, Leonel Câmara wrote: > > I don't think this "bug" is just in PostgreSQL. F

[web2py] Re: ajax posts text input twice when name and id are identical

2014-08-06 Thread Cliff Kachinske
I can do that. But I discovered it was doing something much more interesting than my original diagnosis. The inputs in question were editable and generated by the controller. As such they had an assigned value. When I ajaxed them to the server, apparently two copies of the input were sent. One

[web2py] Re: Somewhat confused about the way session is updated when using ajax

2014-08-06 Thread Spokes
> > Presumably the DOM element you are checking for the session value is not > something that is being updated by your Ajax call. > Sounds plausible - I'll explore this possibility further. Thank you. On Wednesday, August 6, 2014 12:48:48 PM UTC-5, Anthony wrote: > > The session is handled the

[web2py] Re: Working with MSSQL with codepage other than latin1 or unicode

2014-08-06 Thread Алексей Котряхов
Hello The first problem was solved by changing URI from mssql to mssql2 Now DB connection as following and no problem with viewing and saving strings with cyrillic letters. dbsol = DAL ('mssql2://user:password@w2ptkts/SacuraOnline', db_codec = 'cp

[web2py] Re: template de instalação de aplicação web2py no windows

2014-08-06 Thread Hains Hausmann Junior
Hello! Many thanks for the reply. When I sent the question, did not realize it was the international list of web2py. Should be sent to "web2py-Brazil" list. Sorry. Att Em terça-feira, 5 de agosto de 2014 15h37min15s UTC-3, Dave S escreveu: > > > > On Monday, August 4, 2014 5:46:45 PM UTC-7

[web2py] Re: How to add CSS class to SQLFORM.grid??

2014-08-06 Thread Danel Segarra
I wonder if an update in web2py would affect this? thanks On Wednesday, August 6, 2014 8:57:37 AM UTC-7, Cliff Kachinske wrote: > > I would go the other way and override the attributes of the existing > classes with my own css. > > Just make sure your css loads last. > > On Tuesday, August

[web2py] Re: Somewhat confused about the way session is updated when using ajax

2014-08-06 Thread Spokes
I've been looking into it, and it appears that there is a race condition situation going on, in which it takes a little while for the session value to be updated, and some other functionality is accessing that value before the update is performed. I caught it by accident while debugging using j

[web2py] Re: applications/app/languages

2014-08-06 Thread Massimo Di Pierro
Do not know. Anyway, I am fixing the utf8 in trunk. On Tuesday, 5 August 2014 03:51:52 UTC-5, Carl Hunter Roach wrote: > > Each file in applications/app/languages has a line: > # -*- coding: utf8 -*- > > I've had to ammend this to: > # -*- coding: utf-8 -*- > > otherwise an exception is thrown

[web2py] Re: Somewhat confused about the way session is updated when using ajax

2014-08-06 Thread Anthony
If you are storing sessions in files and not doing session.forget(response) anywhere in your code, then there should not be any race conditions, as the session files are locked in that case, which serializes all requests (including ajax requests). Anthony On Wednesday, August 6, 2014 9:30:30 P

[web2py] Re: Somewhat confused about the way session is updated when using ajax

2014-08-06 Thread Spokes
In that case, I'm really puzzled. Will look into it further. Thank you. On Wednesday, August 6, 2014 2:42:37 PM UTC-5, Anthony wrote: > > If you are storing sessions in files and not doing > session.forget(response) anywhere in your code, then there should not be > any race conditions, as the se

[web2py] Re: web2py with google visualisation app.

2014-08-06 Thread lyn2py
Thank you! I will explore this in the next app! On Thursday, August 7, 2014 2:15:57 AM UTC+8, Avi A wrote: > > When ever you change an option in one of the dropdown filtering options > above, the attached function runs, which sends two of the built in web2py > Ajax load function, to two differen

[web2py] Re: How to add CSS class to SQLFORM.grid??

2014-08-06 Thread Dave S
On Wednesday, August 6, 2014 11:20:33 AM UTC-7, greenpoise wrote: > > I saw that. I think I am going to follow Cliff suggestion. I was thinking > to use web2py_grid call and just plug in my css that way I dont lose > anything when there is a version update. > > Thanks! > > web2py generally main

[web2py] Re: Bare Login using API key

2014-08-06 Thread Massimo Di Pierro
You will find those parameters hashed in request.env.HTTP_AUTHORIZATION (this puzzles me because it is supposed to be request.env.http_authorization) in web2py. Anyway, this method of authentication is discouraged for security reasons and most browsers including Chrome and IE strip the from the

[web2py] Re: Working with MSSQL with codepage other than latin1 or unicode

2014-08-06 Thread Massimo Di Pierro
Before we look into something else can you check the encoding declared in your layout.html? It should be utf8 On Wednesday, 6 August 2014 02:09:26 UTC-5, Алексей Котряхов wrote: > > Hello > The first problem was solved by changing URI from mssql to mssql2 > Now DB connection as following and no

[web2py] Re: web2py vs others. Status of 2014

2014-08-06 Thread Massimo Di Pierro
Very true. On Tuesday, 5 August 2014 02:35:50 UTC-5, Joe Barnhart wrote: > > I look forward to Massimo's improvements. > > One of the continuing thorns in my side is that a significant number of my > users are still on XP and IE8 -- about 15% -- and my users are in > California. I can only imag

[web2py] Re: How do you display created_by and modified_by names and not id's when using lazy tables?

2014-08-06 Thread Cliff Kachinske
Put the represent in the controller. On Wednesday, August 6, 2014 1:36:51 PM UTC-4, Michael Beller wrote: > > When I set lazy_tables=True in the DAL, all my signatures fields show the > user_id and not the user name. > > I also set db.auth_user._format = '%(last_name)s' which I thought would > f

[web2py] Re: scheduler new feature: task dependencies

2014-08-06 Thread Andrew W
Sounds great. Looking forward to testing it out. Thanks Andrew W -- 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 a

[web2py] Re: web2py vs others. Status of 2014

2014-08-06 Thread Dave S
On Wednesday, August 6, 2014 8:35:06 AM UTC-7, Cliff Kachinske wrote: > > Modernizr? > > Do you think that tall corn interferes with the purchase of new equipment? > Whiskey Tango Foxtrot? > > Tall corn is often grown by people who don't jump on the bleeding edge. Some of them don't even jump

[web2py] Re: scheduler new feature: task dependencies

2014-08-06 Thread Andrew W
P.S. Although I expect they are not the same thing, I am interested to see how this dependency feature may be used to implement the workflow ideas expressed in: https://groups.google.com/forum/#!searchin/web2py/workflow/web2py/0z1BysNp8Gc/aQFdaBqymE8J On Thursday, August 7, 2014 7:28:11 A

[web2py] reLOAD only if the content has changed (2)

2014-08-06 Thread Martin Weissenboeck
Dave told me that my explanation was not clear. Let me try it in other words. What I want is a program which periodically reloads a page (I think using LOAD is the best way), but only if I allow it. My idea was that the header parts "Last-Modified" and/or "ETag" could do the job. Therefore I wrote