Dear Gentlemen:

I was not saying that I liked the idea or that it is now necessary to completely change it.

I was only giving an explanation for why it was a mess and difficult to use now!  I do not see any problems with having python in the file...

There was no discussion on this list, it was a conversation between Brian and myself!  It was back when the python was removed, and I had to add an entry for each year instead of having the if conditional....

I like it the way it is currently, but check with Brian...

Sincerely yours,
Rob G. Healey

On Sat, Jan 30, 2010 at 10:16 AM, Nick Hall <nick__hall@hotmail.com> wrote:


Doug Blank wrote:
On Sat, Jan 30, 2010 at 10:15 AM, Nick Hall <nick__hall@hotmail.com> wrote:
 
Rob,

I wasn't involved in the previous discussion.
   

I don't think that there was a discussion.

 

I did a quick search and couldn't find any reference to the post that Rob was referring to.


I got involved with this
thread because there were no English holidays in the xml file.

I can understand why Brian didn't want python in the xml file.  If we
want to enforce this then we should change the way the "value" attribute
is used and remove the "if" attribute.

The "value" attribute could just reference a function to be called from
a pre-defined set of functions.  So, for example, for Good Friday we
could have:

  <date name="Good Friday" value=">easter" offset="-2" type="Religious" />

For the day-of-week function in the "if" statement we could add another
attribute.  The English Christmas holidays would then become:

  <date name="Christmas Day" value="*/dec/25" type="National" />
  <date name="Boxing Day" value="*/dec/26" type="National" />
  <date name="Bank Holiday" value="*/dec/25" offset="+2" dow="6,7"
type="National" />
  <date name="Bank Holiday" value="*/dec/26" offset="+2" dow="6,7"
type="National" />

where the dow parameter is a list of days (1=mon -> 7=sun).

We could then add other attributes for specific uses of the "if"
attribute.  In England, the Spring Bank Holiday is defined differently
for 2012, so I suggest an "except" attribute:

  <date name="Spring Bank Holiday" value="*/-1/mon/may" except="2012"
type="National" />
  <date name="Spring Bank Holiday" value="2012/6/4" type="National" />

I have a patch for these changes if we want to go down this route.
   

I don't think this makes much sense: the holidays.xml is only useful
for a system that knows how to use these special values (be it
"easter" or "> easter(y, m, d)"). Also, to make it pure XML, you'd
have to encode the lessthans as &lt; (or some other encoding). That
would be ugly.

My suggestion was not to use pure XML.  I assume that XML was used here because there are parsers available.


The alternative is to remove all of the dynamic
entries, which would require the work-arounds in:

http://www.gramps-project.org/bugs/view.php?id=3537
 

No we don't want to remove the dynamic entries - a special value for Easter is very useful.  What I was suggesting is that we could avoid the python code in the XML directly.  We would be just using another mechanism to call the same functions.


I probably should have just made the original be a .ini file, rather
than almost an xml file. Even our current config uses eval().

 

Was the use of eval() Brian's main problem?
There may be some other system that could edit the file and use it,
but at the cost of being less useful to Gramps. If someone really
wanted to create a pure XML file, it is easy to make a converter (a la
the example on the bug report).

 

I see no point in a pure XML file.  Did Brian suggest pure XML?  Rob only mentioned no having python code in the XML.

I'm very happy with the current code.  The English holidays should not need any updating, and keeping the file up-to-date was my concern.

My patch was quick to write, and the xml is maybe very slightly clearer, but it reduces functionality so there is no point in moving to this unless we need to do so.


Nick.


-Doug

 
Regards,


Nick.


Rob Healey wrote:
   
Greetings All:

To shed some light on this topic from a while back:

The reason that there was some mistakes added into the holidays.xml file
was:

Brian Matherly didn't want any python in the xml file.  I had to either get
the dates by hand or from the internet!  I apologize for it!

Sincerely,
Rob


On Fri, Jan 29, 2010 at 10:22 AM, Nick Hall <nick__hall@hotmail.com> wrote:


     
Doug,

In commit 14168 I have added the ISO day of week function that I am using.

