diff --git a/server/samples/REST1.py b/server/samples/REST1.py index 2c2f4f82e..14671b1e8 100644 --- a/server/samples/REST1.py +++ b/server/samples/REST1.py @@ -65,6 +65,7 @@ def login(): return 0 + def logout(): global headers h = Http() diff --git a/server/src/uds/core/util/calendar/__init__.py b/server/src/uds/core/util/calendar/__init__.py index 4b56515db..50ba4044f 100644 --- a/server/src/uds/core/util/calendar/__init__.py +++ b/server/src/uds/core/util/calendar/__init__.py @@ -46,7 +46,7 @@ import six import bitarray import logging -__updated__ = '2016-10-31' +__updated__ = '2017-11-06' logger = logging.getLogger(__name__) @@ -185,5 +185,4 @@ class CalendarChecker(object): def debug(self): - return "Calendar checker for {}".format(self.calendar) diff --git a/server/src/uds/models/Calendar.py b/server/src/uds/models/Calendar.py index aa29674d3..b21308992 100644 --- a/server/src/uds/models/Calendar.py +++ b/server/src/uds/models/Calendar.py @@ -34,7 +34,7 @@ from __future__ import unicode_literals -__updated__ = '2016-04-05' +__updated__ = '2017-11-06' from django.db import models from uds.models.UUIDModel import UUIDModel @@ -61,5 +61,17 @@ class Calendar(UUIDModel, TaggingMixin): db_table = 'uds_calendar' app_label = 'uds' + def save(self, *args, **kwargs): + logger.debug('Saving calendar') + + res = UUIDModel.save(self, *args, **kwargs) + + try: + for v in self.calendaraction_set.all(): v.save() + except Exception: + pass + + return res + def __str__(self): return 'Calendar "{}" modified on {} with {} rules'.format(self.name, self.modified, self.rules.count()) diff --git a/server/src/uds/models/CalendarRule.py b/server/src/uds/models/CalendarRule.py index 368ee1909..8cbb4fb6c 100644 --- a/server/src/uds/models/CalendarRule.py +++ b/server/src/uds/models/CalendarRule.py @@ -33,7 +33,7 @@ from __future__ import unicode_literals -__updated__ = '2016-10-31' +__updated__ = '2017-11-06' from django.db import models from django.utils.encoding import python_2_unicode_compatible @@ -153,9 +153,10 @@ class CalendarRule(UUIDModel): def save(self, *args, **kwargs): logger.debug('Saving...') self.calendar.modified = getSqlDatetime() - self.calendar.save() - return UUIDModel.save(self, *args, **kwargs) + res = UUIDModel.save(self, *args, **kwargs) + self.calendar.save() + return res def __str__(self): return 'Rule {0}: {1}-{2}, {3}, Interval: {4}, duration: {5}'.format(self.name, self.start, self.end, self.frequency, self.interval, self.duration) diff --git a/server/src/uds/services/OpenGnsys/og/__init__.py b/server/src/uds/services/OpenGnsys/og/__init__.py index 1091bea5d..921a75fc1 100644 --- a/server/src/uds/services/OpenGnsys/og/__init__.py +++ b/server/src/uds/services/OpenGnsys/og/__init__.py @@ -231,6 +231,8 @@ class OpenGnsysClient(object): @ensureConnected def notifyDeadline(self, machineId, deadLine): ou, lab, client = machineId.split('.') + if deadLine is None: + deadLine = 0 errMsg = 'Notifying deadline' data = { 'deadLine': deadLine