Skip to content

Commit

Permalink
Changed route_prefix, updated journal parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
kroman0 committed Jan 5, 2015
1 parent 9598eec commit ce8f657
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/openprocurement/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,18 @@
JournalHandler = False

LOGGER = getLogger(__name__)
VERSION = int(pkg_resources.get_distribution(__package__).parsed_version[0])
#VERSION = int(pkg_resources.get_distribution(__package__).parsed_version[0])
VERSION = pkg_resources.get_distribution(__package__).version


def set_journal_handler(event):
params = {'PARAMS': str(dict(event.request.params))}
params = {
'TAGS': 'python,api',
'USER_ID': str(event.request.authenticated_userid),
'ROLE': str(event.request.authenticated_role),
}
if event.request.params:
params['PARAMS'] = str(dict(event.request.params))
if event.request.matchdict:
for i, j in event.request.matchdict.items():
params[i.upper()] = j
Expand Down Expand Up @@ -110,6 +117,7 @@ def main(global_config, **settings):
root_factory=factory,
authentication_policy=AuthenticationPolicy(settings['auth.file'], __name__),
authorization_policy=AuthorizationPolicy(),
route_prefix='/api/{}'.format(VERSION),
)
config.add_request_method(authenticated_role, reify=True)
config.add_renderer('prettyjson', JSON(indent=4))
Expand All @@ -121,7 +129,6 @@ def main(global_config, **settings):
config.add_subscriber(beforerender, BeforeRender)
config.include('pyramid_exclog')
config.include("cornice")
config.route_prefix = '/api/{}'.format(VERSION)
config.scan("openprocurement.api.views")

# CouchDB connection
Expand Down
2 changes: 1 addition & 1 deletion src/openprocurement/api/migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def set_db_schema_version(db, version):
def migrate_data(db, destination=None):
cur_version = get_db_schema_version(db)
if cur_version == SCHEMA_VERSION:
return set_db_schema_version(db, cur_version)
return cur_version
for step in xrange(cur_version, destination or SCHEMA_VERSION):
LOGGER.info("Migrate openprocurement schema from {} to {}".format(step, step + 1))
migration_func = globals().get('from{}to{}'.format(step, step + 1))
Expand Down

0 comments on commit ce8f657

Please sign in to comment.