Author: remi
Date: 2009-04-24 19:17:04 +0200 (Fri, 24 Apr 2009)
New Revision: 4593
Modified:
softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/attitunes/Attitune.py
softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/gadgets/Gadget.py
softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/scheduler/Task.py
softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/scheduler/TaskDescription.py
Log:
* updated the api according to the scheduler update
Modified:
softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/attitunes/Attitune.py
===================================================================
---
softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/attitunes/Attitune.py
2009-04-24 17:16:03 UTC (rev 4592)
+++
softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/attitunes/Attitune.py
2009-04-24 17:17:04 UTC (rev 4593)
@@ -97,13 +97,14 @@
"""
cmd = "attitune_manager/stop_attitune?"
return self._sendCommandBooleanResult(cmd)
-
+
#
--------------------------------------------------------------------------
# Schedule the start command of this attitune.
#
--------------------------------------------------------------------------
def scheduleStart(self, type = "ONCE DELAYED", name = None,
- weekMask = [True, True, True, True, True, True, True], date = None,
- time = "00:00:10"):
+ weekMask = [True, True, True, True, True, True, True],
+ date = "0000/00/00", hoursBegin = "00:00:00" , hoursEnd = "23:59:59",
+ delay = "00:01:00"):
"""Schedule the start command of this attitune.
@param type: <EVERY X|EVERY X FROM FULL HOUR|DAILY AT|ONCE AT|
ONCE DELAYED>
@@ -113,15 +114,19 @@
@param weekMask: Week mask as list of 7 booleans.
Default is [True, True, True, True, True, True, True]
@param date: Task date as string "YYYY/MM/DD".
- Default is None (no date defined)
- @param time: Task time as string "HH:MM:SS".
- Default is "00:00:10".
+ Default is "0000/00/00" (no date defined)
+ @param hoursBegin: Task hours begin as string "HH:MM:SS".
+ Default is "00:00:00".
+ @param hoursEnd: Task hours end as string "HH:MM:SS".
+ Default is "23:59:59".
+ @param delay: Task delay as string "HH:MM:SS".
+ Default is "00:01:00".
@return: The success of the request.
"""
if name == None:
name = self.getDescription().getName()
argsToSend = Task.formatRequestArguments(type, name, weekMask, date,
- time)
+ hoursBegin, hoursEnd, delay)
if argsToSend == None:
return False
argsToSend['attitune_name'] = self.getDescription().getName()
Modified:
softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/gadgets/Gadget.py
===================================================================
---
softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/gadgets/Gadget.py
2009-04-24 17:16:03 UTC (rev 4592)
+++
softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/gadgets/Gadget.py
2009-04-24 17:17:04 UTC (rev 4593)
@@ -314,7 +314,8 @@
#
--------------------------------------------------------------------------
def scheduleStart(self, command = None, parameters = {},
type = "ONCE DELAYED", name = None, weekMask = [True, True, True, True,
- True, True, True], date = None, time = "00:00:10"):
+ True, True, True], date = "0000/00/00", hoursBegin = "00:00:00" ,
+ hoursEnd = "23:59:59", delay = "00:01:00"):
"""Schedule the start command of this gadget.
@param command: Command name to start the gadget.
if command is None, the first command is set.
@@ -329,9 +330,13 @@
@param weekMask: Week mask as list of 7 booleans.
Default is [True, True, True, True, True, True, True]
@param date: Task date as string "YYYY/MM/DD".
- Default is None (no date defined)
- @param time: Task time as string "HH:MM:SS".
- Default is "00:00:10".
+ Default is "0000/00/00" (no date defined)
+ @param hoursBegin: Task hours begin as string "HH:MM:SS".
+ Default is "00:00:00".
+ @param hoursEnd: Task hours end as string "HH:MM:SS".
+ Default is "23:59:59".
+ @param delay: Task delay as string "HH:MM:SS".
+ Default is "00:01:00".
@return: The success of the gadget task adding.
"""
if command == None:
@@ -346,21 +351,23 @@
if name == None:
name = self.getDescription().getName()
argsToSend = Task.formatRequestArguments(type, name, weekMask, date,
- time)
+ hoursBegin, hoursEnd, delay)
if argsToSend == None:
return False
argsToSend['gadget_uuid'] = self.__description.getUuid()
argsToSend['gadget_command'] = command
argsToSend['gadget_parameters'] = args
cmd = "task_creation/start_gadget?"
+ print argsToSend
return self._sendCommandBooleanResult(cmd, argsToSend)
#
--------------------------------------------------------------------------
# Schedule the run command of this gadget.
#
--------------------------------------------------------------------------
def scheduleRun(self, parameters = {}, type = "ONCE DELAYED", name = None,
- weekMask = [True, True, True, True, True, True, True], date = None,
- time = "00:00:10"):
+ weekMask = [True, True, True, True, True, True, True],
+ date = "0000/00/00", hoursBegin = "00:00:00" , hoursEnd = "23:59:59",
+ delay = "00:01:00"):
"""Schedule the run command of this gadget.
@param parameters: Parameters of the gadget as dictionary.
if no parameter is defined the default ones are set.
@@ -373,20 +380,25 @@
@param weekMask: Week mask as list of 7 booleans.
Default is [True, True, True, True, True, True, True]
@param date: Task date as string "YYYY/MM/DD".
- Default is None (no date defined)
- @param time: Task time as string "HH:MM:SS".
- Default is "00:00:10".
+ Default is "0000/00/00" (no date defined)
+ @param hoursBegin: Task hours begin as string "HH:MM:SS".
+ Default is "00:00:00".
+ @param hoursEnd: Task hours end as string "HH:MM:SS".
+ Default is "23:59:59".
+ @param delay: Task delay as string "HH:MM:SS".
+ Default is "00:01:00".
@return: The success of the gadget task adding.
"""
return self.scheduleStart(self.getDefaultRunCommandName(), parameters,
- type, name, weekMask, date, time)
+ type, name, weekMask, date, hoursBegin, hoursEnd, delay)
#
--------------------------------------------------------------------------
# Schedule the check command of this gadget.
#
--------------------------------------------------------------------------
def scheduleCheck(self, parameters = {}, type = "ONCE DELAYED", name =
None,
- weekMask = [True, True, True, True, True, True, True], date = None,
- time = "00:00:10"):
+ weekMask = [True, True, True, True, True, True, True],
+ date = "0000/00/00", hoursBegin = "00:00:00" , hoursEnd = "23:59:59",
+ delay = "00:01:00"):
"""Schedule the check command of this gadget.
@param parameters: Parameters of the gadget as dictionary.
if no parameter is defined the default ones are set.
@@ -399,20 +411,25 @@
@param weekMask: Week mask as list of 7 booleans.
Default is [True, True, True, True, True, True, True]
@param date: Task date as string "YYYY/MM/DD".
- Default is None (no date defined)
- @param time: Task time as string "HH:MM:SS".
- Default is "00:00:10".
+ Default is "0000/00/00" (no date defined)
+ @param hoursBegin: Task hours begin as string "HH:MM:SS".
+ Default is "00:00:00".
+ @param hoursEnd: Task hours end as string "HH:MM:SS".
+ Default is "23:59:59".
+ @param delay: Task delay as string "HH:MM:SS".
+ Default is "00:01:00".
@return: The success of the gadget task adding.
"""
return self.scheduleStart(self.getDefaultCheckCommandName(),
parameters,
- type, name, weekMask, date, time)
+ type, name, weekMask, date, hoursBegin, hoursEnd, delay)
#
--------------------------------------------------------------------------
# Schedule the stop command of this gadget.
#
--------------------------------------------------------------------------
def scheduleStop(self, type = "ONCE DELAYED", name = None,
- weekMask = [True, True, True, True, True, True, True], date = None,
- time = "00:00:10"):
+ weekMask = [True, True, True, True, True, True, True],
+ date = "0000/00/00", hoursBegin = "00:00:00" , hoursEnd = "23:59:59",
+ delay = "00:01:00"):
"""Schedule the stop command of this gadget.
@param type: <EVERY X|EVERY X FROM FULL HOUR|DAILY AT|ONCE AT|
ONCE DELAYED>
@@ -422,15 +439,19 @@
@param weekMask: Week mask as list of 7 booleans.
Default is [True, True, True, True, True, True, True]
@param date: Task date as string "YYYY/MM/DD".
- Default is None (no date defined)
- @param time: Task time as string "HH:MM:SS".
- Default is "00:00:10".
+ Default is "0000/00/00" (no date defined)
+ @param hoursBegin: Task hours begin as string "HH:MM:SS".
+ Default is "00:00:00".
+ @param hoursEnd: Task hours end as string "HH:MM:SS".
+ Default is "23:59:59".
+ @param delay: Task delay as string "HH:MM:SS".
+ Default is "00:01:00".
@return: The success of the request.
"""
if name == None:
name = self.getDescription().getName()
argsToSend = Task.formatRequestArguments(type, name, weekMask, date,
- time)
+ hoursBegin, hoursEnd, delay)
if argsToSend == None:
return False
argsToSend['gadget_uuid'] = self.__description.getUuid()
Modified:
softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/scheduler/Task.py
===================================================================
---
softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/scheduler/Task.py
2009-04-24 17:16:03 UTC (rev 4592)
+++
softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/scheduler/Task.py
2009-04-24 17:17:04 UTC (rev 4593)
@@ -82,8 +82,9 @@
# Format the arguments to pass to a "create task" requests.
#
--------------------------------------------------------------------------
def formatRequestArguments(tType = "ONCE DELAYED", name = None,
- weekMask = [True, True, True, True, True, True, True], date = None,
- time = "00:00:10"):
+ weekMask = [True, True, True, True, True, True, True],
+ date = "0000/00/00", hoursBegin = "00:00:00" , hoursEnd = "23:59:59",
+ delay = "00:01:00"):
"""Format the arguments to pass to a "create task" requests.
@param tType: <EVERY X|EVERY X FROM FULL HOUR|DAILY AT|ONCE AT|
ONCE DELAYED>
@@ -93,9 +94,13 @@
@param weekMask: Week mask as list of 7 booleans.
Default is [True, True, True, True, True, True, True]
@param date: Task date as string "YYYY/MM/DD".
- Default is None (no date defined)
- @param time: Task time as string "HH:MM:SS".
- Default is "00:00:10".
+ Default is "0000/00/00" (no date defined)
+ @param hoursBegin: Task hours begin as string "HH:MM:SS".
+ Default is "00:00:00".
+ @param hoursEnd: Task hours end as string "HH:MM:SS".
+ Default is "23:59:59".
+ @param delay: Task delay as string "HH:MM:SS".
+ Default is "00:01:00".
@return: A dictionary or None.
"""
# Check the validity of the task type
@@ -116,55 +121,49 @@
if len(weekMaskString) > 0:
weekMaskString += ","
if b:
- weekMaskString += "1"
+ weekMaskString += "true"
else:
- weekMaskString += "0"
+ weekMaskString += "false"
weekMaskString = '"%s"' % weekMaskString
# Check and format the task date
- if date == None:
- year = -1
- month = -1
- day = -1
- else:
- if type(date) != type(""):
- print "Invalid task date format : (%s) -> YYYY/MM/DD" %
str(date)
- return None
- splDate = date.split("/")
- if len(splDate) != 3:
- print "Invalid task date format : (%s) -> YYYY/MM/DD" % date
- return None
- try:
- year = int(splDate[0])
- month = int(splDate[1])
- day = int(splDate[2])
- except:
- print "Invalid task date format : (%s) -> YYYY/MM/DD" % date
- return None
- # Check and format the task time
- if type(time) != type(""):
- print "Invalid task time format : (%s) -> HH:MM:SS" % str(time)
- splTime = time.split(":")
+ if type(date) != type(""):
+ print "Invalid task date format : (%s) -> YYYY/MM/DD" % str(date)
+ return None
+ splDate = date.split("/")
+ if len(splDate) != 3:
+ print "Invalid task date format : (%s) -> YYYY/MM/DD" % date
+ return None
+ date = '"%s"' % date
+ # Check and format the task hours begin
+ if type(hoursBegin) != type(""):
+ print "Invalid task time format : (%s) -> HH:MM:SS" %
str(hoursBegin)
+ splTime = hoursBegin.split(":")
if len(splTime) != 3:
- print "Invalid task time format : (%s) -> HH:MM:SS" % time
+ print "Invalid task time format : (%s) -> HH:MM:SS" % hoursBegin
return None
- try:
- hour = int(splTime[0])
- minute = int(splTime[1])
- second = int(splTime[2])
- except:
- print "Invalid task time format : (%s) -> HH:MM:SS" % time
+ # Check and format the task hours end
+ if type(hoursEnd) != type(""):
+ print "Invalid task time format : (%s) -> HH:MM:SS" % str(hoursEnd)
+ splTime = hoursEnd.split(":")
+ if len(splTime) != 3:
+ print "Invalid task time format : (%s) -> HH:MM:SS" % hoursEnd
return None
+ # Check and format the task delay
+ if type(delay) != type(""):
+ print "Invalid task time format : (%s) -> HH:MM:SS" % str(delay)
+ splTime = delay.split(":")
+ if len(splTime) != 3:
+ print "Invalid task time format : (%s) -> HH:MM:SS" % delay
+ return None
# Create the result dictionary
result = {
'task_type' : tType,
'task_name' : name,
'week_mask' : weekMaskString,
- 'hour' : hour,
- 'minute' : minute,
- 'second' : second,
- 'year' : year,
- 'month' : month,
- 'day' : day,
+ 'date' : date,
+ 'hoursBegin' : hoursBegin,
+ 'hoursEnd' : hoursEnd,
+ 'delay' : delay,
}
return result
Modified:
softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/scheduler/TaskDescription.py
===================================================================
---
softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/scheduler/TaskDescription.py
2009-04-24 17:16:03 UTC (rev 4592)
+++
softwares_suite_v3/kysoh/tuxware/api/python/trunk/tuxisalive/api/scheduler/TaskDescription.py
2009-04-24 17:17:04 UTC (rev 4593)
@@ -81,7 +81,7 @@
splitedStr = self.__dictionary['weekMaskString'].split(",")
if len(splitedStr) == 7:
for i, value in enumerate(splitedStr):
- if value == "1":
+ if value == "true":
result[i] = True
else:
result[i] = False
@@ -99,60 +99,57 @@
return self.__dictionary['weekMaskString']
#
--------------------------------------------------------------------------
- # Get the year value.
+ # Get the date values.
#
--------------------------------------------------------------------------
- def getYear(self):
- """Get the year value.
- @return: An integer or -1.
+ def getDate(self):
+ """Get the date values.
+ @return: A String.
"""
- return self.__dictionary['year']
+ result = "%.4d/%.2d/%.2d" % (int(self.__dictionary['date']['year']),
+ int(self.__dictionary['date']['month']),
+ int(self.__dictionary['date']['day']))
+ return result
#
--------------------------------------------------------------------------
- # Get the month value.
+ # Get the hoursBegin values.
#
--------------------------------------------------------------------------
- def getMonth(self):
- """Get the month value.
- @return: An integer or -1.
+ def getHoursBegin(self):
+ """Get the hoursBegin values.
+ @return: A String.
"""
- return self.__dictionary['month']
+ result = "%.2d:%.2d:%.2d" % (
+ int(self.__dictionary['hoursBegin']['hour']),
+ int(self.__dictionary['hoursBegin']['minute']),
+ int(self.__dictionary['hoursBegin']['second']))
+ return result
#
--------------------------------------------------------------------------
- # Get the day value.
+ # Get the hoursEnd values.
#
--------------------------------------------------------------------------
- def getDay(self):
- """Get the day value.
- @return: An integer or -1.
+ def getHoursEnd(self):
+ """Get the hoursEnd values.
+ @return: A String.
"""
- return self.__dictionary['day']
+ result = "%.2d:%.2d:%.2d" % (
+ int(self.__dictionary['hoursEnd']['hour']),
+ int(self.__dictionary['hoursEnd']['minute']),
+ int(self.__dictionary['hoursEnd']['second']))
+ return result
#
--------------------------------------------------------------------------
- # Get the hour value.
+ # Get the delay values.
#
--------------------------------------------------------------------------
- def getHour(self):
- """Get the hour value.
- @return: An integer.
+ def getDelay(self):
+ """Get the delay values.
+ @return: A String.
"""
- return self.__dictionary['hour']
+ result = "%.2d:%.2d:%.2d" % (
+ int(self.__dictionary['delay']['hour']),
+ int(self.__dictionary['delay']['minute']),
+ int(self.__dictionary['delay']['second']))
+ return result
#
--------------------------------------------------------------------------
- # Get the minute value.
- #
--------------------------------------------------------------------------
- def getMinute(self):
- """Get the minute value.
- @return: An integer.
- """
- return self.__dictionary['minute']
-
- #
--------------------------------------------------------------------------
- # Get the second value.
- #
--------------------------------------------------------------------------
- def getSecond(self):
- """Get the second value.
- @return: An integer.
- """
- return self.__dictionary['second']
-
- #
--------------------------------------------------------------------------
# Get the user data.
#
--------------------------------------------------------------------------
def getData(self):
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn