Make all imports relative

This commit is contained in:
Alexis Métaireau 2017-06-21 02:48:07 +02:00
parent db29648956
commit 774e00d509
8 changed files with 30 additions and 23 deletions

View file

@ -2,9 +2,9 @@
from flask import Blueprint, request from flask import Blueprint, request
from flask_rest import RESTResource, need_auth from flask_rest import RESTResource, need_auth
from models import db, Project, Person, Bill from .models import db, Project, Person, Bill
from forms import (ProjectForm, EditProjectForm, MemberForm, from .forms import (ProjectForm, EditProjectForm, MemberForm,
get_billform_for) get_billform_for)
api = Blueprint("api", __name__, url_prefix="/api") api = Blueprint("api", __name__, url_prefix="/api")

View file

@ -7,10 +7,11 @@ from flask_babel import lazy_gettext as _
from flask import request from flask import request
from wtforms.widgets import html_params from wtforms.widgets import html_params
from models import Project, Person
from datetime import datetime from datetime import datetime
from jinja2 import Markup from jinja2 import Markup
from utils import slugify
from .models import Project, Person
from .utils import slugify
def get_billform_for(project, set_default=True, **kwargs): def get_billform_for(project, set_default=True, **kwargs):
"""Return an instance of BillForm configured for a particular project. """Return an instance of BillForm configured for a particular project.

View file

@ -3,14 +3,16 @@
from flask_script import Manager from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand from flask_migrate import Migrate, MigrateCommand
from run import app from .run import app
from models import db from .models import db
migrate = Migrate(app, db) migrate = Migrate(app, db)
manager = Manager(app) manager = Manager(app)
manager.add_command('db', MigrateCommand) manager.add_command('db', MigrateCommand)
def main():
manager.run()
if __name__ == '__main__': if __name__ == '__main__':
manager.run() main()

View file

@ -7,10 +7,10 @@ from flask_babel import Babel
from flask_migrate import Migrate, upgrade, stamp from flask_migrate import Migrate, upgrade, stamp
from raven.contrib.flask import Sentry from raven.contrib.flask import Sentry
from web import main, db, mail from .web import main, db, mail
from api import api from .api import api
from utils import PrefixedWSGI from .utils import PrefixedWSGI
from utils import minimal_round from .utils import minimal_round
app = Flask(__name__, instance_path='/etc/ihatemoney', instance_relative_config=True) app = Flask(__name__, instance_path='/etc/ihatemoney', instance_relative_config=True)

View file

@ -16,9 +16,9 @@ from flask import session
if 'IHATEMONEY_SETTINGS_FILE_PATH' in os.environ: if 'IHATEMONEY_SETTINGS_FILE_PATH' in os.environ:
del os.environ['IHATEMONEY_SETTINGS_FILE_PATH'] del os.environ['IHATEMONEY_SETTINGS_FILE_PATH']
import run from .. import run
import models from .. import models
import utils from .. import utils
__HERE__ = os.path.dirname(os.path.abspath(__file__)) __HERE__ = os.path.dirname(os.path.abspath(__file__))

View file

@ -9,8 +9,10 @@ some shortcuts to make your life better when coding (see `pull_project`
and `add_project_id` for a quick overview) and `add_project_id` for a quick overview)
""" """
from flask import Blueprint, current_app, flash, g, redirect, \ from flask import (
render_template, request, session, url_for, send_file Blueprint, current_app, flash, g, redirect, render_template, request,
session, url_for, send_file
)
from flask_mail import Mail, Message from flask_mail import Mail, Message
from flask_babel import get_locale, gettext as _ from flask_babel import get_locale, gettext as _
from smtplib import SMTPRecipientsRefused from smtplib import SMTPRecipientsRefused
@ -18,12 +20,13 @@ import werkzeug
from sqlalchemy import orm from sqlalchemy import orm
from functools import wraps from functools import wraps
# local modules from .models import db, Project, Person, Bill
from models import db, Project, Person, Bill from .forms import (
from forms import AdminAuthenticationForm, AuthenticationForm, EditProjectForm, \ AdminAuthenticationForm, AuthenticationForm, EditProjectForm,
InviteForm, MemberForm, PasswordReminder, ProjectForm, get_billform_for, \ InviteForm, MemberForm, PasswordReminder, ProjectForm, get_billform_for,
ExportForm ExportForm
from utils import Redirect303, list_of_dicts2json, list_of_dicts2csv )
from .utils import Redirect303, list_of_dicts2json, list_of_dicts2csv
main = Blueprint("main", __name__) main = Blueprint("main", __name__)
mail = Mail() mail = Mail()

View file

@ -1,2 +1,3 @@
zest.releaser zest.releaser
tox tox
pytest

View file

@ -6,7 +6,7 @@ skip_missing_interpreters = True
commands = commands =
python --version python --version
python -m unittest discover -s budget py.test budget/tests/tests.py
deps = deps =
-rdev-requirements.txt -rdev-requirements.txt
-rrequirements.txt -rrequirements.txt