Fix problems from pyflakes output

This commit is contained in:
Will Kahn-Greene 2012-06-03 15:53:34 -04:00
parent 349f5b19f7
commit a855e92a98
14 changed files with 14 additions and 32 deletions

View File

@ -14,7 +14,6 @@
# 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 os
import random
import bcrypt

View File

@ -14,10 +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/>.
import uuid
from webob import exc
from string import split
from cgi import FieldStorage
from datetime import datetime
@ -33,9 +30,7 @@ from mediagoblin.decorators import require_active_login, get_user_media_entry
from mediagoblin.tools.response import render_to_response, redirect
from mediagoblin.tools.translate import pass_to_ugettext as _
from mediagoblin.tools.text import (
clean_html, convert_to_tag_list_of_dicts,
media_tags_as_string)
from mediagoblin.tools.licenses import SUPPORTED_LICENSES
convert_to_tag_list_of_dicts, media_tags_as_string)
from mediagoblin.db.util import check_media_slug_used
@ -185,7 +180,6 @@ def edit_profile(request):
@require_active_login
def edit_account(request):
edit_username = request.GET.get('username')
user = request.user
form = forms.EditAccountForm(request.POST)

View File

@ -17,8 +17,7 @@
from sqlalchemy.orm import sessionmaker
from mediagoblin.db.sql.open import setup_connection_and_db_from_config
from mediagoblin.db.sql.util import (
MigrationManager, assure_migrations_table_setup)
from mediagoblin.db.sql.util import MigrationManager
from mediagoblin.init import setup_global_and_app_config
from mediagoblin.tools.common import import_component

View File

@ -61,8 +61,7 @@ def _import_media(db, args):
args._cache_path['media'])
# TODO: Add import of queue files
queue_cache = BasicFileStorage(
args._cache_path['queue'])
queue_cache = BasicFileStorage(args._cache_path['queue'])
for entry in db.MediaEntry.find():
for name, path in entry.media_files.items():
@ -203,8 +202,7 @@ def _export_media(db, args):
args._cache_path['media'])
# TODO: Add export of queue files
queue_cache = BasicFileStorage(
args._cache_path['queue'])
queue_cache = BasicFileStorage(args._cache_path['queue'])
for entry in db.MediaEntry.find():
for name, path in entry.media_files.items():

View File

@ -14,7 +14,6 @@
# 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 hashlib
import random
import logging
@ -81,7 +80,7 @@ class CsrfMeddleware(BaseMeddleware):
request.environ['CSRF_TOKEN'] = \
request.cookies[mg_globals.app_config['csrf_cookie_name']]
except KeyError, e:
except KeyError:
# if it doesn't exist, make a new one
request.environ['CSRF_TOKEN'] = self._make_token(request)

View File

@ -78,7 +78,7 @@ def process_audio(entry):
webm_audio_tmp.name,
quality=audio_config['quality'])
data = transcoder.discover(webm_audio_tmp.name)
transcoder.discover(webm_audio_tmp.name)
_log.debug('Saving medium...')
mgg.public_store.get_file(webm_audio_filepath, 'wb').write(

View File

@ -14,9 +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/>.
import os
import shutil
import urlparse
import uuid
from werkzeug.utils import secure_filename

View File

@ -73,8 +73,7 @@ class CloudFilesStorage(StorageInterface):
def file_exists(self, filepath):
try:
object = self.container.get_object(
self._resolve_filepath(filepath))
self.container.get_object( self._resolve_filepath(filepath))
return True
except cloudfiles.errors.NoSuchObject:
return False

View File

@ -17,6 +17,10 @@
from mediagoblin.storage import StorageInterface, clean_listy_filepath
class MountError(Exception):
pass
class MountStorage(StorageInterface):
"""
Experimental "Mount" virtual Storage Interface
@ -105,7 +109,7 @@ class MountStorage(StorageInterface):
def resolve_to_backend(self, filepath):
backend, filepath = self._resolve_to_backend(filepath)
if backend is None:
raise Error("Path not mounted")
raise MountError("Path not mounted")
return backend, filepath
def __repr__(self, table=None, indent=[]):

View File

@ -14,11 +14,6 @@
# 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 urlparse
import datetime
from nose.tools import assert_equal
from mediagoblin.tests.tools import setup_fresh_app
from mediagoblin import mg_globals

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
from nose.tools import assert_equal, assert_true, assert_false
from nose.tools import assert_equal
from mediagoblin import processing

View File

@ -16,9 +16,8 @@
import urlparse
import os
import re
from nose.tools import assert_equal, assert_true, assert_false
from nose.tools import assert_equal, assert_true
from pkg_resources import resource_filename
from mediagoblin.tests.tools import get_test_app, \

View File

@ -15,7 +15,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from mediagoblin.tests.tools import setup_fresh_app
from mediagoblin import mg_globals
from mediagoblin.tools import text
@setup_fresh_app

View File

@ -17,7 +17,6 @@
import os
import tempfile
from nose.tools import assert_raises
from mediagoblin import workbench
from mediagoblin.tests.test_storage import get_tmp_filestorage