aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tools
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/tools')
-rw-r--r--mediagoblin/tools/exif.py7
-rw-r--r--mediagoblin/tools/files.py2
-rw-r--r--mediagoblin/tools/request.py8
3 files changed, 14 insertions, 3 deletions
diff --git a/mediagoblin/tools/exif.py b/mediagoblin/tools/exif.py
index de6dd128..448a342e 100644
--- a/mediagoblin/tools/exif.py
+++ b/mediagoblin/tools/exif.py
@@ -32,6 +32,13 @@ USEFUL_TAGS = [
'EXIF UserComment',
]
+def exif_image_needs_rotation(exif_tags):
+ """
+ Returns True if EXIF orientation requires rotation
+ """
+ return 'Image Orientation' in exif_tags \
+ and exif_tags['Image Orientation'].values[0] != 1
+
def exif_fix_image_orientation(im, exif_tags):
"""
Translate any EXIF orientation to raw orientation
diff --git a/mediagoblin/tools/files.py b/mediagoblin/tools/files.py
index b2f316b2..25c1a6e6 100644
--- a/mediagoblin/tools/files.py
+++ b/mediagoblin/tools/files.py
@@ -27,6 +27,6 @@ def delete_media_files(media):
mg_globals.public_store.delete_file(
listpath)
- for attachment in media['attachment_files']:
+ for attachment in media.attachment_files:
mg_globals.public_store.delete_file(
attachment['filepath'])
diff --git a/mediagoblin/tools/request.py b/mediagoblin/tools/request.py
index a45f716a..ae372c92 100644
--- a/mediagoblin/tools/request.py
+++ b/mediagoblin/tools/request.py
@@ -14,8 +14,12 @@
# 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/>.
+import logging
from mediagoblin.db.util import ObjectId, InvalidId
+_log = logging.getLogger(__name__)
+
+
def setup_user_in_request(request):
"""
Examine a request and tack on a request.user parameter if that's
@@ -30,12 +34,12 @@ def setup_user_in_request(request):
except InvalidId:
user = None
else:
- user = request.db.User.one({'_id': oid})
+ user = request.db.User.find_one({'_id': oid})
if not user:
# Something's wrong... this user doesn't exist? Invalidate
# this session.
- print "Killing session for %r" % request.session['user_id']
+ _log.warn("Killing session for user id %r", request.session['user_id'])
request.session.invalidate()
request.user = user