wilsonfreitas / python-bizdays

Business days calculations and utilities
http://wilsonfreitas.github.io/python-bizdays/
MIT License
80 stars 34 forks source link

Provide the directory to specify where to find the calendar spec #2

Closed wilsonfreitas closed 11 years ago

wilsonfreitas commented 11 years ago

Where to find the calendar spec? The directory should be provided, or the path should be passed together with the calendar spec name, but the calendar's name wouldn't have the path.

cal = Calendar('/path/to/calendar/spec/Test')
cal.name
# Test

or specify the directory explicitly

cal = Calendar('Test', repository='/path/to/calendar/spec/')

or lastly a singleton to hold the settings.

bizdays.calendar_settings(repository='/path/to/calendar/spec/')
wilsonfreitas commented 11 years ago

After a second though I realized that Calendar shouldn't read the specification file. It should receive a list of dates and a new class, an extension of Calendar should handle that. I am changing this issue into a BUG, instead of an enhancement.

wilsonfreitas commented 11 years ago

Done d5c74aa0807dfe535dfb70e7cb00c872da6f4437 Now bizdays has 2 classes Calendar, which receives a list of holidays and CalendarSpec which handles with tha calendar specification file.