Author: remi
Date: 2009-04-06 18:03:48 +0200 (Mon, 06 Apr 2009)
New Revision: 4358
Modified:
software_suite_v2/tuxware/tuxdroidserver/trunk/util/scheduler/Task.py
software_suite_v2/tuxware/tuxdroidserver/trunk/util/scheduler/TaskDescription.py
Log:
* added getter to some information
Modified: software_suite_v2/tuxware/tuxdroidserver/trunk/util/scheduler/Task.py
===================================================================
--- software_suite_v2/tuxware/tuxdroidserver/trunk/util/scheduler/Task.py
2009-04-06 15:56:50 UTC (rev 4357)
+++ software_suite_v2/tuxware/tuxdroidserver/trunk/util/scheduler/Task.py
2009-04-06 16:03:48 UTC (rev 4358)
@@ -31,6 +31,7 @@
@param day: <dd> or -1
@param command: Command to execute as string.
@param arguments: Arguments of the command as tuple.
+ @param data: User data.
"""
dictionary = {
'type' : ruleType,
@@ -88,6 +89,29 @@
return self.__description
#
--------------------------------------------------------------------------
+ # Get the task informations.
+ #
--------------------------------------------------------------------------
+ def getDictionary(self):
+ """Get the task informations.
+ @return: A dictionary.
+ """
+ result = {
+ 'id' : self.getDescription().getId(),
+ 'name' : self.getDescription().getName(),
+ 'task_desc' : self.getDescription().toString(),
+ 'type' : self.getDescription().getType(),
+ 'weekMask' : self.getDescription().getWeekMaskString(),
+ 'year' : self.getDescription().getYear(),
+ 'month' : self.getDescription().getMonth(),
+ 'day' : self.getDescription().getDay(),
+ 'hour' : self.getDescription().getHour(),
+ 'minute' : self.getDescription().getMinute(),
+ 'second' : self.getDescription().getSecond(),
+ 'data' : self.__data,
+ }
+ return result
+
+ #
--------------------------------------------------------------------------
# Create the month mask.
#
--------------------------------------------------------------------------
def __createMonthMask(self, month):
Modified:
software_suite_v2/tuxware/tuxdroidserver/trunk/util/scheduler/TaskDescription.py
===================================================================
---
software_suite_v2/tuxware/tuxdroidserver/trunk/util/scheduler/TaskDescription.py
2009-04-06 15:56:50 UTC (rev 4357)
+++
software_suite_v2/tuxware/tuxdroidserver/trunk/util/scheduler/TaskDescription.py
2009-04-06 16:03:48 UTC (rev 4358)
@@ -115,6 +115,23 @@
return self.__dictionary['weekMask']
#
--------------------------------------------------------------------------
+ # Get the week mask.
+ #
--------------------------------------------------------------------------
+ def getWeekMaskString(self):
+ """Get the week mask.
+ @return: A string/
+ """
+ result = ""
+ for b in self.__dictionary['weekMask']:
+ if len(result) > 0:
+ result += ","
+ if b:
+ result += "1"
+ else:
+ result += "0"
+ return result
+
+ #
--------------------------------------------------------------------------
# Get the year value.
#
--------------------------------------------------------------------------
def getYear(self):
------------------------------------------------------------------------------
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn