Skip to content

Commit

Permalink
service.legacy: log messages + trivial fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
deeenes committed Jan 28, 2025
1 parent 9fd946d commit 209135d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions omnipath_server/server/_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from sanic import Sanic, Request, response

from .. import _log
from ..service import LegacyService

__all__ = [
Expand All @@ -24,6 +25,7 @@

def create_server(**kwargs):

_log('Creating new legacy server...')
legacy_server = Sanic('LegacyServer')
legacy_server.ctx.service = LegacyService(**kwargs)

Expand All @@ -42,4 +44,6 @@ async def legacy_handler(request: Request, path: str):
return response.text(f'No such path: {path}', status = 404)


_log('Legacy server ready.')

return legacy_server
1 change: 1 addition & 0 deletions omnipath_server/server/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

DOMAINS = {
'legacy': ('next.omnipathdb.org', 'omnipathdb.org'),
'metabo': ('metabo.omnipathdb.org'),
}

SERVERS = {}
Expand Down
6 changes: 4 additions & 2 deletions omnipath_server/service/_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,8 @@ def __init__(

# _log(f'{self.__class__.__name__} startup ready.')

self._connect(con)


def _connect(
self,
Expand All @@ -783,7 +785,7 @@ def _connect(
override = con.get(param, None),
default = default,
)
for param, default in _connection.DEFAULTS
for param, default in _connection.DEFAULTS.items()
}

self.con = _connection.ensure_con(con)
Expand Down Expand Up @@ -1366,7 +1368,7 @@ def _where(self, query: Query, args: dict, param: dict) -> Query:

value = self._parse_arg(value)
col, *op = _misc.to_tuple(col_op)
col = query.statment.columns[col]
col = query.statement.columns[col]
op = self._where_op(op, col, value)
where_expr = getattr(col, op)(value)
query = query.filter(where_expr)
Expand Down

0 comments on commit 209135d

Please sign in to comment.