[web2py] Re: Does migration from a 'string' field to a 'list:string' field preserve data?

2014-01-14 Thread User
I just tested this with a simple app using postgresql database and it seems that it doesn't quite work. It appears it will leave the string data that exists in the string field alone in the database, however web2py will interpret it such that the first and last character are truncated. For

[web2py] Re: linux shell scripts and web2py

2014-01-14 Thread Adam Detektyw
I found that Python uses sth like that: import subprocesssubprocess.call(['./scriptshell.sh']) Looks fine. I must try it. Thanks a lot Regards Adam -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] detect a specific device

2014-01-14 Thread Paolo Valleri
Hi all, I'd develop a web2py responsible app instead of an android app; at a first sight it seams to some extent feasible. The only issue is related to an unusual requirement, the web2py app (running on an intranet) must be accessible only from well defined devices (android tablet). If needed I

[web2py] Quick question about custom message for verification and password reset email sent

2014-01-14 Thread Alex Bush
Hi all, I'm trying to set (custom) messages for both the verification email sent for new user registration and password reset email sent for existing users. I have found the list of available messages here: http://www.web2py.com/book/default/chapter/09 however none of them seem to correspond

[web2py] Re: Quick question about custom message for verification and password reset email sent

2014-01-14 Thread Anthony
On Tuesday, January 14, 2014 7:28:14 AM UTC-5, Alex Bush wrote: Hi all, I'm trying to set (custom) messages for both the verification email sent for new user registration Do auth.messages.verify_email and auth.messages.verify_email_subject not work for you? Note, auth.messages.email_sent

[web2py] Re: Is there a way to have a field in one table be computed by a field in another table?

