Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drop authorization code for hooksets
- Loading branch information
Showing
6 changed files
with
26 additions
and
43 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class CommentsDefaultHookSet(object): | ||
def load_can_delete(self, user, comment): | ||
if user.is_superuser: | ||
return True | ||
return user == comment.author | ||
|
||
def load_can_edit(self, user, comment): | ||
return user == comment.author | ||
|
||
|
||
class HookProxy(object): | ||
def __getattr__(self, attr): | ||
from .conf import settings | ||
return getattr(settings.COMMENTS_HOOKSET, attr) | ||
|
||
|
||
hookset = HookProxy() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters