Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Schedules Support Round 2 #48

Merged
merged 17 commits into from Oct 7, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 10 additions & 23 deletions tableauserverclient/models/schedule_item.py
@@ -1,5 +1,6 @@
import xml.etree.ElementTree as ET
from .interval_item import IntervalItem
from .property_decorators import property_is_enum, property_is_boolean, property_not_empty, property_not_nullable
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove the imports I'm not using, copy/paste error

from .. import NAMESPACE


Expand Down Expand Up @@ -49,12 +50,9 @@ def execution_order(self):
return self._execution_order

@execution_order.setter
@property_is_enum(ExecutionOrder)
def execution_order(self, value):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update this with @LGraber 's decorators still

if value and not hasattr(ScheduleItem.ExecutionOrder, value):
error = "Invalid execution order defined: {}.".format(value)
raise ValueError(error)
else:
self._execution_order = value
self._execution_order = value

@property
def frequency(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is supposed to access the interval's frequency

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, the frequency is on the schedule, the interval is the frequencyDetail

http://onlinehelp.tableau.com/samples/en-us/rest_api/ts-api_2_3.xsd

Expand All @@ -69,12 +67,9 @@ def name(self):
return self._name

@name.setter
@property_not_nullable
def name(self, value):
if not value:
error = "Name must be defined."
raise ValueError(error)
else:
self._name = value
self._name = value

@property
def next_run_at(self):
Expand All @@ -97,27 +92,19 @@ def schedule_type(self):
return self._schedule_type

@schedule_type.setter
@property_is_enum(Type)
@property_not_nullable
def schedule_type(self, value):
if not value:
error = "Schedule type must be defined."
raise ValueError(error)
elif not hasattr(ScheduleItem.Type, value):
error = "Invalid schedule type defined: {}.".format(value)
raise ValueError(error)
else:
self._schedule_type = value
self._schedule_type = value

@property
def state(self):
return self._state

@state.setter
@property_is_enum(State)
def state(self, value):
if not hasattr(ScheduleItem.State, value):
error = "Invalid state defined."
raise ValueError(error)
else:
self._state = value
self._state = value

@property
def updated_at(self):
Expand Down