Continue to port GMG codebase.
This commit is contained in:
parent
74e77c3688
commit
7f342c72f6
@ -1,3 +1,10 @@
|
||||
import sys
|
||||
|
||||
PY3 = sys.version_info[0] >= 3
|
||||
from six import PY3, iteritems
|
||||
|
||||
if PY3:
|
||||
from email.mime.text import MIMEText
|
||||
from urllib import parse as urlparse
|
||||
else:
|
||||
from email.MIMEText import MIMEText
|
||||
import urlparse
|
||||
|
@ -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 unicode_literals
|
||||
|
||||
from mediagoblin.tools.common import simple_printer
|
||||
from sqlalchemy import Table
|
||||
from sqlalchemy.sql import select
|
||||
@ -39,7 +41,7 @@ class MigrationManager(object):
|
||||
- migration_registry: where we should find all migrations to
|
||||
run
|
||||
"""
|
||||
self.name = unicode(name)
|
||||
self.name = name
|
||||
self.models = models
|
||||
self.foundations = foundations
|
||||
self.session = session
|
||||
|
@ -20,6 +20,7 @@ import logging
|
||||
|
||||
from mediagoblin.db.base import Base, Session
|
||||
from mediagoblin import mg_globals
|
||||
from mediagoblin._compat import iteritems
|
||||
|
||||
_log = logging.getLogger(__name__)
|
||||
|
||||
@ -28,7 +29,7 @@ class DatabaseMaster(object):
|
||||
def __init__(self, engine):
|
||||
self.engine = engine
|
||||
|
||||
for k, v in Base._decl_class_registry.iteritems():
|
||||
for k, v in iteritems(Base._decl_class_registry):
|
||||
setattr(self, k, v)
|
||||
|
||||
def commit(self):
|
||||
|
@ -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
|
||||
|
||||
try:
|
||||
from PIL import Image
|
||||
except ImportError:
|
||||
@ -381,5 +383,4 @@ if __name__ == '__main__':
|
||||
clean = clean_exif(result)
|
||||
useful = get_useful(clean)
|
||||
|
||||
print pp.pprint(
|
||||
clean)
|
||||
print(pp.pprint(clean))
|
||||
|
@ -138,7 +138,7 @@ def is_unoconv_working():
|
||||
try:
|
||||
proc = Popen([unoconv, '--show'], stderr=PIPE)
|
||||
output = proc.stderr.read()
|
||||
except OSError, e:
|
||||
except OSError:
|
||||
_log.warn(_('unoconv failing to run, check log file'))
|
||||
return False
|
||||
if 'ERROR' in output:
|
||||
|
@ -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 absolute_import
|
||||
|
||||
import shutil
|
||||
import uuid
|
||||
|
||||
@ -268,4 +270,4 @@ def storage_system_from_config(config_section):
|
||||
storage_class = common.import_component(storage_class)
|
||||
return storage_class(**config_params)
|
||||
|
||||
import filestorage
|
||||
from . import filestorage
|
||||
|
@ -21,7 +21,8 @@ from mediagoblin.storage import (
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import urlparse
|
||||
|
||||
from mediagoblin._compat import urlparse
|
||||
|
||||
|
||||
class BasicFileStorage(StorageInterface):
|
||||
|
@ -52,7 +52,7 @@ def load_key(filename):
|
||||
|
||||
def create_key(key_dir, key_filepath):
|
||||
global __itsda_secret
|
||||
old_umask = os.umask(077)
|
||||
old_umask = os.umask(0o77)
|
||||
key_file = None
|
||||
try:
|
||||
if not os.path.isdir(key_dir):
|
||||
@ -80,7 +80,7 @@ def setup_crypto():
|
||||
key_filepath = os.path.join(key_dir, 'itsdangeroussecret.bin')
|
||||
try:
|
||||
load_key(key_filepath)
|
||||
except IOError, error:
|
||||
except IOError as error:
|
||||
if error.errno != errno.ENOENT:
|
||||
raise
|
||||
create_key(key_dir, key_filepath)
|
||||
|
@ -14,9 +14,11 @@
|
||||
# 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, unicode_literals
|
||||
|
||||
import smtplib
|
||||
from email.MIMEText import MIMEText
|
||||
from mediagoblin import mg_globals, messages
|
||||
from mediagoblin._compat import MIMEText
|
||||
from mediagoblin.tools import common
|
||||
|
||||
### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@ -119,12 +121,12 @@ def send_email(from_addr, to_addrs, subject, message_body):
|
||||
EMAIL_TEST_INBOX.append(message)
|
||||
|
||||
elif mg_globals.app_config['email_debug_mode']:
|
||||
print u"===== Email ====="
|
||||
print u"From address: %s" % message['From']
|
||||
print u"To addresses: %s" % message['To']
|
||||
print u"Subject: %s" % message['Subject']
|
||||
print u"-- Body: --"
|
||||
print message.get_payload(decode=True)
|
||||
print("===== Email =====")
|
||||
print("From address: %s" % message['From'])
|
||||
print("To addresses: %s" % message['To'])
|
||||
print("Subject: %s" % message['Subject'])
|
||||
print("-- Body: --")
|
||||
print(message.get_payload(decode=True))
|
||||
|
||||
return mhost.sendmail(from_addr, to_addrs, message.as_string())
|
||||
|
||||
@ -151,5 +153,5 @@ def email_debug_message(request):
|
||||
if mg_globals.app_config['email_debug_mode']:
|
||||
# DEBUG message, no need to translate
|
||||
messages.add_message(request, messages.DEBUG,
|
||||
u"This instance is running in email debug mode. "
|
||||
u"The email will be on the console of the server process.")
|
||||
"This instance is running in email debug mode. "
|
||||
"The email will be on the console of the server process.")
|
||||
|
Loading…
x
Reference in New Issue
Block a user