I have also updated the English holidays.  I will look at a few actual
calendars to see if my version is consistent.  It may need a few tweaks
but I think that the isodow(y, m, d) (the variable dow was already used)
function will do everything I need.

Let me know if this is OK.

Nick.


Doug Blank wrote:

       
On Fri, Jan 29, 2010 at 12:12 PM, Nick Hall <nick__hall@hotmail.com
<mailto:nick__hall@hotmail.com>> wrote:

   Yes, I agree.

   You could then do the English Christmas holidays with:


   <date name="Christmas Day" value="*/dec/25" type="national" />
   <date name="Boxing Day" value="*/dec/26" type="national" />
   <date name="Holiday in lieu of Christmas Day" value="*/dec/26"
   if="dow(y, m, d) == 7" type="national" />
   <date name="Holiday in lieu of Christmas Day" value="*/dec/27"
   if="dow(y, m, d) == 6" type="national" />
   <date name="Holiday in lieu of Boxing Day" value="*/dec/27"
   if="dow(y, m, d) == 1" type="national" />
   <date name="Holiday in lieu of Boxing Day" value="*/dec/28"
   if="dow(y, m, d) > 5" type="national" />


Just to make sure I'm clear: dow() == 1 is Sunday, 7 is Saturday in
your examples?

-Doug



   Nick.


   Doug Blank wrote:

       On Fri, Jan 29, 2010 at 11:42 AM, Reinhard Müller
       <reinhard.mueller@bytewise.at
       <mailto:reinhard.mueller@bytewise.at>
       <mailto:reinhard.mueller@bytewise.at
       <mailto:reinhard.mueller@bytewise.at>>> wrote:

          Hi,

          Am Freitag, den 29.01.2010, 11:37 -0500 schrieb Doug Blank:
          > <... if="> dow(y, m, d) == 'sun'"> <... if="> dow(y, m, d)

         
!=

       
          'sun'">

          I haven't followed the discussion so far, but I would

         
generally

       
          recommend to make dow(y, m, d) return a number from 1
       (monday) to 7
          (sunday). That way you can also do things like dow(y,m,d) > 5.


       Good idea!

       -Doug


          Thanks,
          Reinhard
          --
          Reinhard Müller                    Tel +43 (5577) 89877-0
          BYTEWISE Software GmbH             Fax +43 (5577) 89877-66
          A-6890 Lustenau, Enga 2            http://www.bytewise.at
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          Individuelle Datenbanklösungen für GNU/Linux, Windows und
          Mac OSX: http://www.bytewise.at/leistungen/gnue-indiv.html




         
 ------------------------------------------------------------------------------

       
          The Planet: dedicated and managed hosting, cloud storage,
       colocation
          Stay online with enterprise data centers and the best
       network in
          the business
          Choose flexible plans and management services without

         
long-term

       
          contracts
          Personal 24x7 support from experience hosting pros just a

         
phone

       
          call away.
          http://p.sf.net/sfu/theplanet-com
          _______________________________________________
          Gramps-devel mailing list
          Gramps-devel@lists.sourceforge.net
       <mailto:Gramps-devel@lists.sourceforge.net>
          <mailto:Gramps-devel@lists.sourceforge.net
       <mailto:Gramps-devel@lists.sourceforge.net>>

          https://lists.sourceforge.net/lists/listinfo/gramps-devel




         
------------------------------------------------------------------------

       

         
------------------------------------------------------------------------------

       
       The Planet: dedicated and managed hosting, cloud storage,
       colocation
       Stay online with enterprise data centers and the best network
       in the business
       Choose flexible plans and management services without
       long-term contracts
       Personal 24x7 support from experience hosting pros just a
       phone call away.
       http://p.sf.net/sfu/theplanet-com


         
------------------------------------------------------------------------

       
       _______________________________________________
       Gramps-devel mailing list
       Gramps-devel@lists.sourceforge.net
       <mailto:Gramps-devel@lists.sourceforge.net>
       https://lists.sourceforge.net/lists/listinfo/gramps-devel




         
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the
business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Gramps-devel mailing list
Gramps-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gramps-devel


       
     
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Gramps-devel mailing list
Gramps-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gramps-devel