Trees | Indices | Help |
---|
|
1 # -*- Mode: Python -*- 2 # -*- Encoding: UTF-8 -*- 3 # vi:si:et:sw=4:sts=4:ts=4 4 5 # Flumotion - a streaming media server 6 # Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L. 7 # Copyright (C) 2010,2011 Flumotion Services, S.A. 8 # All rights reserved. 9 # 10 # This file may be distributed and/or modified under the terms of 11 # the GNU Lesser General Public License version 2.1 as published by 12 # the Free Software Foundation. 13 # This file is distributed without any warranty; without even the implied 14 # warranty of merchantability or fitness for a particular purpose. 15 # See "LICENSE.LGPL" in the source distribution for more information. 16 # 17 # Headers in this file shall remain intact. 18 19 import os 20 import urllib 21 22 from flumotion.common import python 23 from flumotion.component.plugs import base 24 25 __version__ = "$Rev$" 26 27 42 4345 46 logCategory = 'forcedownload' 476349 properties = self.args['properties'] 50 self._argument = properties['argument-name'] 51 self._triggers = python.set(properties.get('trigger-value', ['1'])) 52 self.log("Argument name: %s", self._argument) 53 self.log("Trigger values: %s", self._triggers)5456 if self._argument in request.args: 57 if self._triggers & python.set(request.args[self._argument]): 58 filename = os.path.basename(urllib.unquote_plus(request.path)) 59 filename = filename.encode('UTF-8') 60 filename = urllib.quote(filename) 61 header = "attachment; filename*=utf-8''%s" % filename 62 request.setHeader('Content-Disposition', header)
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Tue Aug 13 06:17:16 2013 | http://epydoc.sourceforge.net |