thomasvs - in flumotion/trunk: .
flumotion/component/consumers/disker
flumotion-commit at lists.fluendo.com
flumotion-commit at lists.fluendo.com
Mon Feb 19 18:48:58 CET 2007
Author: thomasvs
Date: Mon Feb 19 18:48:56 2007
New Revision: 4494
Modified:
flumotion/trunk/ChangeLog
flumotion/trunk/flumotion/component/consumers/disker/disker.py
flumotion/trunk/flumotion/component/consumers/disker/disker.xml
Log:
* flumotion/component/consumers/disker/disker.py:
* flumotion/component/consumers/disker/disker.xml:
make rotateType default to None
add an Error message if a rotateType is given but the
corresponding property is not
Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog (original)
+++ flumotion/trunk/ChangeLog Mon Feb 19 18:48:56 2007
@@ -1,3 +1,11 @@
+2007-02-19 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * flumotion/component/consumers/disker/disker.py:
+ * flumotion/component/consumers/disker/disker.xml:
+ make rotateType default to None
+ add an Error message if a rotateType is given but the
+ corresponding property is not
+
2007-02-18 Thomas Vander Stichele <thomas at apestaart dot org>
* flumotion/component/bouncers/icalbouncer.py:
Modified: flumotion/trunk/flumotion/component/consumers/disker/disker.py
==============================================================================
--- flumotion/trunk/flumotion/component/consumers/disker/disker.py (original)
+++ flumotion/trunk/flumotion/component/consumers/disker/disker.py Mon Feb 19 18:48:56 2007
@@ -31,7 +31,7 @@
from twisted.internet import reactor
from flumotion.component import feedcomponent
-from flumotion.common import log, gstreamer, pygobject, messages
+from flumotion.common import log, gstreamer, pygobject, messages, errors
# proxy import
from flumotion.component.component import moods
@@ -88,18 +88,33 @@
self.fixRenamedProperties(properties, [('rotateType', 'rotate-type')])
- rotateType = properties['rotate-type']
- if rotateType == 'size':
- self.setSizeRotate(properties['size'])
- elif rotateType == 'time':
- self.setTimeRotate(properties['time'])
- elif rotateType != 'none':
+ rotateType = properties.get('rotate-type', 'none')
+
+ # validate rotate-type and size/time properties first
+ if not rotateType in ['none', 'size', 'time']:
m = messages.Error(T_(N_(
"The configuration property 'rotate-type' should be set to "
"'size', time', or 'none', not '%s'. "
"Please fix the configuration."),
rotateType), id='rotate-type')
self.addMessage(m)
+ raise errors.ComponentSetupHandledError()
+
+ # size and time types need the property specified
+ if rotateType in ['size', 'time']:
+ if rotateType not in properties.keys():
+ m = messages.Error(T_(N_(
+ "The configuration property '%s' should be set. "
+ "Please fix the configuration."),
+ rotateType), id='rotate-type')
+ self.addMessage(m)
+ raise errors.ComponentSetupHandledError()
+
+ # now act on the properties
+ if rotateType == 'size':
+ self.setSizeRotate(properties['size'])
+ elif rotateType == 'time':
+ self.setTimeRotate(properties['time'])
# FIXME: should add a way of saying "do first cycle at this time"
return self.pipe_template
Modified: flumotion/trunk/flumotion/component/consumers/disker/disker.xml
==============================================================================
--- flumotion/trunk/flumotion/component/consumers/disker/disker.xml (original)
+++ flumotion/trunk/flumotion/component/consumers/disker/disker.xml Mon Feb 19 18:48:56 2007
@@ -18,8 +18,8 @@
<properties>
<property name="directory" type="string" required="yes" />
- <property name="rotate-type" type="string" required="yes"
- description="'size', 'time', or 'none'"/>
+ <property name="rotate-type" type="string" required="no"
+ description="'size', 'time', or 'none' (default 'none')" />
<property name="size" type="long"
description="Maximum size of each file (in bytes)" />
<property name="time" type="long"
More information about the flumotion-commit
mailing list