Merge remote-tracking branch 'upstream/master' into skeletongobblin
This commit is contained in:
commit
0172ad0001
1
AUTHORS
1
AUTHORS
@ -82,6 +82,7 @@ Thank you!
|
||||
* Tran Thanh Bao
|
||||
* Tryggvi Björgvinsson
|
||||
* Shawn Khan
|
||||
* Sergio Durigan Junior
|
||||
* Will Kahn-Greene
|
||||
|
||||
Special thanks to:
|
||||
|
@ -25,6 +25,7 @@ from werkzeug.exceptions import HTTPException
|
||||
from werkzeug.routing import RequestRedirect
|
||||
|
||||
from mediagoblin import meddleware, __version__
|
||||
from mediagoblin.db.util import check_db_up_to_date
|
||||
from mediagoblin.tools import common, session, translate, template
|
||||
from mediagoblin.tools.response import render_http_exception
|
||||
from mediagoblin.tools.theme import register_themes
|
||||
@ -91,6 +92,9 @@ class MediaGoblinApp(object):
|
||||
# Set up the database
|
||||
self.db = setup_database(app_config['run_migrations'])
|
||||
|
||||
# Quit app if need to run dbupdate
|
||||
check_db_up_to_date()
|
||||
|
||||
# Register themes
|
||||
self.theme_registry, self.current_theme = register_themes(app_config)
|
||||
|
||||
|
@ -14,9 +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 sys
|
||||
|
||||
from mediagoblin import mg_globals as mgg
|
||||
from mediagoblin.db.base import Session
|
||||
from mediagoblin.db.models import MediaEntry, Tag, MediaTag, Collection
|
||||
|
||||
from mediagoblin.gmg_commands.dbupdate import gather_database_data
|
||||
|
||||
##########################
|
||||
# Random utility functions
|
||||
@ -67,6 +70,19 @@ def check_collection_slug_used(creator_id, slug, ignore_c_id):
|
||||
does_exist = Session.query(Collection.id).filter(filt).first() is not None
|
||||
return does_exist
|
||||
|
||||
|
||||
def check_db_up_to_date():
|
||||
"""Check if the database is up to date and quit if not"""
|
||||
dbdatas = gather_database_data(mgg.global_config.get('plugins', {}).keys())
|
||||
|
||||
for dbdata in dbdatas:
|
||||
migration_manager = dbdata.make_migration_manager(Session())
|
||||
if migration_manager.database_current_migration is None or \
|
||||
migration_manager.migrations_to_run():
|
||||
sys.exit("Your database is not up to date. Please run "
|
||||
"'gmg dbupdate' before starting MediaGoblin.")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from mediagoblin.db.open import setup_connection_and_db_from_config
|
||||
|
||||
|
@ -28,6 +28,7 @@ logging.basicConfig()
|
||||
## Let's not set the level as debug by default to avoid confusing users :)
|
||||
# _log.setLevel(logging.DEBUG)
|
||||
|
||||
|
||||
def dbupdate_parse_setup(subparser):
|
||||
pass
|
||||
|
||||
|
@ -266,6 +266,11 @@ class CommonVideoProcessor(MediaProcessor):
|
||||
tmp_thumb,
|
||||
thumb_size[0])
|
||||
|
||||
# Checking if the thumbnail was correctly created. If it was not,
|
||||
# then just give up.
|
||||
if not os.path.exists (tmp_thumb):
|
||||
return
|
||||
|
||||
# Push the thumbnail to public storage
|
||||
_log.debug('Saving thumbnail...')
|
||||
store_public(self.entry, 'thumb', tmp_thumb,
|
||||
|
@ -16,10 +16,14 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-#}
|
||||
<!doctype html>
|
||||
|
||||
<html
|
||||
{% block mediagoblin_html_tag %}
|
||||
{% endblock mediagoblin_html_tag %}
|
||||
>
|
||||
{% block mediagoblin_html_tag %}
|
||||
{% endblock mediagoblin_html_tag %}
|
||||
{% if is_rtl -%}
|
||||
dir="rtl"
|
||||
{%- endif -%}
|
||||
>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
@ -26,7 +26,9 @@ from mediagoblin import mg_globals
|
||||
from mediagoblin import messages
|
||||
from mediagoblin import _version
|
||||
from mediagoblin.tools import common
|
||||
from mediagoblin.tools.translate import is_rtl
|
||||
from mediagoblin.tools.translate import set_thread_locale
|
||||
from mediagoblin.tools.translate import get_locale_from_request
|
||||
from mediagoblin.tools.pluginapi import get_hook_templates, hook_transform
|
||||
from mediagoblin.tools.timesince import timesince
|
||||
from mediagoblin.meddleware.csrf import render_csrf_form_token
|
||||
@ -72,12 +74,13 @@ def get_jinja_env(template_loader, locale):
|
||||
# ... fetch all waiting messages and remove them from the queue
|
||||
# ... construct a grid of thumbnails or other media
|
||||
# ... have access to the global and app config
|
||||
# ... determine if the language is rtl or ltr
|
||||
template_env.globals['fetch_messages'] = messages.fetch_messages
|
||||
template_env.globals['app_config'] = mg_globals.app_config
|
||||
template_env.globals['global_config'] = mg_globals.global_config
|
||||
template_env.globals['version'] = _version.__version__
|
||||
template_env.globals['auth'] = mg_globals.app.auth
|
||||
|
||||
template_env.globals['is_rtl'] = is_rtl(locale)
|
||||
template_env.filters['urlencode'] = url_quote_plus
|
||||
|
||||
# add human readable fuzzy date time
|
||||
|
@ -31,6 +31,12 @@ AVAILABLE_LOCALES = None
|
||||
TRANSLATIONS_PATH = pkg_resources.resource_filename(
|
||||
'mediagoblin', 'i18n')
|
||||
|
||||
# Known RTL languages
|
||||
KNOWN_RTL = set(["ar", "fa", "zh","he","iw","ja","ur","yi","ji"])
|
||||
|
||||
def is_rtl(lang):
|
||||
"""Returns true when the local language is right to left"""
|
||||
return lang in KNOWN_RTL
|
||||
|
||||
def set_available_locales():
|
||||
"""Set available locales for which we have translations"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user