Skip to content

Commit

Permalink
Merge branch 'master' of github.com:vijos/vj4
Browse files Browse the repository at this point in the history
  • Loading branch information
twd2 committed Apr 2, 2017
2 parents 5836717 + b5d0cc3 commit f040b0a
Show file tree
Hide file tree
Showing 11 changed files with 5 additions and 22 deletions.
1 change: 0 additions & 1 deletion vj4/handler/judge.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import calendar
import datetime
import logging
import time
from bson import objectid

from vj4 import app
Expand Down
9 changes: 4 additions & 5 deletions vj4/handler/problem.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import asyncio
import datetime
import functools
import hashlib
import io
import zipfile
from bson import objectid
Expand Down Expand Up @@ -374,7 +373,7 @@ async def post_edit_reply(self, *, pid: document.convert_doc_id,
self.check_perm(builtin.PERM_VIEW_PROBLEM_HIDDEN)
psdoc, psrdoc = await problem.get_solution_reply(self.domain_id, psid, psrid)
if not psdoc or psdoc['parent_doc_id'] != pdoc['doc_id']:
raise error.DocumentNotFoundError(domain_id, document.TYPE_PROBLEM_SOLUTION, psid)
raise error.DocumentNotFoundError(self.domain_id, document.TYPE_PROBLEM_SOLUTION, psid)
if not self.own(psrdoc, builtin.PERM_EDIT_PROBLEM_SOLUTION_REPLY_SELF):
self.check_perm(builtin.PERM_EDIT_PROBLEM_SOLUTION_REPLY)
await problem.edit_solution_reply(self.domain_id, psid, psrid, content)
Expand All @@ -391,7 +390,7 @@ async def post_delete_reply(self, *, pid: document.convert_doc_id,
self.check_perm(builtin.PERM_VIEW_PROBLEM_HIDDEN)
psdoc, psrdoc = await problem.get_solution_reply(self.domain_id, psid, psrid)
if not psdoc or psdoc['parent_doc_id'] != pdoc['doc_id']:
raise error.DocumentNotFoundError(domain_id, document.TYPE_PROBLEM_SOLUTION, psid)
raise error.DocumentNotFoundError(self.domain_id, document.TYPE_PROBLEM_SOLUTION, psid)
if not self.own(psrdoc, builtin.PERM_DELETE_PROBLEM_SOLUTION_REPLY_SELF):
self.check_perm(builtin.PERM_DELETE_PROBLEM_SOLUTION_REPLY)
await oplog.add(self.user['_id'], oplog.TYPE_DELETE_SUB_DOCUMENT, sub_doc=psrdoc,
Expand Down Expand Up @@ -462,7 +461,7 @@ async def get(self, *, pid: document.convert_doc_id, psid: document.convert_doc_
self.check_perm(builtin.PERM_VIEW_PROBLEM_HIDDEN)
psdoc, psrdoc = await problem.get_solution_reply(self.domain_id, psid, psrid)
if not psdoc or psdoc['parent_doc_id'] != pdoc['doc_id']:
raise error.DocumentNotFoundError(domain_id, document.TYPE_PROBLEM_SOLUTION, psid)
raise error.DocumentNotFoundError(self.domain_id, document.TYPE_PROBLEM_SOLUTION, psid)
self.response.content_type = 'text/markdown'
self.response.text = psrdoc['content']

Expand Down Expand Up @@ -570,7 +569,7 @@ async def post(self, *, pid: document.convert_doc_id, hidden: bool=False,
category = self.split_tags(category)
tag = self.split_tags(tag)
for c in category:
if not (c in builtin.PROBLEM_CATEGORIES \
if not (c in builtin.PROBLEM_CATEGORIES
or c in builtin.PROBLEM_SUB_CATEGORIES):
raise error.ValidationError('category')
if difficulty_setting not in problem.SETTING_DIFFICULTY_RANGE:
Expand Down
1 change: 0 additions & 1 deletion vj4/handler/training.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import asyncio
import time
from json import decoder
from bson import objectid

Expand Down
1 change: 0 additions & 1 deletion vj4/model/adaptor/discussion.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from vj4 import error
from vj4.model import document
from vj4.model.adaptor import problem
from vj4.service import smallcache
from vj4.util import argmethod
from vj4.util import validator
Expand Down
3 changes: 0 additions & 3 deletions vj4/model/adaptor/training.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import asyncio
from bson import objectid
from pymongo import errors

from vj4 import constant
from vj4 import error
from vj4.model import document
from vj4.model.adaptor import problem
from vj4.util import argmethod
from vj4.util import validator

Expand Down
3 changes: 0 additions & 3 deletions vj4/model/adaptor/userfile.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import asyncio
from bson import objectid
from pymongo import errors

from vj4 import constant
from vj4 import error
from vj4.model import builtin
from vj4.model import document
Expand Down
1 change: 0 additions & 1 deletion vj4/model/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import itertools

from vj4 import constant
from vj4 import error
from vj4.util import version

# Permissions.
Expand Down
2 changes: 0 additions & 2 deletions vj4/model/oplog.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import itertools
from bson import objectid
from pymongo import ReturnDocument

from vj4 import db
from vj4.util import argmethod
Expand Down
4 changes: 1 addition & 3 deletions vj4/service/staticmanifest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import time

from os import path
from vj4.util import json

Expand All @@ -18,7 +16,7 @@ def init(static_dir):
with open(_manifest_path, 'r') as manifest_file:
data = json.decode(manifest_file.read())
_manifest = data
except Exception as e:
except Exception:
pass


Expand Down
1 change: 0 additions & 1 deletion vj4/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from vj4.service import staticmanifest
from vj4.util import json
from vj4.util import options
from vj4.util import version


class Undefined(jinja2.runtime.Undefined):
Expand Down
1 change: 0 additions & 1 deletion vj4/util/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from vj4 import constant
from vj4 import error
from vj4.model import builtin


def is_uid(s):
Expand Down

0 comments on commit f040b0a

Please sign in to comment.