1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-03 01:17:56 +03:00

* Added Python 3 unicode to UserService

* Fixed user service to ignore empty forms (forms without extra fields)
* Updated service provider to unicode for Physical Machines
This commit is contained in:
Adolfo Gómez 2013-04-25 04:49:30 +00:00
parent 1785507b88
commit bb6929d9c8
2 changed files with 10 additions and 22 deletions

View File

@ -30,6 +30,7 @@
'''
.. moduleauthor:: Adolfo Gómez, dkmaster at dkmon dot com
'''
from __future__ import unicode_literals
from django.utils.translation import ugettext as _
import cPickle
@ -782,7 +783,11 @@ class UserInterface(object):
continue
self._gui[k].value = self._gui[k].defValue
for txt in values.decode('zip').split('\002'):
values = values.decode('zip')
if values == '': # Has nothing
return
for txt in values.split('\002'):
k, v = txt.split('\003')
if self._gui.has_key(k):
try:
@ -795,7 +800,8 @@ class UserInterface(object):
self._gui[k].value = val
#logger.debug('Value for {0}:{1}'.format(k, val))
except:
logger.info('Seralized data invalid: {0}'.format(values))
# Values can contain invalid characters, so we log every single char
logger.info('Invalid serialization data on {0} {1}'.format(self, values.encode('hex')))
@classmethod
def guiDescription(cls, obj = None):

View File

@ -48,23 +48,5 @@ class PhysicalMachinesProvider(services.ServiceProvider):
from IPMachinesService import IPMachinesService
offers = [IPMachinesService]
def __init__(self, environment, values = None):
'''
Initializes the Physical Machines Service Provider
@param values: a dictionary with the required values, that are the ones declared for gui
'''
super(PhysicalMachinesProvider, self).__init__(environment, values)
def marshal(self):
'''
Serializes the service provider data so we can store it in database
'''
return str.join( '\t', [ 'v1' ] )
def unmarshal(self, str_):
data = str_.split('\t')
if data[0] == 'v1':
pass
def __str__(self):
return "Physical Machines Provider: " + self.marshal()
def __unicode__(self):
return "Physical Machines Provider"