Seems like something is not ok though, check it out:

>> d = web.insert('users', email='[EMAIL 
>> PROTECTED]',password=web.SQLLiteral('SHA1("foo")'),level=1,joindate=web.SQLLiteral('NOW()'),laston=web.SQLLiteral('NOW()'),
>>  _test=True)

>>> print d
INSERT INTO users (password, joindate, email, laston, level) VALUES
(SHA1("foo"), NOW(), '[EMAIL PROTECTED]', NOW(), 1)

now I copy and paste that string in MySQL:

mysql> INSERT INTO users (password, joindate, email, laston, level)
VALUES (SHA1("foo"), NOW(), '[EMAIL PROTECTED]', NOW(), 1)
Query OK, 1 row affected (0.06 sec)

mysql> select * from users;

+----+-------------------------
+------------------------------------------+---------------------
+---------------------+-------+
| id | email                   |
password                                 | joindate            |
laston              | level |
+----+-------------------------
+------------------------------------------+---------------------
+---------------------+-------+
|  5 | [EMAIL PROTECTED]   |
b3d27fe823942946dbbbc16e62537743a458131a | 2008-04-07 23:45:41 |
2008-04-07 23:45:41 |     1 |
+----+-------------------------
+------------------------------------------+---------------------
+---------------------+-------+

But if I use web.insert check it out:

 d = web.insert('users',
email='[EMAIL 
PROTECTED]',password=web.SQLLiteral('SHA1("foo")'),level=1,joindate=web.SQLLiteral('NOW()'),laston=web.SQLLiteral('NOW()'))

mysql> select * from users;
+----+-------------------------
+------------------------------------------+---------------------
+---------------------+-------+
| id | email                   |
password                                 | joindate            |
laston              | level |
+----+-------------------------
+------------------------------------------+---------------------
+---------------------+-------+
|  5 | [EMAIL PROTECTED]   |
b3d27fe823942946dbbbc16e62537743a458131a | 2008-04-07 23:45:41 |
2008-04-07 23:45:41 |     1 |
|  6 | [EMAIL PROTECTED]  | SHA1("foo")
| 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |     1 |
+----+-------------------------
+------------------------------------------+---------------------
+---------------------+-------+

It didn't create an SHA1 hash.



On Apr 7, 11:07 pm, "Aaron Swartz" <[EMAIL PROTECTED]> wrote:
> >  Look at the different results when I switch types of quotes in
> >  SQLLiteral:
>
> These aren't different results; the backslashes are just put there by
> Python's repr.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to