2014-01-14 Thread Anthony
If you want db.person to be updated upon changes to db.thing, instead of a computed field in db.person, you probably want to create _after_insert and _after_update callbacks for db.thing (see

[web2py] Re: Does migration from a 'string' field to a 'list:string' field preserve data?

2014-01-14 Thread Anthony
For now, if you want to do a migration, all you have to do is loop through the records and put a pipe character (|) before and after each string. Perhaps this can be automated -- you can submit an issue on Google Code. Anthony On Tuesday, January 14, 2014 1:21:52 AM UTC-5, User wrote: It

[web2py] Re: Quick question about custom message for verification and password reset email sent

2014-01-14 Thread Alex Bush
Appologies if the initial email was confusing and thank you for the reply Anthony, I understand and am using auth.messages.verify_email and auth.messages.verify_email_subject however I wondered if there was any way to set a specific flash message for each situation (verification email sent and

[web2py] Re: SQLFORM and IS_IN_SET problem

2014-01-14 Thread Anthony
On Tuesday, January 14, 2014 1:18:11 AM UTC-5, User wrote: So I tested the migration feature and string to list:string doesn't work. So we are left with the fact that a list:string field with IS_IN_SET multiple=False will not select the current value in an SQLFORM. Seems kind of like a

Re: [web2py] LDAP Auth

2014-01-14 Thread Richard Vézina
Hello Maggs, What you can do is to have 2 differents authentication process the internal web2py process that will allow you to have a password as before and then LDAP process... But you will not have password from LDAP you will have two differents password, except if the user set the same

Re: [web2py] REF: Web2py database issue

2014-01-14 Thread Anthony
On Tuesday, January 14, 2014 9:56:25 AM UTC-5, Richard wrote: Notice migrate_neabled=False as notting to do with read only, it only tell to web2py to not migrate apply to the models in models.py. It is more of a complement. The point is that if two applications are accessing the database,

[web2py] Re: Quick question about custom message for verification and password reset email sent

2014-01-14 Thread Anthony
As I mentioned, you can change auth.messages.email_sent dynamically: def user(): flash = dict(register='Verification email sent', request_reset_password='Reset password email sent') auth.messages.email_sent = flash.get(request.args(0), auth.messages. email_sent)

Re: [web2py] REF: Web2py database issue

2014-01-14 Thread Richard Vézina
Notice migrate_neabled=False as notting to do with read only, it only tell to web2py to not migrate apply to the models in models.py. It is more of a complement. You may also consider to use auth permissions and set them to read and select for every objects in your database for more sercure read

Re: [web2py] Re: Quick question about custom message for verification and password reset email sent

2014-01-14 Thread Alex Bush
Thank you Anthony, that works beautifully! On 14 January 2014 14:56, Anthony abasta...@gmail.com wrote: As I mentioned, you can change auth.messages.email_sent dynamically: def user(): flash = dict(register='Verification email sent', request_reset_password='Reset

Re: [web2py] Re: keepvalues - need help with this

2014-01-14 Thread Anthony
Some instruction about creating custom widgets at the end of this section: http://web2py.com/books/default/chapter/29/07/forms-and-validators#Widgets. On Tuesday, January 14, 2014 12:33:22 AM UTC-5, Kiran Subbaraman wrote: Yes, that works: use request.vars.*. That was the option which I had

Re: [web2py] Re: linux shell scripts and web2py

2014-01-14 Thread Richard Vézina
Depending of the duration of your shell script you may face web server timeout watchout!! Richard On Mon, Jan 13, 2014 at 4:33 PM, Adam Detektyw adambo...@gmail.com wrote: I found that Python uses sth like that: import subprocesssubprocess.call(['./scriptshell.sh']) Looks fine. I must

[web2py] Re: SQLFORM and IS_IN_SET problem

2014-01-14 Thread User
Thanks good point about just modifying the db field directly to add pipe characters if migrating from string to list:string. I think in that case I will make my field a string field and migrate later if necessary. On Tuesday, January 14, 2014 9:48:53 AM UTC-5, Anthony wrote: On Tuesday,

[web2py] Re: Does migration from a 'string' field to a 'list:string' field preserve data?

2014-01-14 Thread User
For completeness and future reference this can also be done directly in SQL for example in postgresql: UPDATE your_table set some_field = '|' || some_field || '|'; On Tuesday, January 14, 2014 8:52:40 AM UTC-5, Anthony wrote: For now, if you want to do a migration, all you have to do is loop

Re: [web2py] Re: keepvalues - need help with this

2014-01-14 Thread Kiran Subbaraman
Anthony, Thanks for the link; that is useful. Also, was looking at the implementation of the default widgets in https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py. I think I can conclude that keepvalues does not retain values, as detailed in this email. Considering that I have to

[web2py] Re: Storing lots of txt files: Database or Filesystem? Advantages/Disadvantages

2014-01-14 Thread Brando
Stifan, that is great info. pulling from the filesystem is much faster. I think i'm going to go this route. Thanks! On Monday, January 13, 2014 7:15:22 PM UTC-8, 黄祥 wrote: please check this discussion. https://groups.google.com/forum/#!topic/web2py/t83nQfT24gE best regards, stifan

Re: [web2py] Re: keepvalues - need help with this

2014-01-14 Thread Anthony
keepvalues is for retaining values when there are no errors (but you want to retain the values from the previous submission). If there are errors, the values will be retained regardless of keepvalues. In your case, you are not using form.custom.widget, so you're not getting the values retained.

[web2py] Re: detect a specific device

2014-01-14 Thread Leonel Câmara
I guess you can use something like: request.user_agent().is_tablet and request.user_agent().dist.name == 'Android' -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list

Re: [web2py] Compile app from command line

2014-01-14 Thread Wonton
Thank you very much for your advise! I will keep this in mind. On Tuesday, January 14, 2014 4:25:22 AM UTC+1, LightDot wrote: Looking at your python version, you're running a RHEL 5 (or a derivative, such as CentOS). Just a word of caution if you decide to attempt updating the OS python's

Re: [web2py] Re: detect a specific device

2014-01-14 Thread paolo.vall...@gmail.com
Hi, what you posted can be a starting point but it is not enough because it doesn't guarantee that a different android tablet has been purchased. The requirement is, only a well defined set of tablets can access the webapp. Paolo 2014/1/14 Leonel Câmara leonelcam...@gmail.com I guess you can

Re: [web2py] Re: detect a specific device

2014-01-14 Thread Dave S
On Tuesday, January 14, 2014 11:05:17 AM UTC-8, Paolo Valleri wrote: Hi, what you posted can be a starting point but it is not enough because it doesn't guarantee that a different android tablet has been purchased. The requirement is, only a well defined set of tablets can access the

[web2py] Re: detect a specific device

2014-01-14 Thread Willoughby
You need to specify what is a 'well defined device'... Even a MAC address can be spoofed. On Tuesday, January 14, 2014 4:23:19 AM UTC-5, Paolo Valleri wrote: Hi all, I'd develop a web2py responsible app instead of an android app; at a first sight it seams to some extent feasible. The only

Re: [web2py] Re: detect a specific device

2014-01-14 Thread Niphlod
this is an architectural problem: what does the device send to your app to be able to identify it ? If it's a webapp and it is accessed via the browser, and there are no running bits on the device itself speaking to your webapp, then the headers and the env are the only thing you can rely onto

[web2py] Re: Is there a way to have a field in one table be computed by a field in another table?

2014-01-14 Thread Apple Mason
Thanks, I came up with this: db.thing._after_insert.append(lambda f,id: db(db.person.id==f['owner_id']).update(total_items=len(db(db.thing.owner_id==f['owner_id']).select( It works, but is there is a better way to do this? Also, can someone help me with _after_delete? _after_delete gives

[web2py] Dynamic form generation using FORM()

2014-01-14 Thread Chris Hepworth
I am trying to make a custom form which allows the selection of a set of images that are in the database. So far I have the following code: rows = db().select(db.a_table.name,db.a_table.image) fields = [] for row in rows: fields += [ INPUT(_type=checkbox,

Re: [web2py] LDAP Auth

2014-01-14 Thread Maggs
Hi Richard, That is perfect and exactly what I need! Thanks so much :) Maggs On Tuesday, January 14, 2014 6:52:51 AM UTC-8, Richard wrote: Hello Maggs, What you can do is to have 2 differents authentication process the internal web2py process that will allow you to have a password as

[web2py] Re: Storing lots of txt files: Database or Filesystem? Advantages/Disadvantages

2014-01-14 Thread Anthony
Keep in mind, in that post, the first method (i.e., with 1 ms responses) involved serving static files. The second method (65-75 ms) also involved storing the files on the filesystem, but they weren't served as static files (instead, they were served using web2py's built-in file

[web2py] Re: Is there a way to have a field in one table be computed by a field in another table?

2014-01-14 Thread 黄祥
another way around i think you can do it in web form using oncreate, onupdate and ondelete. and for delete callback, please check this discussion : https://groups.google.com/forum/#!topic/web2py/didLpxEKT38 reference for oncreate, onupdate and ondelete, please check this discussion :

[web2py] Re: linux shell scripts and web2py

2014-01-14 Thread 黄祥
import subprocesssubprocess.call(['./scriptshell.sh']) is it can be used for windows batch files too? just a suggestion, why not use configuration management like puppet, chef or cfengine? best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: Need a Web2py tutor/mentor.

2014-01-14 Thread samuel bonill
look : https://groups.google.com/forum/#!topic/web2py/Ow-x1D4__q0 El lunes, 13 de enero de 2014 22:07:05 UTC-5, Brando escribió: I don't know anyone who builds webapps with python. I've watched A LOT of videos and read A LOT of posts about web2py. I've got the basics down and have

[web2py] Re: Dynamic form generation using FORM()

2014-01-14 Thread Anthony
If you want to submit a list of inputs to FORM(), then that's all you can submit. So, append the submit input to the fields list and then just do FORM(fields). Also, if db.a_table.image is an upload field, it will just store the transformed filename, which won't be very informative to the

[web2py] Re: Is there a way to have a field in one table be computed by a field in another table?

2014-01-14 Thread Apple Mason
I read through the link you show me. I'm using _before_delete now, since doing s.select() returns 0 rows since it's already been deleted. I'm not sure how to deal with sets in _after_delete. Here is my updated models: db.define_table('person', Field('name'),

[web2py] Re: Is there a way to have a field in one table be computed by a field in another table?

2014-01-14 Thread 黄祥
for after delete callback, please check this discussion https://groups.google.com/forum/#!msg/web2py/M4_5THMHzH0/r9aXH-k8eJQJ best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: Is there a way to have a field in one table be computed by a field in another table?

2014-01-14 Thread Apple Mason
Yeah, that thread says to use _before_delete, and it fits this use case. Can you verify if what I'm seeing about the delete is correct? The _before_delete is causing the admin panel to not delete the record for some reason. Is it a bug? I'm using web2py 2.7.4 stable On Tuesday, January 14,

[web2py] Architecture hosting considerations. Just 1 query/minute but high traffic app

2014-01-14 Thread Jaime Sempere
Hi everyone, I plan to do an app for webs that have about 10k-100k visits per day. This app would be an iframe of my own webpage/app. I don't need a lot of bandwith (say that I will send an STATIC page, size less than 30-20kb per request), but I need to update some data of this static page

[web2py] Re: Dynamic form generation using FORM()

2014-01-14 Thread Chris Hepworth
You know, I hate to say it but that never even occurred to me to try. I got so distracted with other things that I never took the time to really evaluate what could be happeing. Thank you, Anthony. On Tuesday, January 14, 2014 5:23:23 PM UTC-7, Anthony wrote: If you want to submit a list of

[web2py] Re: Is there a way to have a field in one table be computed by a field in another table?

2014-01-14 Thread Anthony
db.thing._after_insert.append(lambda f,id: db(db.person.id ==f['owner_id']).update(total_items=len(db(db.thing.owner_id==f['owner_id']).select( from pprint import pprint db.thing._before_delete.append(lambda s: db(db.person.id

[web2py] Re: Is there a way to have a field in one table be computed by a field in another table?

2014-01-14 Thread Anthony
Of course, that's only if you add or delete one record at a time. On Wednesday, January 15, 2014 12:09:11 AM UTC-5, Anthony wrote: db.thing._after_insert.append(lambda f,id: db(db.person.id ==f['owner_id']).update(total_items=len(db(db.thing.owner_id==f['owner_id']).select( from pprint

[web2py] Re: Is there a way to have a field in one table be computed by a field in another table?

2014-01-14 Thread Anthony
As noted in the book, the _before_ callbacks must return falsey values, or the operation will be aborted. So, you can either write a full function (that returns False) instead of using a lambda, or do something like: lambda s: db(...).update(...) and False which will return the value False.

[web2py] Re: Web2py Integration with Sentry

2014-01-14 Thread James Q
Massimo: Would you consider taking a patch / pull request for a new script? -- James On Thursday, January 9, 2014 9:16:02 AM UTC-5, Massimo Di Pierro wrote: The problem is that it would not work. you can have exceptions at two levels: web2py apps, web2py itself. In other frameworks these two

Re: [web2py] Re: Cookbook - No indentation ??

2014-01-14 Thread Joe Barnhart
The problem still exists, here in 2014! It is broader than just MOBI format -- it also makes EPUB book listings (at least Python ones) useless. BUT -- it only affects one publisher I have found so far -- Packt Publishing. Sadly I will be crossing them off my list of suitable purveyors of

Re: [web2py] Re: detect a specific device

2014-01-14 Thread paolo.vall...@gmail.com
hi, thanks everyone for the answers @Willoughby I don't think the mac address is sent/received in an http request, isn't ? @dave your suggestion is in the right direction but how can you automatically tells the browser to send this token? @niphlod authentication is not enough, an user can still