etc/WEB
- [WEB2PY]http://web2pylife.wordpress.com/로 이전 2012.05.02
- [WEB2PY]Authorization decorators always generate db queries Options 2011.11.22
- [WEB2PY]password salting 2011.09.22
- [WEB2PY]table, grid, smartgrid, getting better 2011.09.16
[WEB2PY]http://web2pylife.wordpress.com/로 이전
2012. 5. 2. 13:00
[WEB2PY]Authorization decorators always generate db queries Options
2011. 11. 22. 21:57
function에 decoration에 의해서 db query가 발생한다는 내용.
http://groups.google.com/group/web2py/browse_thread/thread/34cfc0d265d613a
역시 이번에도 답변은 Anthony가 했네요.
문제는 decorator에 포함된 condition이 evaluate되는데 이때 db query가 발생한다는 것
이때 condition이 evaluate되면서 has_permission()이 수행되고 db query가 일어난다는것.
해결방법은 requires는 callable을 인자로 받을수 있으므로
condition이 evaluate되지 않도록 다음과 같이 변경하면 된다는것
@auth.requires(lambda: auth.has_permission('read'))
http://groups.google.com/group/web2py/browse_thread/thread/34cfc0d265d613a
역시 이번에도 답변은 Anthony가 했네요.
문제는 decorator에 포함된 condition이 evaluate되는데 이때 db query가 발생한다는 것
@auth.requires_permission('read')
def secrets():
etc.
는 다음과 같은데 :
@auth.requires(condition=auth.has_permission('read'))
def secrets():
etc. 이때 condition이 evaluate되면서 has_permission()이 수행되고 db query가 일어난다는것.
해결방법은 requires는 callable을 인자로 받을수 있으므로
condition이 evaluate되지 않도록 다음과 같이 변경하면 된다는것
@auth.requires(lambda: auth.has_permission('read'))
def secrets():
Happy Coding~:)
Happy Coding~:)
[WEB2PY]password salting
2011. 9. 22. 17:05
입력한 암호를 브라이져나 서버에서 어떻게 처리해야 하는지에 대한 논의
-. browser에서 salting해서 악의적인 유저가 해당 암호를 획득하더라도 해독이 힘들게 하고
-. 서버측에서 추가적인 salting을 해서 서버가 해킹당하는 경우에도 password 해독할 수 없도록 한다.
http://groups.google.com/group/web2py/browse_thread/thread/58488d1a00f26b9f
첨부된 링크의 내용이 참 좋다.
http://dustwell.com/how-to-handle-passwords.html
Happy Coding~:)
-. browser에서 salting해서 악의적인 유저가 해당 암호를 획득하더라도 해독이 힘들게 하고
-. 서버측에서 추가적인 salting을 해서 서버가 해킹당하는 경우에도 password 해독할 수 없도록 한다.
http://groups.google.com/group/web2py/browse_thread/thread/58488d1a00f26b9f
첨부된 링크의 내용이 참 좋다.
http://dustwell.com/how-to-handle-passwords.html
Happy Coding~:)
[WEB2PY]table, grid, smartgrid, getting better
2011. 9. 16. 15:57
기존 CRUD + sorting, pagination등 지원
http://groups.google.com/group/web2py/browse_thread/thread/f3d3fc68a0213518?tvc=2
http://groups.google.com/group/web2py/browse_thread/thread/f3d3fc68a0213518?tvc=2
def index():
rows=db(db.mytable).select()
table = SQLTABLE(rows)
return dict(table=table)
def search():....
def view(): ...
def edit(): ...
def delete(): ...
etc etc.
Now you can just do
def index():
table = SQLFORM.grid(db.mytable)
return dict(table=table)
The new syntax out of the box does:
- one click sorting
- view, edit, delete buttons (in place view/edit) no need for
additional code
- searching