[web2py] IS_IN_SET, multiple=False, checkboxes

2012-01-03 Thread thodoris
Hello, I have come uppon the following. If i declare the following field Field('test', notnull=True, requires=IS_IN_SET([1,2,3,4],multiple=False),widget=SQLFORM.widgets.checkboxes.widget), The expected behaviour should be to be able to select only one checkbox. What is happening is that i am

[web2py] how to present rows in multiple pages

2011-12-21 Thread thodoris
I have a query that returns many (45) results and i want to l present 10 rows per page and have links at the bottom with the page numbers (1,2,3,4,5 and maybe a button next or previews). How can i implement this in web2py? Thnx

[web2py] automatic logout does not work

2011-12-19 Thread thodoris
I set the auth.settings.expiration time but the user is not automatically logged out after the specified time I have tried setting auth.settings.expiration = 1 in db.py after before calling auth.define_tables()

Re: [web2py] referenced auth.user_id type string

2011-12-16 Thread thodoris
Thanks for your answers guys. I have another question related to this topic. Say i want to reference an authorized user instead of a person table: db.define_table('cat', Field('name'), Field('owner', db.auth_user, default=auth.user_id,readable=False,writable=False),) So that the

[web2py] MySQL constraints not updated but appended to old ones

2011-12-16 Thread thodoris
I have a field Field('uUser2', db.auth_user, default=auth.user_id), at some moment i added ondelete=CASCADE later i changed it to ondelete=NO ACTION but when i checked my db i had KEY `rUser2__idx` (`ruser2`), CONSTRAINT `sounds_ibfk_1` FOREIGN KEY (`ruser`) REFERENCES `auth_user`

Re: [web2py] referenced auth.user_id type string

2011-12-16 Thread thodoris
What do you mean handle it in application logic? How/when do i detect from my app that a user has been deleted?

[web2py] remove references problem

2011-12-15 Thread thodoris
I know that if i declare the following db.define_table('person', Field('name'),) db.define_table('cat', Field('name'), Field('owner',db.person)) db.cat.owner.requires = IS_IN_DB(db, db.person.id) Then if i delete a person, all the cats of this person will be deleted. But i declare the cat

[web2py] Re: remove references problem

2011-12-15 Thread thodoris
Well i guess that doing db.define_table('cat', Field('name'), Field('owner',db.person,default=db.person.id)) db.cat.owner.requires = IS_IN_DB(db, db.person.id) does the job.

Re: [web2py] referenced auth.user_id type string

2011-12-15 Thread thodoris
This is a solution but look at the following, if i declare db.define_table('person', Field('name'),) db.define_table('cat', Field('name'), Field('owner',integer,db.person,default=db.person.id)) db.cat.owner.requires = IS_IN_DB(db, db.person.id) the reference is broken. Is there another

Re: [web2py] referenced auth.user_id type string

2011-12-15 Thread thodoris
By reference is broken i mean that if i remove at some point the person, the cat that belongs to that person is not removed...

[web2py] migrate passwords from phpBB

2011-12-12 Thread thodoris
I am trying to migrate users from phpBB whose passwords have been encrypted with php_pass. There is a python module that mimics the functionality of php_pass and i am wondering what is the best way to override the default encryption of web2py. Is it sufficient to override CRYPT() using

[web2py] Re: Massimo

2011-12-07 Thread thodoris
My compliments as well to both Massimo and all contributors. Keep up the good work guys! Thodoris On Dec 7, 9:08 am, chandrakant kumar k.03chan...@gmail.com wrote: Programmers don't get the glory they deserve,http://goo.gl/yRJbR. On Wed, Dec 7, 2011 at 12:34 PM, Vineet vineet.deod

[web2py] hidding functionality and DRY

2011-12-07 Thread thodoris
I have found myself doing multiple times in my views: {{if auth.user:}} # checking that a user in logged in and {{if auth.user.id == my_table.author_id:}} # if he is the author of a table entry SHOW SOMETHING ONLY TO THE AUTHOR OF THIS TABLE {{pass}} {{pass}} I am thinking that

[web2py] vars passed to LOAD become strings

2011-12-06 Thread thodoris
I am trying to use the LOAD component and i have some questions. I would like to pass an argument to the LOAD function which is a table row but it is converted to a string and i can't access the row attributes. There is a way to pass them by value but i would prefer to pass the row instead (or a

[web2py] Re: vars passed to LOAD become strings

2011-12-06 Thread thodoris
= table.like + 1 table.update_record(like=like) # something here ?? Thanks for all the help On Dec 6, 11:22 am, thodoris pasxi...@gmail.com wrote: I am trying to use the LOAD component and i have some questions. I would like to pass an argument to the LOAD function which is a table

[web2py] Re: vars passed to LOAD become strings

2011-12-06 Thread thodoris
I didn't know about the callback argument. Thanks a lot for the tip. In the above case then it is not necessary then. I was going to use something quite complicated for something simple. Is it possible for the callback to affect multiple fields, or else what happens if there are fields with the

[web2py] Re: vars passed to LOAD become strings

