addHoliday Function issue

I’m trying to use the function system.user.addHoliday in perspective. On a button click it activates the following script:

def runAction(self, event):
	Method that will run whenever the selected event fires.

		self: A reference to the component that is invoking this function.
		event: An object that holds information about the selected event type
	# Write your script here
	from java.util import Date
		name = self.getSibling("TextField").props.text
		date = Date(self.getSibling("DateTimeInput").props.value)
		date =,"dd/MM/yyyy")
		repeat = self.getSibling("Checkbox").props.selected
	except Exception:
		response = "Info couldn't be retrieved"
		response = project.pyEightLegsUsers.addHoliday()
	except Exception:
		response = "Holiday couldn't be added"

This script utilizes the following code:

def printResponse(responseList):
	if len(responseList) > 0:
		for response in responseList:
			print "", response
		print " None"

def addHoliday():
	from java.util import Date
	response = False
	name = 'adsfasf'
	date = Date(100,1,1)
	newHoliday = HolidayModel(name,date,repeat)
	response = system.user.addHoliday(newHoliday)
	return infos[0]

The issue that I am having is that whenever I call addHoliday() from the Script Console tool, it successfully adds in the holiday without issues, however when it is called from the button script the second exception is always fired (Holiday could not be added). I am wondering how to fix this?

Thanks for the help,

Nevermind, I went though this function and realized all the bugs that I had in it. I have fixed it since.



1 Like