Fix print statements.
This commit is contained in:
parent
e2cb0f86fe
commit
f9d93c0e9a
@ -14,6 +14,8 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# 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/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
from mediagoblin.gmg_commands import util as commands_util
|
from mediagoblin.gmg_commands import util as commands_util
|
||||||
|
|
||||||
|
|
||||||
@ -32,7 +34,7 @@ def deletemedia(args):
|
|||||||
for media in medias:
|
for media in medias:
|
||||||
found_medias.add(media.id)
|
found_medias.add(media.id)
|
||||||
media.delete()
|
media.delete()
|
||||||
print 'Media ID %d has been deleted.' % media.id
|
print('Media ID %d has been deleted.' % media.id)
|
||||||
for media in media_ids - found_medias:
|
for media in media_ids - found_medias:
|
||||||
print 'Can\'t find a media with ID %d.' % media
|
print('Can\'t find a media with ID %d.' % media)
|
||||||
print 'Done.'
|
print('Done.')
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# 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/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@ -143,7 +146,7 @@ def available(args):
|
|||||||
manager = get_processing_manager_for_type(media_type)
|
manager = get_processing_manager_for_type(media_type)
|
||||||
except ProcessingManagerDoesNotExist:
|
except ProcessingManagerDoesNotExist:
|
||||||
entry = MediaEntry.query.filter_by(id=args.id_or_type).first()
|
entry = MediaEntry.query.filter_by(id=args.id_or_type).first()
|
||||||
print 'No such processing manager for {0}'.format(entry.media_type)
|
print('No such processing manager for {0}'.format(entry.media_type))
|
||||||
|
|
||||||
if args.state:
|
if args.state:
|
||||||
processors = manager.list_all_processors_by_state(args.state)
|
processors = manager.list_all_processors_by_state(args.state)
|
||||||
@ -152,25 +155,25 @@ def available(args):
|
|||||||
else:
|
else:
|
||||||
processors = manager.list_eligible_processors(media_entry)
|
processors = manager.list_eligible_processors(media_entry)
|
||||||
|
|
||||||
print "Available processors:"
|
print("Available processors:")
|
||||||
print "====================="
|
print("=====================")
|
||||||
print ""
|
print("")
|
||||||
|
|
||||||
if args.action_help:
|
if args.action_help:
|
||||||
for processor in processors:
|
for processor in processors:
|
||||||
print processor.name
|
print(processor.name)
|
||||||
print "-" * len(processor.name)
|
print("-" * len(processor.name))
|
||||||
|
|
||||||
parser = processor.generate_parser()
|
parser = processor.generate_parser()
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
print ""
|
print("")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
for processor in processors:
|
for processor in processors:
|
||||||
if processor.description:
|
if processor.description:
|
||||||
print " - %s: %s" % (processor.name, processor.description)
|
print(" - %s: %s" % (processor.name, processor.description))
|
||||||
else:
|
else:
|
||||||
print " - %s" % processor.name
|
print(" - %s" % processor.name)
|
||||||
|
|
||||||
|
|
||||||
def run(args, media_id=None):
|
def run(args, media_id=None):
|
||||||
@ -185,12 +188,12 @@ def run(args, media_id=None):
|
|||||||
processor_class = manager.get_processor(
|
processor_class = manager.get_processor(
|
||||||
args.reprocess_command, media_entry)
|
args.reprocess_command, media_entry)
|
||||||
except ProcessorDoesNotExist:
|
except ProcessorDoesNotExist:
|
||||||
print 'No such processor "%s" for media with id "%s"' % (
|
print('No such processor "%s" for media with id "%s"' % (
|
||||||
args.reprocess_command, media_entry.id)
|
args.reprocess_command, media_entry.id))
|
||||||
return
|
return
|
||||||
except ProcessorNotEligible:
|
except ProcessorNotEligible:
|
||||||
print 'Processor "%s" exists but media "%s" is not eligible' % (
|
print('Processor "%s" exists but media "%s" is not eligible' % (
|
||||||
args.reprocess_command, media_entry.id)
|
args.reprocess_command, media_entry.id))
|
||||||
return
|
return
|
||||||
|
|
||||||
reprocess_parser = processor_class.generate_parser()
|
reprocess_parser = processor_class.generate_parser()
|
||||||
@ -203,7 +206,7 @@ def run(args, media_id=None):
|
|||||||
|
|
||||||
except ProcessingManagerDoesNotExist:
|
except ProcessingManagerDoesNotExist:
|
||||||
entry = MediaEntry.query.filter_by(id=media_id).first()
|
entry = MediaEntry.query.filter_by(id=media_id).first()
|
||||||
print 'No such processing manager for {0}'.format(entry.media_type)
|
print('No such processing manager for {0}'.format(entry.media_type))
|
||||||
|
|
||||||
|
|
||||||
def bulk_run(args):
|
def bulk_run(args):
|
||||||
@ -233,12 +236,12 @@ def thumbs(args):
|
|||||||
processor_class = manager.get_processor(
|
processor_class = manager.get_processor(
|
||||||
'resize', media_entry)
|
'resize', media_entry)
|
||||||
except ProcessorDoesNotExist:
|
except ProcessorDoesNotExist:
|
||||||
print 'No such processor "%s" for media with id "%s"' % (
|
print('No such processor "%s" for media with id "%s"' % (
|
||||||
'resize', media_entry.id)
|
'resize', media_entry.id))
|
||||||
return
|
return
|
||||||
except ProcessorNotEligible:
|
except ProcessorNotEligible:
|
||||||
print 'Processor "%s" exists but media "%s" is not eligible' % (
|
print('Processor "%s" exists but media "%s" is not eligible' % (
|
||||||
'resize', media_entry.id)
|
'resize', media_entry.id))
|
||||||
return
|
return
|
||||||
|
|
||||||
reprocess_parser = processor_class.generate_parser()
|
reprocess_parser = processor_class.generate_parser()
|
||||||
@ -260,7 +263,7 @@ def thumbs(args):
|
|||||||
reprocess_info=reprocess_request)
|
reprocess_info=reprocess_request)
|
||||||
|
|
||||||
except ProcessingManagerDoesNotExist:
|
except ProcessingManagerDoesNotExist:
|
||||||
print 'No such processing manager for {0}'.format(entry.media_type)
|
print('No such processing manager for {0}'.format(entry.media_type))
|
||||||
|
|
||||||
|
|
||||||
def initial(args):
|
def initial(args):
|
||||||
@ -276,7 +279,7 @@ def initial(args):
|
|||||||
media_entry,
|
media_entry,
|
||||||
reprocess_action='initial')
|
reprocess_action='initial')
|
||||||
except ProcessingManagerDoesNotExist:
|
except ProcessingManagerDoesNotExist:
|
||||||
print 'No such processing manager for {0}'.format(entry.media_type)
|
print('No such processing manager for {0}'.format(entry.media_type))
|
||||||
|
|
||||||
|
|
||||||
def reprocess(args):
|
def reprocess(args):
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# 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/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from mediagoblin.gmg_commands import util as commands_util
|
from mediagoblin.gmg_commands import util as commands_util
|
||||||
@ -47,7 +49,7 @@ def adduser(args):
|
|||||||
).count()
|
).count()
|
||||||
|
|
||||||
if users_with_username:
|
if users_with_username:
|
||||||
print u'Sorry, a user with that name already exists.'
|
print(u'Sorry, a user with that name already exists.')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Create the user
|
# Create the user
|
||||||
@ -68,7 +70,7 @@ def adduser(args):
|
|||||||
entry.all_privileges = default_privileges
|
entry.all_privileges = default_privileges
|
||||||
entry.save()
|
entry.save()
|
||||||
|
|
||||||
print "User created (and email marked as verified)"
|
print(u"User created (and email marked as verified)")
|
||||||
|
|
||||||
|
|
||||||
def makeadmin_parser_setup(subparser):
|
def makeadmin_parser_setup(subparser):
|
||||||
@ -90,9 +92,9 @@ def makeadmin(args):
|
|||||||
db.Privilege.privilege_name==u'admin').one()
|
db.Privilege.privilege_name==u'admin').one()
|
||||||
)
|
)
|
||||||
user.save()
|
user.save()
|
||||||
print 'The user is now Admin'
|
print(u'The user is now Admin')
|
||||||
else:
|
else:
|
||||||
print 'The user doesn\'t exist'
|
print(u'The user doesn\'t exist')
|
||||||
|
|
||||||
|
|
||||||
def changepw_parser_setup(subparser):
|
def changepw_parser_setup(subparser):
|
||||||
@ -114,6 +116,6 @@ def changepw(args):
|
|||||||
if user:
|
if user:
|
||||||
user.pw_hash = auth.gen_password_hash(args.password)
|
user.pw_hash = auth.gen_password_hash(args.password)
|
||||||
user.save()
|
user.save()
|
||||||
print 'Password successfully changed'
|
print(u'Password successfully changed')
|
||||||
else:
|
else:
|
||||||
print 'The user doesn\'t exist'
|
print(u'The user doesn\'t exist')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user