You can do it with dal.SQLCustomType If you cannot find a useful example, let me know and I will write one.
On Mar 11, 10:13 am, Juan Hernandez <[email protected]> wrote: > In MySQL would go something like this > > #Insert > insert into users (domain, email, password, quota) values (1, > '[email protected]', ENCRYPT('mypass'), '101010'); > # > > mysql> select * from users; > | 3 | 1 | [email protected] | j57VHP.kk4c.o | 101010 | > 1 row in set (0.00 sec) > > and reading MySQL's docs I saw this: > """ > Encrypts str using the Unix crypt() system call and returns a binary > string. The salt argument must be a string with at least two > characters or the result will be NULL. If no salt argument is given, a > random value is used. > """ > > On Fri, Mar 11, 2011 at 11:33 AM, Massimo Di Pierro > > > > > > > > <[email protected]> wrote: > > I am not familiar with encrypt() in mysql. If you show me how you use > > it in mysql, I can see how to do with dal. > > > On Mar 11, 9:15 am, Vlad Janicek <[email protected]> wrote: > >> Hey there People, > > >> I have a question, lets shay that I need to create an users table that > >> some other systems connect to and when these systems check for users, > >> only use the MySQL encrypt() function. > > >> The model would be something like this: > > >> # My model > >> db.define_table('users', > >> Field('domain', db.domains, requires = IS_NOT_EMPTY()), > >> Field('email', requires = IS_EMAIL()), > >> Field('password', 'password', requires = IS_NOT_EMPTY()), > >> Field('quota', requires = IS_NOT_EMPTY()), > >> ) > > >> # My CRUD sentence > >> form = crud.create(db.users, message='email has been added > >> successfully') > > >> Im using in in a very simple way and it works if it was a standalone > >> app but, I need web2py to enforce MySQL encrypt() every time I add or > >> query for a record. I can do it manually but it would stop me from > >> using CRUD. > > >> What would be the best approach?? > >> Thanks a lot for your help... > >> vj

