[Lint] Make PyLint happy again

This commit is contained in:
Gergely Polonkai 2018-07-23 12:20:12 +02:00
parent 4935e6394b
commit 9e7ea29f5e
3 changed files with 15 additions and 6 deletions

View File

@ -21,7 +21,7 @@ from datetime import timedelta
import pickle
from uuid import uuid4
from flask import current_app, has_request_context, request, session
from flask import has_request_context, request as flask_request, session as flask_session
from flask.sessions import SessionInterface, SessionMixin
from flask_caching import Cache
from werkzeug.datastructures import CallbackDict
@ -46,7 +46,7 @@ class CachedSession(CallbackDict, SessionMixin): # pylint: disable=too-many-anc
self.__modifying = True
if has_request_context():
self['ip'] = request.remote_addr
self['ip'] = flask_request.remote_addr
self.modified = True
@ -59,6 +59,9 @@ class CachedSession(CallbackDict, SessionMixin): # pylint: disable=too-many-anc
@property
def user(self):
"""The user this session belongs to
"""
from calsocial.models import User
if 'user_id' not in self:
@ -87,11 +90,11 @@ class CachedSessionInterface(SessionInterface):
return str(uuid4())
@staticmethod
def get_cache_expiration_time(app, session):
def get_cache_expiration_time(app, sess):
"""Get the expiration time of the cache entry
"""
if session.permanent:
if sess.permanent:
return app.permanent_session_lifetime
return timedelta(days=1)
@ -147,7 +150,10 @@ class CachedSessionInterface(SessionInterface):
domain=domain)
def delete_session(self, sid):
if has_request_context() and session.sid == sid:
"""Delete the session with ``sid`` as its session ID
"""
if has_request_context() and flask_session.sid == sid:
raise ValueError('Will not delete the current session')
cache.delete(self.prefix + sid)

View File

@ -219,7 +219,7 @@ class GregorianCalendar(CalendarSystem):
end_timestamp = start_timestamp + timedelta(days=1)
events = events.filter((Event.start_time <= end_timestamp) &
(Event.end_time >= start_timestamp)) \
(Event.end_time >= start_timestamp)) \
.order_by('start_time', 'end_time')
if user is None:

View File

@ -89,6 +89,9 @@ class RoutedMixin:
"""
def register_routes(self):
"""Register all routes that were marked with :meth:`route`
"""
for attr_name in self.__dir__():
attr = getattr(self, attr_name)