本文整理汇总了Python中MaKaC.services.interface.rpc.json.decode函数的典型用法代码示例。如果您正苦于以下问题:Python decode函数的具体用法?Python decode怎么用?Python decode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了decode函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _mapFromParams
def _mapFromParams(self, params):
self.title = params.get("title", "").strip()
self._otherFields = {}
for f in self._afm.getFields():
fid = f.getId()
value = params.get("f_%s" % fid, "").strip()
self._otherFields[fid] = value
self.type = params.get("type", None)
self.tracks = normaliseListParam(params.get("tracks", []))
if self._displayValues:
# the call comes from modifying an existing abstract, we want to display the current content in the abstract form
self._prAuthorsListParam = params.get("prAuthors", [])
self._coAuthorsListParam = params.get("coAuthors", [])
self._setExistingAuthors()
else:
# the call comes from submitting a new abstract or modifying an existing abstract
from MaKaC.services.interface.rpc import json
self._prAuthorsListParam = json.decode(params.get("prAuthors", "[]"))
self._coAuthorsListParam = json.decode(params.get("coAuthors", "[]"))
self._setNewAuthors()
self.comments = params.get("comments", "")
self.origin = params.get("origin", "display")
self.files = normaliseListParam(params.get("file", []))
self.existingFiles = normaliseListParam(params.get("existingFile", []))
示例2: _getPersons
def _getPersons(self):
cpAvatars, cpNewUsers, cpEditedAvatars , auAvatars, auNewUsers, auEditedAvatars = [], [], [] , [] , [] , []
from MaKaC.services.interface.rpc import json
chairpersonDict = json.decode(self._params.get("chairperson", "")) or []
allowedUsersDict = json.decode(self._params.get("allowedUsers", "")) or []
if chairpersonDict:
cpAvatars, cpNewUsers, cpEditedAvatars = UserListModificationBase.retrieveUsers({"userList":chairpersonDict})
if allowedUsersDict :
auAvatars, auNewUsers, auEditedAvatars = UserListModificationBase.retrieveUsers({"userList":allowedUsersDict})
return cpAvatars, cpNewUsers, cpEditedAvatars, auAvatars
示例3: _getPersons
def _getPersons(self):
cpAvatars, cpNewUsers, auAvatars = [], [], []
from MaKaC.services.interface.rpc import json
chairpersonDict = json.decode(self._params.get("chairperson"))
allowedUsersDict = json.decode(self._params.get("allowedUsers"))
if chairpersonDict:
cpAvatars, cpNewUsers, cpEditedAvatars = UserListModificationBase.retrieveUsers({"userList":chairpersonDict})
if allowedUsersDict :
auAvatars, auNewUsers, auEditedAvatars = UserListModificationBase.retrieveUsers({"userList":allowedUsersDict})
#raise "avt: %s, newusers: %s, edited: %s"%(map(lambda x:x.getFullName(),avatars), newUsers, editedAvatars)
return cpAvatars, cpNewUsers, auAvatars
示例4: _checkParams_POST
def _checkParams_POST(self):
defaultArrivalOffset = [-2, 0]
defaultDepartureOffset = [1, 3]
post_pm = ParameterManager(decode(request.data))
self._arrivalOffsetDates = post_pm.extract(
'arrivalOffsetDates',
pType=list,
allowEmpty=False,
defaultValue=defaultArrivalOffset)
self._departureOffsetDates = post_pm.extract(
'departureOffsetDates',
pType=list,
allowEmpty=False,
defaultValue=defaultDepartureOffset)
self._items = post_pm.extract('items', pType=list, allowEmpty=False)
if (len(self._arrivalOffsetDates) != 2 or
self._arrivalOffsetDates[0] == '' or
self._arrivalOffsetDates[1] == ''):
self._arrivalOffsetDates = defaultArrivalOffset
if (len(self._departureOffsetDates) != 2 or
self._departureOffsetDates[0] == '' or
self._departureOffsetDates[1] == ''):
self._departureOffsetDates = defaultDepartureOffset
示例5: _getAllowedUsers
def _getAllowedUsers(self, params):
auAvatars = []
from MaKaC.services.interface.rpc import json
allowedUsersDict = json.decode(params.get("allowedUsers"))
if allowedUsersDict :
auAvatars, auNewUsers, auEditedAvatars = UserListModificationBase.retrieveUsers({"allowedUserList":allowedUsersDict}, "allowedUserList")
return auAvatars
示例6: _process
def _process(self):
params = self._getRequestParams()
from MaKaC.services.interface.rpc import json
presenters = json.decode(params.get("presenters", "[]"))
sc = self._target
"""self._target - contribution owning new subcontribution"""
if "ok" in params:
sc = self._target.newSubContribution()
sc.setTitle(params.get("title", ""))
sc.setDescription(params.get("description", ""))
sc.setKeywords(params.get("keywords", ""))
try:
durationHours = int(params.get("durationHours", ""))
except ValueError:
raise FormValuesError(_("Please specify a valid hour format (0-23)."))
try:
durationMinutes = int(params.get("durationMinutes", ""))
except ValueError:
raise FormValuesError(_("Please specify a valid minutes format (0-59)."))
sc.setDuration(durationHours, durationMinutes)
sc.setSpeakerText(params.get("speakers", ""))
sc.setParent(self._target)
for presenter in presenters:
spk = self._newSpeaker(presenter)
sc.newSpeaker(spk)
self._target.getConference().log(
EventLogRealm.management,
EventLogKind.positive,
u"Timetable",
u"Created new subcontribution: {}".format(to_unicode(sc.getTitle())),
session.user,
data=sc.getLogInfo(),
)
self._redirect(urlHandlers.UHContribModifSubCont.getURL(self._target))
else:
self._redirect(urlHandlers.UHContribModifSubCont.getURL(self._target))
示例7: _process
def _process(self):
params = self._getRequestParams()
from MaKaC.services.interface.rpc import json
presenters = json.decode(params.get("presenters", "[]"))
sc = self._target
"""self._target - contribution owning new subcontribution"""
if ("ok" in params):
sc = self._target.newSubContribution()
sc.setTitle( params.get("title", "") )
sc.setDescription( params.get("description", "") )
sc.setKeywords( params.get("keywords", "") )
try:
durationHours = int(params.get("durationHours",""))
except ValueError:
raise FormValuesError(_("Please specify a valid hour format (0-23)."))
try:
durationMinutes = int(params.get("durationMinutes",""))
except ValueError:
raise FormValuesError(_("Please specify a valid minutes format (0-59)."))
sc.setDuration( durationHours, durationMinutes )
sc.setSpeakerText( params.get("speakers", "") )
sc.setParent(self._target)
for presenter in presenters:
spk = self._newSpeaker(presenter)
sc.newSpeaker(spk)
logInfo = sc.getLogInfo()
logInfo["subject"] = "Created new subcontribution: %s" %sc.getTitle()
self._target.getConference().getLogHandler().logAction(logInfo,
log.ModuleNames.TIMETABLE)
self._redirect(urlHandlers.UHContribModifSubCont.getURL(self._target))
else:
self._redirect(urlHandlers.UHContribModifSubCont.getURL(self._target))