diff options
| author | 2013-07-22 23:25:18 +0200 | |
|---|---|---|
| committer | 2013-07-22 23:25:18 +0200 | |
| commit | fc17f3568c985e6a3441fd814d9142952b0cb761 (patch) | |
| tree | 49148f259f8f68fecbe99200692228c550890b26 /pyload/network | |
| parent | little fix for jshint (diff) | |
| download | pyload-fc17f3568c985e6a3441fd814d9142952b0cb761.tar.xz | |
little cleanup, added some tests
Diffstat (limited to 'pyload/network')
| -rw-r--r-- | pyload/network/RequestFactory.py | 38 | 
1 files changed, 18 insertions, 20 deletions
diff --git a/pyload/network/RequestFactory.py b/pyload/network/RequestFactory.py index e6015219f..472705409 100644 --- a/pyload/network/RequestFactory.py +++ b/pyload/network/RequestFactory.py @@ -1,28 +1,26 @@  # -*- coding: utf-8 -*- -""" -    This program is free software; you can redistribute it and/or modify -    it under the terms of the GNU 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 General Public License for more details. - -    You should have received a copy of the GNU General Public License -    along with this program; if not, see <http://www.gnu.org/licenses/>. -     -    @author: mkaay, RaNaN -""" +############################################################################### +#   Copyright(c) 2008-2013 pyLoad Team +#   http://www.pyload.org +# +#   This file is part of pyLoad. +#   pyLoad 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. +# +#   Subjected to the terms and conditions in LICENSE +# +#   @author: RaNaN +###############################################################################  from Bucket import Bucket -from CookieJar import CookieJar  from pyload.plugins.network.DefaultRequest import DefaultRequest, DefaultDownload -class RequestFactory(): + +class RequestFactory:      def __init__(self, core):          self.core = core          self.bucket = Bucket() @@ -42,8 +40,8 @@ class RequestFactory():      def getRequest(self, context=None, klass=DefaultRequest):          """ Creates a request with new or given context """ -        # also accepts cookiejars, not so nice, since it depends on implementation -        if isinstance(context, CookieJar): +        # also accepts the context class directly +        if isinstance(context, klass.CONTEXT_CLASS):              return klass(self.getConfig(), context)          elif context:              return klass(*context)  | 
