import py4web from py4web import __version__, action, abort, request, response, redirect, Translator, HTTP from py4web.core import Reloader, dumps, ErrorStorage, Session, Fixture from py4web.utils.factories import ActionFactory from pydal.validators import CRYPT from yatl.helpers import BEAUTIFY from .utils import * from .diff2kryten import diff2kryten MODE = os.environ.get("PY4WEB_DASHBOARD_MODE", "none") FOLDER = os.environ["PY4WEB_APPS_FOLDER"] APP_FOLDER = os.path.dirname(__file__) T_FOLDER = os.path.join(APP_FOLDER, "translations") T = Translator(T_FOLDER) error_storage = ErrorStorage() db = error_storage.db session = Session() def run(command, project): """for runing git commands inside an app (project)""" return subprocess.check_output( command.split(), cwd=os.path.join(FOLDER, project) ).decode() def get_commits(project): """list of git commits for the project""" output = run("git log", project) commits = []
def error_ticket(ticket_uuid): return dict(ticket=ErrorStorage().get(ticket_uuid=ticket_uuid))