Example #1
0
def includeme(config):
    """
    Include as a pyramid application add-on
    """
    settings = config.registry.settings
    engine = engine_from_config(settings, 'roster.db.')
    config.registry['dbsession_factory'].configure(binds={
        models.Site: engine,
        models.Identifier: engine
    })
    log.debug('Roster connected to: "%s"' % obfuscate_url_pw(engine.url))
Example #2
0
    def display_version(rev, context):
        try:
            url = util.obfuscate_url_pw(context.connection.engine.url)
        except AttributeError:
            url = None
        if url:
            print "Current revision for %s: %s" % (
                                url,
                                script.get_revision(rev))
        else:
            print "Current revision: %s" % script.get_revision(rev)

        return []
Example #3
0
    def display_version(rev, context):
        rev = script.get_revision(rev)

        if head_only:
            config.print_stdout("%s%s" % (
                rev.revision if rev else None,
                " (head)" if rev and rev.is_head else ""))

        else:
            config.print_stdout("Current revision for %s: %s",
                                util.obfuscate_url_pw(
                                    context.connection.engine.url),
                                rev)
        return []
Example #4
0
 def test_current_obfuscate_password(self):
     eq_(
         util.obfuscate_url_pw("postgresql://*****:*****@localhost/test"),
         "postgresql://*****:*****@localhost/test",
     )
Example #5
0
 def display_version(rev, context):
     print "Current revision for %s: %s" % (
                         util.obfuscate_url_pw(
                             context.connection.engine.url),
                         script.get_revision(rev))
     return []