diff --git a/mediagoblin.ini b/mediagoblin.ini
index 43621107..4906546a 100644
--- a/mediagoblin.ini
+++ b/mediagoblin.ini
@@ -11,7 +11,7 @@ email_sender_address = "notice@mediagoblin.example.org"
## Uncomment and change to your DB's appropiate setting.
## Default is a local sqlite db "mediagoblin.db".
-# sql_engine = postgresql:///gmg
+# sql_engine = postgresql:///mediagoblin
# set to false to enable sending notices
email_debug_mode = true
diff --git a/mediagoblin/config_spec.ini b/mediagoblin/config_spec.ini
index 6c00aa58..2af4adb2 100644
--- a/mediagoblin/config_spec.ini
+++ b/mediagoblin/config_spec.ini
@@ -61,6 +61,7 @@ csrf_cookie_name = string(default='mediagoblin_csrftoken')
push_urls = string_list(default=list())
exif_visible = boolean(default=False)
+original_date_visible = boolean(default=False)
# Theming stuff
theme_install_dir = string(default="%(here)s/user_dev/themes/")
diff --git a/mediagoblin/init/celery/from_tests.py b/mediagoblin/init/celery/from_tests.py
deleted file mode 100644
index 3149e1ba..00000000
--- a/mediagoblin/init/celery/from_tests.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# GNU MediaGoblin -- federated, autonomous media hosting
-# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-
-import os
-
-from mediagoblin.tests.tools import TEST_APP_CONFIG
-from mediagoblin.init.celery.from_celery import setup_self
-
-
-OUR_MODULENAME = __name__
-CELERY_SETUP = False
-
-
-if os.environ.get('CELERY_CONFIG_MODULE') == OUR_MODULENAME:
- if CELERY_SETUP:
- pass
- else:
- setup_self(check_environ_for_conf=False, module_name=OUR_MODULENAME,
- default_conf_file=TEST_APP_CONFIG)
- CELERY_SETUP = True
diff --git a/mediagoblin/media_types/image/__init__.py b/mediagoblin/media_types/image/__init__.py
index 15cc8dda..5130ef48 100644
--- a/mediagoblin/media_types/image/__init__.py
+++ b/mediagoblin/media_types/image/__init__.py
@@ -14,6 +14,8 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
+import datetime
+
from mediagoblin.media_types import MediaManagerBase
from mediagoblin.media_types.image.processing import process_image, \
sniff_handler
@@ -28,5 +30,26 @@ class ImageMediaManager(MediaManagerBase):
accepted_extensions = ["jpg", "jpeg", "png", "gif", "tiff"]
media_fetch_order = [u'medium', u'original', u'thumb']
+ def get_original_date(self):
+ """
+ Get the original date and time from the EXIF information. Returns
+ either a datetime object or None (if anything goes wrong)
+ """
+ if not self.entry.media_data or not self.entry.media_data.exif_all:
+ return None
+
+ try:
+ # Try wrapped around all since exif_all might be none,
+ # EXIF DateTimeOriginal or printable might not exist
+ # or strptime might not be able to parse date correctly
+ exif_date = self.entry.media_data.exif_all[
+ 'EXIF DateTimeOriginal']['printable']
+ original_date = datetime.datetime.strptime(
+ exif_date,
+ '%Y:%m:%d %H:%M:%S')
+ return original_date
+ except (KeyError, ValueError):
+ return None
+
MEDIA_MANAGER = ImageMediaManager
diff --git a/mediagoblin/messages.py b/mediagoblin/messages.py
index 80d8ece7..d58f13d4 100644
--- a/mediagoblin/messages.py
+++ b/mediagoblin/messages.py
@@ -14,16 +14,24 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
+from mediagoblin.tools import common
+
DEBUG = 'debug'
INFO = 'info'
SUCCESS = 'success'
WARNING = 'warning'
ERROR = 'error'
+ADD_MESSAGE_TEST = []
+
def add_message(request, level, text):
messages = request.session.setdefault('messages', [])
messages.append({'level': level, 'text': text})
+
+ if common.TESTS_ENABLED:
+ ADD_MESSAGE_TEST.append(messages)
+
request.session.save()
@@ -33,4 +41,10 @@ def fetch_messages(request, clear_from_session=True):
# Save that we removed the messages from the session
request.session['messages'] = []
request.session.save()
+
return messages
+
+
+def clear_add_message():
+ global ADD_MESSAGE_TEST
+ ADD_MESSAGE_TEST = []
diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html
index 6d32d009..667510d5 100644
--- a/mediagoblin/templates/mediagoblin/user_pages/media.html
+++ b/mediagoblin/templates/mediagoblin/user_pages/media.html
@@ -147,12 +147,27 @@
{% endif %}