from mediagoblin.db.extratypes import JSONEncoded
from mediagoblin.db.migration_tools import RegisterMigration, inspect_table
from mediagoblin.db.models import (MediaEntry, Collection, User,
- MediaComment, Privilege, ReportBase,
- FOUNDATIONS)
+ MediaComment, Privilege, FOUNDATIONS)
MIGRATIONS = {}
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from mediagoblin.db.base import Session
-from mediagoblin.db.models import (MediaEntry, Tag, MediaTag, Collection, \
- User, Privilege, FOUNDATIONS)
+from mediagoblin.db.models import MediaEntry, Tag, MediaTag, Collection
##########################
from mediagoblin import mg_globals as mgg
from mediagoblin import messages
-from mediagoblin.db.models import (MediaEntry, User, MediaComment,
- UserBan, Privilege)
+from mediagoblin.db.models import MediaEntry, User, MediaComment
from mediagoblin.tools.response import (redirect, render_404,
render_user_banned, json_response)
from mediagoblin.tools.translate import pass_to_ugettext as _
from mediagoblin.tools.response import redirect
from datetime import datetime
from mediagoblin.tools.translate import lazy_pass_to_ugettext as _
-import sys, traceback
def take_punitive_actions(request, form, report, user):
message_body =''
for privilege_name in form.take_away_privileges.data:
take_away_privileges(user.username, privilege_name)
form.resolution_content.data += \
- u"\n{mod} took away {user}\'{privilege} privileges.".format(
+ u"\n{mod} took away {user}\'s {privilege} privileges.".format(
mod=request.user.username,
user=user.username,
privilege=privilege_name)
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-from werkzeug.exceptions import Forbidden
-from mediagoblin.db.models import (MediaEntry, User, MediaComment, \
- CommentReport, ReportBase, Privilege, \
+from mediagoblin.db.models import (MediaEntry, User,ReportBase, Privilege,
UserBan)
-from mediagoblin.decorators import (require_admin_or_moderator_login,
+from mediagoblin.decorators import (require_admin_or_moderator_login,
active_user_from_url, user_has_privilege,
allow_reporting)
from mediagoblin.tools.response import render_to_response, redirect
from mediagoblin.moderation.tools import (take_punitive_actions, \
take_away_privileges, give_privileges, ban_user, unban_user, \
parse_report_panel_settings)
-from werkzeug.datastructures import ImmutableMultiDict
-from datetime import datetime
from math import ceil
@require_admin_or_moderator_login
from mediagoblin.tests.tools import fixture_add_user
from .resources import GOOD_JPG, GOOD_PNG, EVIL_FILE, EVIL_JPG, EVIL_PNG, \
BIG_BLUE
-from mediagoblin.db.models import Privilege
_log = logging.getLogger(__name__)
from mediagoblin.tests.tools import (fixture_add_user,
fixture_add_comment_report, fixture_add_comment)
from mediagoblin.db.models import User, CommentReport, MediaComment, UserBan
-from mediagoblin.moderation.tools import take_away_privileges, give_privileges
from mediagoblin.tools import template, mail
-from datetime import date, timedelta
-
from webtest import AppError
class TestModerationViews:
from mediagoblin.tests.tools import fixture_add_user, fixture_media_entry
-from mediagoblin.db.models import User, Privilege, UserBan
-from mediagoblin.db.base import Session
+from mediagoblin.db.models import User, UserBan
from mediagoblin.tools import template
from .resources import GOOD_JPG
fixture_add_user(u'alex',
privileges=[u'admin',u'active'])
- fixture_add_user(u'raven',
+ fixture_add_user(u'meow',
privileges=[u'moderator',u'active',u'reporter'])
fixture_add_user(u'natalie',
privileges=[u'active'])
def query_for_users(self):
self.admin_user = User.query.filter(User.username==u'alex').first()
- self.mod_user = User.query.filter(User.username==u'raven').first()
+ self.mod_user = User.query.filter(User.username==u'meow').first()
self.user = User.query.filter(User.username==u'natalie').first()
def testUserBanned(self):
from mediagoblin.tests.tools import fixture_add_user
from mediagoblin import mg_globals
-from mediagoblin.db.models import MediaEntry, User, Privilege
+from mediagoblin.db.models import MediaEntry, User
from mediagoblin.tools import template
from mediagoblin.media_types.image import ImageMediaManager
from mediagoblin.media_types.pdf.processing import check_prerequisites as pdf_check_prerequisites
from mediagoblin import messages, mg_globals
from mediagoblin.db.models import (MediaEntry, MediaTag, Collection,
- CollectionItem, User, MediaComment,
- CommentReport, MediaReport)
+ CollectionItem, User)
from mediagoblin.tools.response import render_to_response, render_404, \
redirect, redirect_obj
from mediagoblin.tools.text import cleaned_markdown_conversion