From 84812db59dcc7ba476191678a8bb0e1829f3f607 Mon Sep 17 00:00:00 2001 From: Elrond Date: Sat, 28 Jan 2012 00:24:09 +0100 Subject: Change user search from .one to .fine_one. When searching for a user by username, there can either be no result or one result. There is a unique constraint on the db. .one in mongokit raises an error for more than one result. But that can't happen anyway. So no problem. .one in sqlalchemy raises an error for more than one, but that's not a problem anyway. It also raises an error for no result. But no result is handled by the code anyway, so no need to raise an exception. .find_one doesn't raise an exception for more than one result (no problem anyway) and just returns None for no result. The later is handled by the code. --- mediagoblin/auth/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index e18469b9..46c937b0 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -120,7 +120,7 @@ def login(request): login_failed = False if request.method == 'POST' and login_form.validate(): - user = request.db.User.one( + user = request.db.User.find_one( {'username': request.POST['username'].lower()}) if user and user.check_login(request.POST['password']): -- cgit v1.2.3 From cc9f9a1dd3e8f3d0aa642e2a987a9d075e59d3d8 Mon Sep 17 00:00:00 2001 From: Elrond Date: Tue, 13 Mar 2012 00:17:06 +0100 Subject: Another .one -> .find_one Same idea as in the previous commit. Joar caught this one. To reproduce 1. Create a user with an all-decimal ObjectId in mongo 2. Login using that user, while mongodb is enabled. 3. Switch instance to sql. 4. Restart. 5. Refresh any page. This will error, because no user with that object id exists any more. While around, improved logging. --- mediagoblin/tools/request.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 . +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 -- cgit v1.2.3 From 560e22e7d27d8c2642c076ed8c30703b00e00c41 Mon Sep 17 00:00:00 2001 From: Sacha De'Angeli Date: Mon, 12 Mar 2012 19:44:55 -0500 Subject: adding the video.js wrapper --- extlib/video-js/demo.html | 23 + extlib/video-js/video-js.css | 427 +++ extlib/video-js/video-js.min.css | 1 + extlib/video-js/video-js.png | Bin 0 -> 7460 bytes extlib/video-js/video-js.swf | Bin 0 -> 9612 bytes extlib/video-js/video.js | 3744 ++++++++++++++++++++ extlib/video-js/video.min.js | 21 + mediagoblin/static/js/extlib/video-js | 1 + .../mediagoblin/media_displays/video.html | 10 +- 9 files changed, 4225 insertions(+), 2 deletions(-) create mode 100644 extlib/video-js/demo.html create mode 100644 extlib/video-js/video-js.css create mode 100644 extlib/video-js/video-js.min.css create mode 100644 extlib/video-js/video-js.png create mode 100644 extlib/video-js/video-js.swf create mode 100644 extlib/video-js/video.js create mode 100644 extlib/video-js/video.min.js create mode 120000 mediagoblin/static/js/extlib/video-js diff --git a/extlib/video-js/demo.html b/extlib/video-js/demo.html new file mode 100644 index 00000000..a8393af0 --- /dev/null +++ b/extlib/video-js/demo.html @@ -0,0 +1,23 @@ + + + + Video.js | HTML5 Video Player + + + + + + + + + + + + + diff --git a/extlib/video-js/video-js.css b/extlib/video-js/video-js.css new file mode 100644 index 00000000..a1a18a00 --- /dev/null +++ b/extlib/video-js/video-js.css @@ -0,0 +1,427 @@ +/* +VideoJS Default Styles (http://videojs.com) +Version 3.1.0 +*/ + +/* +REQUIRED STYLES (be careful overriding) +================================================================================ */ +/* When loading the player, the video tag is replaced with a DIV, + that will hold the video tag or object tag for other playback methods. + The div contains the video playback element (Flash or HTML5) and controls, and sets the width and height of the video. + + ** If you want to add some kind of border/padding (e.g. a frame), or special positioning, use another containing element. + Otherwise you risk messing up control positioning and full window mode. ** +*/ +.video-js { + background-color: #000; position: relative; padding: 0; + + /* Start with 10px for base font size so other dimensions can be em based and easily calculable. */ + font-size: 10px; + + /* Allow poster to be vertially aligned. */ + vertical-align: middle; + /* display: table-cell; */ /*This works in Safari but not Firefox.*/ +} + +/* Playback technology elements expand to the width/height of the containing div.