misc: update various parts for Python 3 compatibility (#36093)
This commit is contained in:
parent
4f3bfc31eb
commit
872aebb0a5
|
@ -34,7 +34,7 @@ class ListValidator(object):
|
|||
for i, item in enumerate(value):
|
||||
try:
|
||||
self.item_validator(item)
|
||||
except ValidationError, e:
|
||||
except ValidationError as e:
|
||||
raise ValidationError(
|
||||
_('Item {0} is invalid: {1}').format(i, e.args[0]))
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import print_function
|
||||
|
||||
import json
|
||||
import os
|
||||
import requests
|
||||
|
@ -56,7 +58,7 @@ class Command(BaseCommand):
|
|||
except IndexError:
|
||||
continue
|
||||
self.deploy(me['base_url'], hobo_environment, True)
|
||||
print 'Redeployed', me['base_url']
|
||||
print('Redeployed', me['base_url'])
|
||||
else:
|
||||
if not base_url or not json_filename:
|
||||
raise CommandError('missing args')
|
||||
|
|
|
@ -57,4 +57,4 @@ HOBO_TENANTS_DIRECTORY = '/var/lib/hobo/tenants'
|
|||
local_settings_file = os.environ.get('HOBO_AGENT_SETTINGS_FILE',
|
||||
os.path.join(os.path.dirname(__file__), 'local_settings.py'))
|
||||
if os.path.exists(local_settings_file):
|
||||
execfile(local_settings_file)
|
||||
exec(open(local_settings_file).read())
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import print_function
|
||||
|
||||
from optparse import make_option
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
@ -15,6 +17,6 @@ class Command(BaseCommand):
|
|||
if obj.is_operational():
|
||||
print("%s is operational" % obj.title)
|
||||
else:
|
||||
print self.style.NOTICE('%s is NOT operational' % obj.title)
|
||||
print(self.style.NOTICE('%s is NOT operational' % obj.title))
|
||||
if obj.last_operational_success_timestamp:
|
||||
print self.style.NOTICE(' last operational success: %s' % obj.last_operational_success_timestamp)
|
||||
print(self.style.NOTICE(' last operational success: %s' % obj.last_operational_success_timestamp))
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
# 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/>.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import json
|
||||
import string
|
||||
import sys
|
||||
|
@ -61,7 +63,7 @@ class Command(BaseCommand):
|
|||
self.permissive = kwargs.get('permissive')
|
||||
self.run_cook(recipe)
|
||||
if self.verbosity:
|
||||
print 'All steps executed successfully. Your environment should now be ready.'
|
||||
print('All steps executed successfully. Your environment should now be ready.')
|
||||
|
||||
def run_cook(self, filename):
|
||||
recipe = json.load(open(filename))
|
||||
|
@ -160,7 +162,7 @@ class Command(BaseCommand):
|
|||
user.set_password(password)
|
||||
user.save()
|
||||
if created and self.verbosity:
|
||||
print 'superuser account: %s / %s' % (username, password)
|
||||
print('superuser account: %s / %s' % (username, password))
|
||||
|
||||
def create_site(self, klass, base_url, title, slug, template_name, variables):
|
||||
if slug is None:
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import print_function
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from hobo.multitenant.middleware import TenantMiddleware
|
||||
from django.db import connection
|
||||
|
@ -12,8 +14,8 @@ class Command(BaseCommand):
|
|||
all_tenants = TenantMiddleware.get_tenants()
|
||||
for tenant in all_tenants:
|
||||
if verbosity >= 1:
|
||||
print
|
||||
print self.style.NOTICE("=== Creating schema ") \
|
||||
+ self.style.SQL_TABLE(tenant.schema_name)
|
||||
print()
|
||||
print(self.style.NOTICE("=== Creating schema ")
|
||||
+ self.style.SQL_TABLE(tenant.schema_name))
|
||||
|
||||
tenant.create_schema(check_if_exists=True)
|
||||
|
|
|
@ -35,7 +35,7 @@ class Command(BaseCommand):
|
|||
tenant_dir_tmp = os.path.join(
|
||||
tenant_base, hostname + '__CREATION_IN_PROGRESS.invalid')
|
||||
try:
|
||||
os.mkdir(tenant_dir_tmp, 0755)
|
||||
os.mkdir(tenant_dir_tmp, 0o755)
|
||||
except OSError as e:
|
||||
raise CommandError('cannot start tenant creation (%s)' % str(e))
|
||||
# tenant creation in database
|
||||
|
|
|
@ -219,4 +219,4 @@ MATOMO_SERVER = {}
|
|||
local_settings_file = os.environ.get('HOBO_SETTINGS_FILE',
|
||||
os.path.join(os.path.dirname(__file__), 'local_settings.py'))
|
||||
if os.path.exists(local_settings_file):
|
||||
execfile(local_settings_file)
|
||||
exec(open(local_settings_file).read())
|
||||
|
|
Loading…
Reference in New Issue