This file contains hidden or 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
{ | |
'stats': { | |
'slotbak': 12, | |
'spi': 90, | |
'reqlevel': 80, | |
'displayid': 56181, | |
'sellprice': 107343, | |
'avgbuyout': 8450112 | |
}, | |
'level': u '200', |
This file contains hidden or 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
{ | |
'stats': { | |
'displayid': 34960, | |
'reqlevel': 80, | |
'slotbak': 28, | |
'reqarenartng': 1700 | |
}, | |
'level': u '270', | |
'subclass': u '7', | |
'id': u '51478', |
This file contains hidden or 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
{ | |
'abyss': { | |
'points': { | |
'week': 50422, | |
'total': 52785, | |
'day': 13140 | |
}, | |
'kills': { | |
'week': 98, | |
'total': 4490, |
This file contains hidden or 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
class Forums(Module): | |
can_moderate_forums = Permission('Can moderate forums') | |
can_start_threads = Permission('Can start new threads', groups=['root_user', 'guild_guest', 'guild_member']) | |
can_reply_to_threads = Permission('Can reply to threads', groups=['root_user', 'guild_guest', 'guild_member']) | |
can_delete_own_posts = Permission('Can delete own posts') | |
can_edit_own_posts = Permission('Can edit own posts', groups=['root_user', 'guild_guest', 'guild_member']) | |
can_create_polls = Permission('Can create polls', groups=['root_user', 'guild_guest', 'guild_member']) | |
can_vote_in_polls = Permission('Can vote in polls', groups=['root_user', 'guild_guest', 'guild_member']) | |
can_rate_posts = Permission('Can rate posts', groups=['root_user', 'guild_guest', 'guild_member']) |
This file contains hidden or 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
def permission_required(*perms, **options): | |
def decorator(method): | |
def wrapper(self, *args, **kwargs): | |
for perm in perms: | |
perm = perm.split('.') | |
assert self.perms[perm[0]][perm[1]], \ | |
options.get('message', 'You have attempted to perform an action that you do not have permission to perform.') | |
method(self, *args, **kwargs) |
This file contains hidden or 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
def permission_required(*perms, **options): | |
def decorator(method): | |
def wrapper(self, *args, **kwargs): | |
for perm in perms: | |
perm = perm.split('.') | |
assert self.perms[perm[0]][perm[1]], \ | |
options.get('message', 'You have attempted to perform an action that you do not have permission to perform.') | |
method(self, *args, **kwargs) |
This file contains hidden or 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
@route('/forum/p/(\w+)/', 'forum_post') | |
class PostHandler(BaseHandler): | |
def get(self, id): | |
post = Post.documents.find_one({'_id': ObjectId(id), 'guild_id': self.guild_id}, fields=['thread_id', 'n']) | |
assert post, 'Post does not exist.' | |
thread = Thread.documents.get(post.thread_id, fields=['slug']) | |
if post.n == None: | |
post.n = Post.documents.eval("""function() { | |
var n = -1; |
This file contains hidden or 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
%% if not value: return None | |
%% parts = value.split("|") | |
%% if len(parts) != 3: return None | |
%% if include_name: | |
%% signature = self._cookie_signature(name, parts[0], parts[1]) | |
%% else: | |
%% signature = self._cookie_signature(parts[0], parts[1]) | |
%% if not _time_independent_equals(parts[2], signature): | |
%% logging.warning("Invalid cookie signature %r", value) | |
%% return None |
This file contains hidden or 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
from lib.mongomapper import Document | |
from lib.db import mongo | |
class Raid(Document): | |
""" | |
_id = ObjectId | |
event_id = ObjectId | |
outcome = Integer | |
participants = List | |
loot = List |
This file contains hidden or 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
import types | |
class Column(object): | |
def __init__(self, name): | |
self._name = name | |
def __add__(self, other): | |
return {self._name: {'$inc': other}} | |
def __eq__(self, other): |
OlderNewer