aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdevtools/maketarball.sh (renamed from maketarball.sh)0
-rwxr-xr-xdevtools/update_translations.sh48
-rw-r--r--docs/source/themes/mg/static/mg.css12
-rw-r--r--mediagoblin/db/sql/convert.py7
-rw-r--r--mediagoblin/db/sql/extratypes.py18
-rw-r--r--mediagoblin/db/sql/models.py27
-rw-r--r--mediagoblin/edit/forms.py7
-rw-r--r--mediagoblin/static/css/base.css12
-rw-r--r--mediagoblin/templates/mediagoblin/user_pages/media.html2
-rw-r--r--mediagoblin/templates/mediagoblin/user_pages/user.html2
-rw-r--r--mediagoblin/tools/request.py12
11 files changed, 131 insertions, 16 deletions
diff --git a/maketarball.sh b/devtools/maketarball.sh
index 5f17e578..5f17e578 100755
--- a/maketarball.sh
+++ b/devtools/maketarball.sh
diff --git a/devtools/update_translations.sh b/devtools/update_translations.sh
new file mode 100755
index 00000000..1708e7e0
--- /dev/null
+++ b/devtools/update_translations.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+# GNU MediaGoblin -- federated, autonomous media hosting
+# Copyright (C) 2011 Free Software Foundation, Inc
+#
+# 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 <http://www.gnu.org/licenses/>.
+
+# exit if anything fails
+set -e
+
+echo "==> checking out master"
+git checkout master
+
+echo "==> pulling git master"
+git pull
+
+echo "==> pulling present translations"
+./bin/tx pull -a
+git add mediagoblin/i18n/
+git commit -m "Committing present MediaGoblin translations before pushing extracted messages"
+
+echo "==> Extracting translations"
+./bin/pybabel extract -F babel.ini -o mediagoblin/i18n/en/LC_MESSAGES/mediagoblin.po .
+
+echo "==> Pushing extracted translations to Transifex"
+./bin/tx push -s
+
+# gets the new strings added to all files
+echo "==> Re-Pulling translations from Transifex"
+./bin/tx pull -a
+
+echo "==> Compiling .mo files"
+./bin/pybabel compile -D mediagoblin -d mediagoblin/i18n/
+
+echo "==> Committing to git"
+git add mediagoblin/i18n/
+git commit -m "Committing extracted and compiled translations"
diff --git a/docs/source/themes/mg/static/mg.css b/docs/source/themes/mg/static/mg.css
index b9355a5d..96344df4 100644
--- a/docs/source/themes/mg/static/mg.css
+++ b/docs/source/themes/mg/static/mg.css
@@ -1,3 +1,15 @@
+/*
+
+MediaGoblin theme - MediaGoblin-style Sphinx documentation theme
+
+Written in 2012 by Jef van Schendel <mail@jefvanschendel.nl>
+
+To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
+
+You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
+
+*/
+
@import url("basic.css");
/* text fonts and styles */
diff --git a/mediagoblin/db/sql/convert.py b/mediagoblin/db/sql/convert.py
index 6698b767..88614fd4 100644
--- a/mediagoblin/db/sql/convert.py
+++ b/mediagoblin/db/sql/convert.py
@@ -2,7 +2,7 @@ from mediagoblin.init import setup_global_and_app_config, setup_database
from mediagoblin.db.mongo.util import ObjectId
from mediagoblin.db.sql.models import (Base, User, MediaEntry, MediaComment,
- Tag, MediaTag)
+ Tag, MediaTag, MediaFile)
from mediagoblin.db.sql.open import setup_connection_and_db_from_config as \
sql_connect
from mediagoblin.db.mongo.open import setup_connection_and_db_from_config as \
@@ -70,6 +70,11 @@ def convert_media_entries(mk_db):
session.flush()
add_obj_ids(entry, new_entry)
+ for key, value in entry.media_files.iteritems():
+ new_file = MediaFile(name=key, file_path=value)
+ new_file.media_entry = new_entry.id
+ Session.add(new_file)
+
session.commit()
session.close()
diff --git a/mediagoblin/db/sql/extratypes.py b/mediagoblin/db/sql/extratypes.py
new file mode 100644
index 00000000..88f556d9
--- /dev/null
+++ b/mediagoblin/db/sql/extratypes.py
@@ -0,0 +1,18 @@
+from sqlalchemy.types import TypeDecorator, Unicode
+
+
+class PathTupleWithSlashes(TypeDecorator):
+ "Represents a Tuple of strings as a slash separated string."
+
+ impl = Unicode
+
+ def process_bind_param(self, value, dialect):
+ if value is not None:
+ assert len(value), "Does not support empty lists"
+ value = '/'.join(value)
+ return value
+
+ def process_result_value(self, value, dialect):
+ if value is not None:
+ value = tuple(value.split('/'))
+ return value
diff --git a/mediagoblin/db/sql/models.py b/mediagoblin/db/sql/models.py
index 95821b4f..91092f33 100644
--- a/mediagoblin/db/sql/models.py
+++ b/mediagoblin/db/sql/models.py
@@ -5,7 +5,10 @@ from sqlalchemy import (
Column, Integer, Unicode, UnicodeText, DateTime, Boolean, ForeignKey,
UniqueConstraint)
from sqlalchemy.orm import relationship
+from sqlalchemy.orm.collections import attribute_mapped_collection
+from sqlalchemy.ext.associationproxy import association_proxy
+from mediagoblin.db.sql.extratypes import PathTupleWithSlashes
from mediagoblin.db.sql.base import GMGTableBase
from mediagoblin.db.mixin import UserMixin, MediaEntryMixin
@@ -65,7 +68,7 @@ class MediaEntry(Base, MediaEntryMixin):
fail_error = Column(Unicode)
fail_metadata = Column(UnicodeText)
- queued_media_file = Column(Unicode)
+ queued_media_file = Column(PathTupleWithSlashes)
queued_task_id = Column(Unicode)
@@ -75,13 +78,33 @@ class MediaEntry(Base, MediaEntryMixin):
get_uploader = relationship(User)
+ media_files_helper = relationship("MediaFile",
+ collection_class=attribute_mapped_collection("name"),
+ cascade="all, delete-orphan"
+ )
+ media_files = association_proxy('media_files_helper', 'file_path',
+ creator=lambda k,v: MediaFile(name=k, file_path=v)
+ )
+
## TODO
- # media_files
# media_data
# attachment_files
# fail_error
+class MediaFile(Base):
+ __tablename__ = "mediafiles"
+
+ media_entry = Column(
+ Integer, ForeignKey(MediaEntry.id),
+ nullable=False, primary_key=True)
+ name = Column(Unicode, primary_key=True)
+ file_path = Column(PathTupleWithSlashes)
+
+ def __repr__(self):
+ return "<MediaFile %s: %r>" % (self.name, self.file_path)
+
+
class Tag(Base):
__tablename__ = "tags"
diff --git a/mediagoblin/edit/forms.py b/mediagoblin/edit/forms.py
index 09955874..5c191fba 100644
--- a/mediagoblin/edit/forms.py
+++ b/mediagoblin/edit/forms.py
@@ -45,10 +45,9 @@ class EditProfileForm(wtforms.Form):
bio = wtforms.TextAreaField(
_('Bio'),
[wtforms.validators.Length(min=0, max=500)],
- description=_(
- """You can use
- <a href="http://daringfireball.net/projects/markdown/basics">
- Markdown</a> for formatting."""))
+ description=_("""You can use
+ <a href="http://daringfireball.net/projects/markdown/basics">
+ Markdown</a> for formatting."""))
url = wtforms.TextField(
_('Website'),
[wtforms.validators.Optional(),
diff --git a/mediagoblin/static/css/base.css b/mediagoblin/static/css/base.css
index c2d45a1b..efd7b561 100644
--- a/mediagoblin/static/css/base.css
+++ b/mediagoblin/static/css/base.css
@@ -32,8 +32,7 @@ body {
padding: none;
margin: 0px;
height: 100%;
- font: 16px "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",Helvetica,Arial,sans-serif;
- font-family:'Lato', sans-serif;
+ font: 16px 'Lato', 'Helvetica Neue', Arial, 'Liberation Sans', FreeSans, sans-serif;
}
form {
@@ -43,8 +42,15 @@ form {
/* text styles */
+h1,h2,h3,p {
+ margin-bottom: 20px;
+}
+
+h1,h2,h3 {
+ font-weight: bold;
+}
+
h1 {
- margin-bottom: 15px;
margin-top: 15px;
color: #fff;
font-size: 1.875em;
diff --git a/mediagoblin/templates/mediagoblin/user_pages/media.html b/mediagoblin/templates/mediagoblin/user_pages/media.html
index 583e4ebd..865a94ab 100644
--- a/mediagoblin/templates/mediagoblin/user_pages/media.html
+++ b/mediagoblin/templates/mediagoblin/user_pages/media.html
@@ -97,7 +97,7 @@
user= media.get_uploader.username,
media=media._id) }}" method="POST" id="form_comment">
<p>
- {% trans %}Type your comment here. You can use <a href="http://daringfireball.net/projects/markdown/basics">Markdown</a> for formatting.{% endtrans %}
+ {% trans %}You can use <a href="http://daringfireball.net/projects/markdown/basics">Markdown</a> for formatting.{% endtrans %}
</p>
{{ wtforms_util.render_divs(comment_form) }}
<div class="form_submit_buttons">
diff --git a/mediagoblin/templates/mediagoblin/user_pages/user.html b/mediagoblin/templates/mediagoblin/user_pages/user.html
index 0937f97a..d3b4021d 100644
--- a/mediagoblin/templates/mediagoblin/user_pages/user.html
+++ b/mediagoblin/templates/mediagoblin/user_pages/user.html
@@ -145,7 +145,7 @@
{% include "mediagoblin/utils/feed_link.html" %}
</div>
{% else %}
- {% if request.user._id == user._id %}
+ {% if request.user and (request.user._id == user._id) %}
<div class="profile_showcase empty_space">
<p>
{% trans -%}
diff --git a/mediagoblin/tools/request.py b/mediagoblin/tools/request.py
index b1cbe119..7e193125 100644
--- a/mediagoblin/tools/request.py
+++ b/mediagoblin/tools/request.py
@@ -14,7 +14,7 @@
# 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 mediagoblin.db.util import ObjectId
+from mediagoblin.db.util import ObjectId, InvalidId
def setup_user_in_request(request):
"""
@@ -25,13 +25,17 @@ def setup_user_in_request(request):
request.user = None
return
- user = None
- user = request.app.db.User.one(
- {'_id': ObjectId(request.session['user_id'])})
+ try:
+ oid = ObjectId(request.session['user_id'])
+ except InvalidId:
+ user = None
+ else:
+ user = request.db.User.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']
request.session.invalidate()
request.user = user