Commit 13de3916 authored by Marco Mariani's avatar Marco Mariani

pyflakes compliance

parent 5f2a733a
# -*- coding: utf-8 -*-
# vim: set et sts=2:
from optparse import OptionParser, Option
import ConfigParser
import datetime
import logging
import logging.handlers
from optparse import OptionParser, Option
import os
import sys
import subprocess
from datetime import timedelta
class Parser(OptionParser):
"""
......@@ -124,7 +124,7 @@ def serve(config):
instance_profile='instance.cfg',
software_profile='software.cfg',
SECRET_KEY=os.urandom(24),
PERMANENT_SESSION_LIFETIME=timedelta(days=31),
PERMANENT_SESSION_LIFETIME=datetime.timedelta(days=31),
)
if not os.path.exists(workdir):
os.mkdir(workdir)
......
# -*- coding: utf-8 -*-
# vim: set et sts=2:
import os
import urllib
from flask import jsonify
from werkzeug import secure_filename
import shutil
import datetime
import hashlib
from utils import realpath, tail, isText
import os
import re
import shutil
import urllib
import zipfile
import werkzeug
from slapos.runner.utils import realpath, tail, isText
class fileBrowser(object):
"""This class contain all bases function for file browser"""
......@@ -164,7 +165,7 @@ class fileBrowser(object):
raise NameError('Could not load directory %s: Permission denied' % dir)
for file in files:
if files[file]:
filename = secure_filename(files[file].filename)
filename = werkzeug.secure_filename(files[file].filename)
if not os.path.exists(os.path.join(dir, filename)):
files[file].save(os.path.join(realdir, filename))
return '{result: \'1\'}'
......
# -*- coding: utf-8 -*-
# vim: set et sts=2:
import subprocess
import os
import re
from flask import jsonify
import shutil
import subprocess
from git import Repo
from flask import jsonify
class Popen(subprocess.Popen):
def __init__(self, *args, **kwargs):
......
# -*- coding: utf-8 -*-
# vim: set et sts=2:
import os
import sys
import views
import unittest
import tempfile
from optparse import OptionParser, Option
import ConfigParser
import shutil
from gittools import cloneRepo, gitStatus, switchBranch, addBranch, getDiff, \
gitPush, gitPull
from flaskext.auth import Auth, AuthUser, login_required, logout
from utils import *
import datetime
import json
from datetime import timedelta
import os
import shutil
import unittest
from slapos.runner.utils import (getProfilePath, getSession, isInstanceRunning, isSoftwareRunning, readPid,
recursifKill, startProxy)
from slapos.runner import views
class Config:
def setConfig(self):
......@@ -64,7 +61,7 @@ class SlaprunnerTestCase(unittest.TestCase):
instance_profile='instance.cfg',
software_profile='software.cfg',
SECRET_KEY="123456",
PERMANENT_SESSION_LIFETIME=timedelta(days=31),
PERMANENT_SESSION_LIFETIME=datetime.timedelta(days=31),
)
self.app = views.app.test_client()
self.app.config = views.app.config
......@@ -106,16 +103,7 @@ class SlaprunnerTestCase(unittest.TestCase):
return json.loads(response.data)
def configAccount(self, username, password, email, name, rcode):
"""Helper for configAccoun"""
return self.app.post('/configAccount', data=dict(
username=username,
password=password,
email=email,
name=name,
rcode=rcode
), follow_redirects=True)
def configAccount(self, username, password, email, name, rcode):
"""Helper for configAccoun"""
"""Helper for configAccount"""
return self.app.post('/configAccount', data=dict(
username=username,
password=password,
......
# -*- coding: utf-8 -*-
# vim: set et sts=2:
import slapos.slap
import time
import subprocess
import os
from xml_marshaller import xml_marshaller
from xml.dom import minidom
import hashlib
import logging
import multiprocessing
import re
import urllib
from flask import jsonify
import signal
import shutil
import string
import hashlib
import signal
import multiprocessing
import os
import subprocess
import time
import urllib
import xml.dom
import xml_marshaller
from flask import jsonify
import slapos.slap
# Setup default flask (werkzeug) parser
import logging
logger = logging.getLogger('werkzeug')
......@@ -170,7 +173,7 @@ def updateProxy(config):
'reference': partition_reference,
'tap': {'name': partition_reference},
})
computer.updateConfiguration(xml_marshaller.dumps(slap_config))
computer.updateConfiguration(xml_marshaller.xml_marshaller.dumps(slap_config))
return True
def readPid(file):
......@@ -801,7 +804,7 @@ def readParameters(path):
a dictionnary of instance parameters."""
if os.path.exists(path):
try:
xmldoc = minidom.parse(path)
xmldoc = xml.dom.minidom.parse(path)
object = {}
for elt in xmldoc.childNodes:
sub_object = {}
......
# -*- coding: utf-8 -*-
# vim: set et sts=2:
from flask import Flask, request, redirect, url_for, \
render_template, g, flash, jsonify, session, abort, send_file
from utils import *
import os
import shutil
import md5
from gittools import cloneRepo, gitStatus, switchBranch, addBranch, getDiff, \
gitPush, gitPull
from flaskext.auth import Auth, AuthUser, login_required, logout
from fileBrowser import fileBrowser
import urllib
from flaskext.auth import Auth, AuthUser, login_required, logout
from flask import (Flask, request, redirect, url_for, render_template,
g, flash, jsonify, session, abort, send_file)
from slapos.runner.utils import (checkSoftwareFolder, configNewSR, getFolder, getFolderContent, getProfilePath,
getProjectList, getProjectTitle, getSession, getSlapStatus, getSvcStatus,
getSvcTailProcess, isInstanceRunning, isSoftwareRunning, isText, killRunningProcess,
loadSoftwareRList, md5sum, newSoftware, readFileFrom, readParameters, realpath,
removeInstanceRoot, removeProxyDb, removeSoftwareByName, runInstanceWithLock,
runSoftwareWithLock, saveSession, svcStartStopProcess, svcStopAll, tail,
updateInstanceParameter)
from slapos.runner.fileBrowser import fileBrowser
from slapos.runner.gittools import (cloneRepo, gitStatus, switchBranch, addBranch, getDiff,
gitPush, gitPull)
app = Flask(__name__)
app.config['MAX_CONTENT_LENGTH'] = 20 * 1024 * 1024
auth = Auth(app, login_url_name='login')
......@@ -430,7 +438,7 @@ def getPath():
break
else:
list.append(path)
realfile = string.join(list, "#")
realfile = '#'.join(list)
if not realfile:
return jsonify(code=0, result="Can not access to this file: Permission Denied!")
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment