Skip to content
This repository has been archived by the owner on Sep 18, 2019. It is now read-only.

Commit

Permalink
Change import
Browse files Browse the repository at this point in the history
  • Loading branch information
grewn0uille committed Feb 14, 2018
1 parent a20c350 commit a0169a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
12 changes: 5 additions & 7 deletions sherlog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@

from urllib.parse import urlparse

from .sherlog import Sherlog
from .app import app


locale.setlocale(locale.LC_ALL, 'fr_FR')

app = Sherlog(__name__)
app.config.from_envvar('FLASK_CONFIG')

app.initialize()


@app.cli.command()
# @app.cli.command()
def drop_db():
filename = urlparse(app.config['DB']).path
if os.path.isfile(filename):
os.remove(filename)


app.cli.command()(drop_db)
6 changes: 3 additions & 3 deletions sherlog/log_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sherlog import model
from sherlog.model import Log


def get_config():
Expand All @@ -23,7 +23,7 @@ def get_session(config):


def convert_to_dict(data):
return eval(data[1:-2].replace('\n', ''))
return eval(data[1:-1].replace('\n', ''))


def get_name(data):
Expand Down Expand Up @@ -56,7 +56,7 @@ def insert_log(line, dbsession):
title = line.split('(')[0]
server_name = get_name(title)
desc = convert_to_dict(line.split(title)[1])
dbsession.add(model.Log(build_log(server_name, desc)))
dbsession.add(Log(build_log(server_name, desc)))


def read_log(logfile):
Expand Down

0 comments on commit a0169a6

Please sign in to comment.