import Queue import os.path import itertools from datetime import datetime import jinja2 import StringIO import sqlalchemy.types from nailgun.settings import settings from nailgun.api import models from sqlalchemy import orm from nailgun.db import db as ormgen from nailgun.logger import logger from nailgun.network.manager import NetworkManager db = ormgen() def capitalize_model_name(model_name): return ''.join(map(lambda s: s.capitalize(), model_name.split('_'))) def template_fixture(fileobj, config=None): if not config: config = settings t = jinja2.Template(fileobj.read()) return StringIO.StringIO(t.render(settings=config)) def upload_fixture(fileobj): db.expunge_all()
import json import os.path import Queue import StringIO import sys from sqlalchemy import orm import sqlalchemy.types from nailgun.api import models from nailgun.db import db as ormgen from nailgun.logger import logger from nailgun.network.manager import NetworkManager from nailgun.settings import settings db = ormgen() def capitalize_model_name(model_name): return ''.join(map(lambda s: s.capitalize(), model_name.split('_'))) def template_fixture(fileobj, **kwargs): if not kwargs.get('settings'): kwargs["settings"] = settings t = jinja2.Template(fileobj.read()) return StringIO.StringIO(t.render(**kwargs)) def upload_fixture(fileobj): db.expunge_all()