1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

Some minor fixes & aditions to "Storage"\nFixed EditList to correctly show tooltip

This commit is contained in:
Adolfo Gómez García 2015-06-02 22:13:55 +02:00
parent 524e234e6d
commit 399fc901fc
4 changed files with 33 additions and 9 deletions

View File

@ -132,7 +132,7 @@ class Actor(Handler):
raise RequestError('Invalid request')
try:
return Actor.result(TicketStore.get(self._args[1], invalidate=False)) # TODO: Remove False after development
return Actor.result(TicketStore.get(self._args[1], invalidate=True))
except Exception:
return Actor.result({})
@ -201,8 +201,12 @@ class Actor(Handler):
logger.debug('Setting comms url to {}'.format(data))
service.setCommsUrl(data)
return Actor.result('ok')
elif message == 'version':
version = self._params.get('version', 'unknown')
logger.debug('Got notified version {}'.format(version))
service.setProperty('actor_version', version)
# Preprocess some messages, common to all clients, such as "log"
# "Cook" some messages, common to all clients, such as "log"
if message == 'log':
logger.debug(self._params)
data = '\t'.join((self._params.get('message'), six.text_type(self._params.get('level', 10000))))

View File

@ -101,6 +101,12 @@ class Storage(object):
v = cPickle.loads(v)
return v
def getPickleByAttr1(self, attr1):
try:
return cPickle.loads(dbStorage.objects.get(owner=self._owner, attr1=attr1).data.decode(Storage.CODEC)) # @UndefinedVariable
except Exception:
return None
def remove(self, skey):
try:
key = self.__getKey(skey)
@ -122,10 +128,24 @@ class Storage(object):
def locateByAttr1(self, attr1):
res = []
for v in dbStorage.objects.filter(attr1=attr1): # @UndefinedVariable
if isinstance(attr1, (list, tuple)):
query = dbStorage.objects.filter(owner=self._owner, attr1_in=attr1) # @UndefinedVariable
else:
query = dbStorage.objects.filter(owner=self._owner, attr1=attr1) # @UndefinedVariable
for v in query:
res.append(v.data.decode(Storage.CODEC))
return res
def filterPickle(self, attr1=None):
if attr1 is None:
query = dbStorage.objects.filter(owner=self._owner) # @UndefinedVariable
else:
query = dbStorage.objects.filter(owner=self._owner, attr1=attr1) # @UndefinedVariable
for v in query: # @UndefinedVariable
yield (v.key, cPickle.loads(v.data.decode(Storage.CODEC)), v.attr1)
@staticmethod
def delete(owner=None):
logger.info("Deleting storage items")

View File

@ -32,15 +32,15 @@
'''
from __future__ import unicode_literals
__updated__ = '2014-04-24'
from django.db import models
from uds.core.db.LockingManager import LockingManager
import logging
__updated__ = '2015-06-01'
logger = logging.getLogger(__name__)
@ -63,5 +63,5 @@ class Storage(models.Model):
app_label = 'uds'
def __unicode__(self):
return u"{0} {1} = {2}, {3}".format(self.owner, self.key, self.data, str.join('/', [self.attr1]))
return u"{0} {1} = {2}, {3}".format(self.owner, self.key, self.data, '/'.join([self.attr1]))

View File

@ -18,7 +18,7 @@
var idHidden = '#' + id + 'hdn';
$(idTxt).tooltip({
placement: 'bottom',
title: "{% trans 'Click to edit list' %}",
title: "{% endverbatim %}{% trans 'Click to edit list' %}{% verbatim %}",
delay: { show: 500, hide: 100 },
});
$(idTxt).click(function(){