2011-12-06 Thread thodoris
... if s == 1: return something elif s == 2: return something else else: session.flash = Message return ??? Is this possible??? On Dec 6, 4:12 pm, Anthony abasta...@gmail.com wrote: On Dec 6, 9:49 am, thodoris pasxi...@gmail.com wrote: I didn't know about

[web2py] problem selecting from field with IS_IN_SET

2011-12-05 Thread thodoris
I have the following featured = (0,1,2,3,4,5) Field('rank','list:integer',requires=IS_IN_SET(featured, zero='rank'), readable=False, writable=False), So this field can only be set from appadmin and is set by default to [] when a record is made, IIUC. I want to select the tables that have been

[web2py] upload field value reset on form failure of another field

2011-12-05 Thread thodoris
Is there any way to keep the value that was inserted on an upload field after failing to validate the form due to another field, so that the user doesn't have to search for the file again?

[web2py] unable to set reference Field back to None once set

2011-11-30 Thread thodoris
I have this field db.define_table('B', Field('my_table', db.A, notnull=False, ondelete=SET NULL), db.B.my_table.requires = IS_EMPTY_OR ( IS_IN_DB(db(db.A.author_id==auth.user_id), db.A.id, '%(title)s')) That means that my_table can have references from A but only the

[web2py] change form submit button to clickable text

2011-11-30 Thread thodoris
Is there a way to change the submit button into clickable text (like an _href) next to a field? Lets say i have this form: form = SQLFORM.factory(Field('my_table'))

[web2py] Re: unable to set reference Field back to None once set

2011-11-30 Thread thodoris
I found the solution myself In order to save the change i have to use: update_record On Nov 30, 12:07 pm, thodoris pasxi...@gmail.com wrote: I have this field db.define_table('B',     Field('my_table', db.A, notnull=False, ondelete=SET NULL), db.B.my_table.requires = IS_EMPTY_OR

[web2py] call submit from an A tag

2011-11-30 Thread thodoris
Is there a way to change the submit button into clickable text? Lets say i have this form: form = SQLFORM.factory(Field('my_table')) and i can do table = form.element() to get the element table.append(INPUT(_type='submit', _value='submit')): this appends the submit button next to the

[web2py] referenced auth.user_id type string

2011-11-29 Thread thodoris
Hello, Simple question: auth.user.id returns an integer but if i define a field in a table: Field('author_id', default=auth.user_id) author_id is a string and if i want in a later step to compare these values it doesn't seem good tactic to do str(auth.user.id)

[web2py] clean upload notnull field after being set

2011-11-29 Thread thodoris
Hello, I have this Field Field('cover','upload',notnull=False,autodelete=True), When the form is displayed you click on browse you can select the file. But once a file is selected you cannot undo your choice. There is always the choice to reload the page that holds the form and clean the field

[web2py] Re: clean upload notnull field after being set

2011-11-29 Thread thodoris
in that string field and delete the filename. As an alternative, I suppose you could add a button/link with some Javascript that automatically clears the field when clicked. Anthony On Tuesday, November 29, 2011 10:18:32 AM UTC-5, thodoris wrote: Hello, I have this Field Field

[web2py] where to update response.headers on success

2011-11-28 Thread thodoris
where can i update the response.headers before form.accepts returns True? Because i guess that if i update it after form.accepts returns then the response has already been sent. Thodoris

[web2py] how to keep response.headers after redirect

2011-11-28 Thread thodoris
I want to do the following: I want to add a key to response.headers response.headers['success']='True' after a successful file upload and also redirect. The problem is that i also want to redirect after successful upload but redirect makes a new reasponse.headers and i lose the key i want to

[web2py] Re: how to keep response.headers after redirect

2011-11-28 Thread thodoris
On Monday, November 28, 2011 8:15:02 AM UTC-5, thodoris wrote: I want to do the following: I want to add a key to response.headers response.headers['success']='True' after a successful file upload and also redirect. The problem is that i also want to redirect after successful upload

[web2py] cancel upload leftovers

2011-11-28 Thread thodoris
I have a form that has an upload field. If i add a cancel button to the form that for example redirects to 'index' the cancel is stopped but what if i wanted to cancel the upload from an app?? I am asking this cause i am uploading a file from an iphone app to the database but when i cancel that

[web2py] cancel upload, return value

2011-11-25 Thread thodoris
I have a form that has an upload field. The file can be big and i would like to add a cancel button to cancel the upload. If i add a cancel button to the form that for example redirects to 'index' the cancel is stopped but what is the logic behind it. Is some value returned and the form fails??

[web2py] add key to response.headers for remote app?

2011-11-25 Thread thodoris
']['success']=True Thodoris

[web2py] field related to auth.user.id problem when user not logged in

2011-11-21 Thread thodoris
the user initially is not logged in so there is no auth.user.id How can i solve this? Second question, if the user had entered a lot of entries which is the best way to display the dropdown list of tables??? Thodoris

[web2py] Re: field related to auth.user.id problem when user not logged in

2011-11-21 Thread thodoris
Thanx for the help guys, what i did finally is db.videos.table.requires = IS_EMPTY_OR (IS_IN_DB(db(db.table.author_id==auth.user_id), db.table.id, '% (title)s')) What about displaying a BIG dropdown list of tables entries? Any help here ??? On Nov 21, 4:09 pm, Anthony abasta...@gmail.com

[web2py] text field remove default when user inputs data

2011-11-16 Thread thodoris
Hello, I have a text field in my db with a default instructive text like Enter your comment here, but i would like when the user tries to input text, the default text to disappear without having to delete it manually

[web2py] Re: text field remove default when user inputs data

2011-11-16 Thread thodoris
UTC-5, thodoris wrote: Hello, I have a text field in my db with a default instructive text like Enter your comment here, but i would like when the user tries to input text, the default text to disappear without having to delete it manually

[web2py] menu problem when importing layout

2011-11-15 Thread thodoris
i use is called Replenish (http://web2py.com/ layouts/static/plugin_layouts/layouts/Replenish/index.html). Thodoris

[web2py] list:integer restrict

2011-11-15 Thread thodoris
Hello, i would like to do the following but i am not sure how to do it. I want to define a field like rank = (0,1,2,3,4,5) Field('rank','list:integer',requires=IS_IN_SET(rank)), but i would like to implement the restriction that if for example 1 is already set, it won't appear in the list.

[web2py] hide functionality from non authenticated users

2011-11-15 Thread thodoris
I want to do the following def some_function(): a = ... b = ... if auth.is_logged_in(): c = ... else: c = None return (a=a,b=b,c=c) And in the view some_function.html {{if c is not None:}} do something here {{pass}} which is the best practice to do it?

[web2py] Re: hide functionality from non authenticated users

2011-11-15 Thread thodoris
There is nothing wrong, i just want to know if this is a clean way to do what i do above or there is a better way. Thodoris On Nov 15, 1:26 pm, Kenneth Lundström kenneth.t.lundst...@gmail.com wrote: Whats wrong in what you just described? {{if c != None:}} Kenneth I want to do

[web2py] Re: hide functionality from non authenticated users

2011-11-15 Thread thodoris
in. Also, do you need to do something with the value of c in the logged in case? If not, then just test for a logged in user directly in the view.     {{if auth.user:}} Anthony On Tuesday, November 15, 2011 7:37:10 AM UTC-5, thodoris wrote: There is nothing wrong, i just want to know

[web2py] Janrain Social Widget Setup

2011-11-08 Thread thodoris
Hello, I am trying to integrate the Janrain Social Widget to my project. For the moment i have user authentication with Janrain but i am having problems adding the Social Widget. The instructions from Janrain say: 1) Download the rpx_xdcomm.html file and place it in the root directory of your

[web2py] 500 Internal Server Error

2011-11-03 Thread thodoris
/#!topic/web2py/CDHOUqtICn8 I executed the setup-web2py-ubuntu.sh script and the everything works ok from the webpage. What i want to do is upload a file using curl. If i don't use authentication, using the following command the file is uploaded: curl -F file=@/home/thodoris/Documents

Re: [web2py] Re: Found a bug: XMLRPC with basic authorization fails

2011-10-29 Thread thodoris
Hi, I have tested the patch against 1.99.2 stable version of web2py and it works. auth.settings.allow_basic_login=True has to be set in order to be able to upload files using curl. Thodoris

[web2py] Re: curl post with authentication

2011-10-29 Thread thodoris
Yes it is related and there is a patch for this. More details on the above link. On Oct 28, 2:27 pm, szimszon szims...@gmail.com wrote: Could be related:https://groups.google.com/forum/#!topic/web2py/lLCCUrwB5x0

[web2py] curl post with authentication

2011-10-28 Thread thodoris
using curl. But i would like apply the authentication restriction. So i register a user with username: t...@nowhere.com and password: and i try the following command curl --verbose -u t...@nowhere.com: -F file=@/home/thodoris/ Downloads/test.rtp -F _formname=files/None http://127.0.0.1:8000

[web2py] Re: Found a bug: XMLRPC with basic authorization fails

2011-10-28 Thread thodoris
Hi, i have come across the same problem. Do you have any idea when will the patch be included in a realease?

Re: [web2py] Re: Found a bug: XMLRPC with basic authorization fails

2011-10-28 Thread thodoris
Hi Hong-Khoan, Sure, send it to me and i will try it. Regards, Thodoris

[web2py] upload file to database using curl

2011-10-27 Thread thodoris
application that is written in C++ to the web server. I am new to web2py so i would appreciate any advice. Thodoris

[web2py] count file downloads

2011-10-27 Thread thodoris
Hi, I am wondering what is the best way to count how many times a file has been downloaded. I have the following: db.define_table('image', Field('file', 'upload'), Field('downloads','integer', default=0,readable=False, writable=False)) I have a view that has the following: {{=A(Download,

[web2py] Re: count file downloads

2011-10-27 Thread thodoris
On Thursday, October 27, 2011 11:39:22 AM UTC-4, thodoris wrote: Hi, I am wondering what is the best way to count how many times a file has been downloaded. I have the following: db.define_table('image',    Field('file', 'upload'),    Field('downloads','integer', default=0,readable=False