Commit 9ab6aa76 authored by Etienne Allovon's avatar Etienne Allovon

Merge branch...

Merge branch '2406-Confgend-can-not-generate-configuration-due-to-sqlalchemy-changes-for-security-purposes' into '2017.03'

2406 confgend can not generate configuration due to sqlalchemy changes for security purposes

See merge request !45
parents ff99448c 893e753a
from debian:jessie
FROM debian:jessie
# See https://github.com/debuerreotype/docker-debian-artifacts/issues/66
RUN sed -i '/jessie-updates/d' /etc/apt/sources.list # Now archived
RUN apt-get -yqq update \
&& apt-get -yqq install python-pip \
......@@ -12,4 +15,12 @@ WORKDIR /usr/src/dao
RUN pip install -r requirements.txt
RUN pip install -r test-requirements.txt
# Special trick to install Debian version of sqlalchemy for the tests:
# - sqlalchemy is kept in requirements for developments (for IDEs)
# - but then we force installation of sqlalchemy from debian repo
# This should install package version 0.9.8+dfsg-0.1+deb8u1
RUN pip uninstall -y sqlalchemy
RUN apt-get update \
&& apt-get -yqq install python-sqlalchemy
CMD nosetests xivo_dao
xivo-dao (2017.03.19) xivo-five; urgency=medium
* Fix incompatibility with security patch of SQLAlechemy
-- Jirka HLAVACEK <jhlavacek@avencall.com> Mon, 25 Mar 2019 13:21:17 +0100
xivo-dao (2017.03.09) xivo-dev; urgency=medium
* Fix return value on get user id from channel when protocol is not sip or return value is not int
......
db:
image: postgres
image: postgres:9.4
expose:
- "5432"
environment:
......
......@@ -17,6 +17,7 @@
from collections import defaultdict
from sqlalchemy.sql import text
from sqlalchemy.sql.expression import and_, or_, literal, cast, func
from sqlalchemy.types import Integer
......@@ -285,7 +286,7 @@ def find_exten_conferences_settings(session, context_name):
def find_exten_xivofeatures_setting(session):
rows = (session.query(Extension)
.filter(and_(Extension.context == 'xivo-features',
Extension.commented == 0)).order_by('exten')
Extension.commented == 0)).order_by(text('exten'))
.all())
return [row.todict() for row in rows]
......@@ -298,7 +299,7 @@ def find_extenfeatures_settings(session, features=None):
query = (session.query(Extension)
.filter(and_(Extension.context == 'xivo-features',
Extension.type == 'extenfeatures'))
.order_by('exten'))
.order_by(text('exten')))
if features:
query = query.filter(Extension.typeval.in_(features))
......@@ -317,7 +318,7 @@ def find_exten_settings(session, context_name):
Extension.commented == 0,
or_(UserLine.line_id == None,
LineFeatures.commented == 0)))
.order_by('exten')
.order_by(text('exten'))
.all())
return [row.todict() for row in rows]
......@@ -325,14 +326,14 @@ def find_exten_settings(session, context_name):
@daosession
def find_context_settings(session):
rows = session.query(Context).filter(Context.commented == 0).order_by('name').all()
rows = session.query(Context).filter(Context.commented == 0).order_by(text('name')).all()
return [row.todict() for row in rows]
@daosession
def find_contextincludes_settings(session, context_name):
rows = session.query(ContextInclude).filter(ContextInclude.context == context_name).order_by('priority').all()
rows = session.query(ContextInclude).filter(ContextInclude.context == context_name).order_by(text('priority')).all()
return [row.todict() for row in rows]
......@@ -545,7 +546,7 @@ def find_meetme_rooms_settings(session):
@daosession
def find_musiconhold_settings(session):
rows = session.query(MusicOnHold).filter(MusicOnHold.commented == 0).order_by('category').all()
rows = session.query(MusicOnHold).filter(MusicOnHold.commented == 0).order_by(text('category')).all()
return [row.todict() for row in rows]
......@@ -560,7 +561,7 @@ def find_queue_general_settings(session):
@daosession
def find_queue_settings(session):
rows = session.query(Queue).filter(Queue.commented == 0).order_by('name').all()
rows = session.query(Queue).filter(Queue.commented == 0).order_by(text('name')).all()
return [row.todict() for row in rows]
......
......@@ -18,6 +18,7 @@
from xivo_dao.alchemy.stat_call_on_queue import StatCallOnQueue
from xivo_dao import stat_queue_dao
from sqlalchemy import func, between, literal
from sqlalchemy.sql import text
from sqlalchemy.sql.expression import extract, cast
from sqlalchemy.types import Integer
from datetime import timedelta
......@@ -80,7 +81,7 @@ def _get_periodic_stat_by_step(session, start, end, step):
StatCallOnQueue.queue_id,
StatCallOnQueue.status,
func.count(StatCallOnQueue.status))
.group_by('the_time',
.group_by(text('the_time'),
StatCallOnQueue.queue_id,
StatCallOnQueue.status)
.filter(between(StatCallOnQueue.time, start, end)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment