New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a 'bootstrap' importer to CementApp #126

Closed
derks opened this Issue Jul 5, 2012 · 1 comment

Comments

Projects
None yet
1 participant
@derks
Member

derks commented Jul 5, 2012

It is common to do something like:

from cement.core import foundation

app = foundation.CementApp('myapp')
try:
   import myapp.bootstrap.base
   app.setup()
   app.run()
finally:
   app.close()

It testing it gets annoying to have to import that bootstrap, which the CementApp() likely requires to function. Having a bootstrap mechanizm built in would be good:

app = foundation.CementApp('myapp', bootstrap='myapp.bootstrap.base')
...

The alternative is that you could also subclass CementApp.setup() to do the bootstrap... but there is less control over where/how a user would implement that.

@ghost ghost assigned derks Jul 5, 2012

@derks

This comment has been minimized.

Show comment
Hide comment
@derks

derks Jul 5, 2012

Member

currently I do somehting like this:

def setup(self):
        if 'boss.cli.bootstrap.base' in sys.modules:
            reload(boss.cli.bootstrap.base)
        else:
            import boss.cli.bootstrap.base
        super(BossApp, self).setup()
Member

derks commented Jul 5, 2012

currently I do somehting like this:

def setup(self):
        if 'boss.cli.bootstrap.base' in sys.modules:
            reload(boss.cli.bootstrap.base)
        else:
            import boss.cli.bootstrap.base
        super(BossApp, self).setup()

derks pushed a commit that referenced this issue Jul 13, 2012

@derks derks closed this Jul 13, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment