Merge pull request #1824 from ostcar/fix_tornado

Fix tornado
This commit is contained in:
Oskar Hahn 2016-01-10 01:03:16 +01:00
commit 87d647ac4d
5 changed files with 22 additions and 6 deletions

View File

@ -58,7 +58,6 @@ angular.module('OpenSlidesApp.core', [
}, },
reconnect: function () { reconnect: function () {
socket.close(); socket.close();
DS.clear();
Autoupdate.connect(); Autoupdate.connect();
} }
}; };

View File

@ -9,7 +9,8 @@ angular.module('OpenSlidesApp.users', [])
'Group', 'Group',
'loadGlobalData', 'loadGlobalData',
'autoupdate', 'autoupdate',
function (User, Group, loadGlobalData, autoupdate) { 'DS',
function (User, Group, loadGlobalData, autoupdate, DS) {
var operatorChangeCallbacks = [autoupdate.reconnect]; var operatorChangeCallbacks = [autoupdate.reconnect];
var operator = { var operator = {
user: null, user: null,
@ -35,6 +36,7 @@ angular.module('OpenSlidesApp.users', [])
} else { } else {
operator.user = null; operator.user = null;
operator.perms = []; operator.perms = [];
DS.clear();
_.forEach(operatorChangeCallbacks, function (callback) { _.forEach(operatorChangeCallbacks, function (callback) {
callback(); callback();
}); });

View File

@ -321,7 +321,9 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
label: gettextCatalog.getString('Groups'), label: gettextCatalog.getString('Groups'),
optionsAttr: 'bs-options', optionsAttr: 'bs-options',
options: Group.getAll(), options: Group.getAll(),
ngOptions: 'option[to.valueProp] as option in to.options | filter: $select.search', ngOptions: 'option[to.valueProp] as option in to.options | ' +
'filter: {id: "!1"} | filter: {id: "!2"} | ' +
'filter: $select.search',
valueProp: 'id', valueProp: 'id',
labelProp: 'name', labelProp: 'name',
placeholder: gettextCatalog.getString('Select or search a group ...') placeholder: gettextCatalog.getString('Select or search a group ...')

View File

@ -35,7 +35,7 @@
{{ (groups | filter: {id: group})[0].name }} {{ (groups | filter: {id: group})[0].name }}
</div> </div>
<label translate>About me</label> <label translate>About me</label>
<div class="white-space-pre-line">{{ user.about_me }}</div> <div class="white-space-pre-line" ng-bind-html="user.about_me"></div>
</fieldset> </fieldset>
<fieldset os-perms="users.can_manage"> <fieldset os-perms="users.can_manage">

View File

@ -21,6 +21,9 @@ from tornado.wsgi import WSGIContainer
from .rest_api import get_collection_and_id_from_url from .rest_api import get_collection_and_id_from_url
RUNNING_HOST = None
RUNNING_PORT = None
class DjangoStaticFileHandler(StaticFileHandler): class DjangoStaticFileHandler(StaticFileHandler):
""" """
@ -94,8 +97,9 @@ class OpenSlidesSockJSConnection(SockJSConnection):
object_url. object_url.
""" """
# Join network location with object URL. # Join network location with object URL.
# TODO: Use host and port as given in the start script wsgi_network_location = (
wsgi_network_location = settings.OPENSLIDES_WSGI_NETWORK_LOCATION or 'http://localhost:8000' settings.OPENSLIDES_WSGI_NETWORK_LOCATION or
'http://{}:{}'.format(RUNNING_HOST, RUNNING_PORT))
url = ''.join((wsgi_network_location, object_url)) url = ''.join((wsgi_network_location, object_url))
# Send out internal HTTP request to get data from the REST api. # Send out internal HTTP request to get data from the REST api.
@ -127,6 +131,11 @@ def run_tornado(addr, port, *args, **kwargs):
It runs in one thread. It runs in one thread.
""" """
# Save the port and the addr in a global var
global RUNNING_HOST, RUNNING_PORT
RUNNING_HOST = addr
RUNNING_PORT = port
# Don't try to read the command line args from openslides # Don't try to read the command line args from openslides
parse_command_line(args=[]) parse_command_line(args=[])
@ -147,6 +156,10 @@ def run_tornado(addr, port, *args, **kwargs):
server.listen(port=port, address=addr) server.listen(port=port, address=addr)
IOLoop.instance().start() IOLoop.instance().start()
# Reset the global vars
RUNNING_HOST = None
RUNNING_PORT = None
def inform_changed_data(*args): def inform_changed_data(*args):
""" """