I tried this :
        id=db.auth_user.insert( **{'email':myemail, 
'password':(db.auth_user.password.validate(mypassword)[0]), 
'first_name':myname})

and still get the same error at this line:
TypeError: character mapping must return integer, None or unicode

I tried the bulk insert:
        db.auth_user.bulk_insert([{'first_name' : myname,
            'email' : myemail,
            'password' : db.auth_user.password.validate(mypassword)[0]}])

I get the same error, the line number points to the third line in the above 
statement, which is the password one.

On Tuesday, May 7, 2013 9:24:08 AM UTC+5:30, Massimo Di Pierro wrote:
>
> This is not valid pyhton syntax
>
>  id=db.auth_user.insert(email=myemail, 
> password=db.auth_user.password.validate(mypassword)[0], first_name=myname)
>
> or 
>
>  id=db.auth_user.insert( **{'email':myemail, 
> 'password':(db.auth_user.password.validate(mypassword)[0]), 
> 'first_name':myname})
>
>
> On Monday, 6 May 2013 22:47:37 UTC-5, vikas gupta wrote:
>>
>> I tried this:
>>  id=db.auth_user.insert( 'email':myemail, 
>> 'password':(db.auth_user.password.validate(mypassword)[0]), 
>> 'first_name':myname)
>>
>> I get a syntax error at the first ':'
>>
>> myemail, mypassword and myname are string variables and are populated 
>> correctly. In my original statement, putting field names in quotes didnt 
>> help. 
>> When I tried this -
>> id=db.auth_user.insert( 'email'=myemail, 
>> 'password'=(db.auth_user.password.validate(mypassword)[0]), 
>> 'first_name'=myname)
>> I get this error:
>> SyntaxError: keyword can't be an expression
>>
>> On Monday, May 6, 2013 11:13:39 PM UTC+5:30, 黄祥 wrote:
>>>
>>> please use '  for string data type
>>> e.g.
>>> db.auth_user.insert('email' : '[email protected]', 'password' : 
>>> db.auth_user.password.validate('mypassword')[0], 'first_name' : 'myname')
>>>
>>> best regards
>>>
>>> On Monday, May 6, 2013 1:11:02 PM UTC-4, vikas gupta wrote:
>>>>
>>>> I am trying this and I am getting errors:
>>>>
>>>> id=db.auth_user.insert( email=myemail, 
>>>> password=(db.auth_user.password.validate(mypassword)[0]), 
>>>> first_name=myname)
>>>>
>>>> I get this error:
>>>> TypeError: character mapping must return integer, None or unicode
>>>>
>>>>   File 
>>>> "/home/www-data/web2py/applications/trotez/controllers/default.py", line 
>>>> 171, in userRegister
>>>>     id=db.auth_user.insert( email=myemail, 
>>>> password=db.auth_user.password.validate(mypassword)[0], first_name=myname)
>>>>   File "/home/www-data/web2py/gluon/dal.py", line 8514, in insert
>>>>     ret =  self._db._adapter.insert(self, self._listify(fields))
>>>>   File "/home/www-data/web2py/gluon/dal.py", line 1199, in insert
>>>>     query = self._insert(table,fields)
>>>>
>>>> Something I am doing wrong?
>>>>
>>>>
>>>> On Friday, April 29, 2011 12:56:06 AM UTC+5:30, 黄祥 wrote:
>>>>>
>>>>> yes, u right, ron, there is a mistaken on my field value, thanks for 
>>>>> show me my wrong code, it's work right now. thank you all for your 
>>>>> pointer.
>>>>>
>>>>> On Fri, Apr 29, 2011 at 12:10 AM, ron_m <[email protected]> wrote:
>>>>>
>>>>>> email of a.a.com is not a valid email address according to your code.
>>>>>> I am not sure if there is any validation during login
>>>>>>
>>>>>
>>>>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to