doc/book/en/annexes/faq.rst
changeset 7250 fe27390bf2f8
parent 6592 4dad0ec0a44f
child 7529 2fdc310be7cd
equal deleted inserted replaced
7249:86bbf174e463 7250:fe27390bf2f8
   378 
   378 
   379 
   379 
   380 You can prefer use a migration script similar to this shell invocation instead::
   380 You can prefer use a migration script similar to this shell invocation instead::
   381 
   381 
   382     $ cubicweb-ctl shell <instance>
   382     $ cubicweb-ctl shell <instance>
       
   383     >>> from cubicweb import Binary
   383     >>> from cubicweb.server.utils import crypt_password
   384     >>> from cubicweb.server.utils import crypt_password
   384     >>> crypted = crypt_password('joepass')
   385     >>> crypted = crypt_password('joepass')
   385     >>> rset = rql('Any U WHERE U is CWUser, U login "joe"')
   386     >>> rset = rql('Any U WHERE U is CWUser, U login "joe"')
   386     >>> joe = rset.get_entity(0,0)
   387     >>> joe = rset.get_entity(0,0)
   387     >>> joe.set_attributes(upassword=crypted)
   388     >>> joe.set_attributes(upassword=Binary(crypted))
       
   389 
       
   390 Please, refer to the script example is provided in the `misc/examples/chpasswd.py` file.
   388 
   391 
   389 The more experimented people would use RQL request directly::
   392 The more experimented people would use RQL request directly::
   390 
   393 
   391     >>> rql('SET X upassword %(a)s WHERE X is CWUser, X login "joe"',
   394     >>> rql('SET X upassword %(a)s WHERE X is CWUser, X login "joe"',
   392     ...     {'a': crypted})
   395     ...     {'a': crypted})