Hello there,

I've just committed a patch for adding 'slicing' support to the Template 
subsystem that Cherokee uses for both the "Advanced Virtual Hosting" module and 
the "Custom" logger.

It basically allows to use a portion of the replacement string instead of the 
whole thing. For instance, there are servers with thousands of virtual servers 
where domains are distributed within a two-level directory tree in order to 
speed things up. Something like:

  /var/www/e/x/example.com
  /var/www/c/h/cherokee-project.com
  /var/www/1/2/12345.com

The "Advanced Virtual Hosting" didn't support this sort of set-ups because it 
could not use substrings of the ${domain} macro. Now, it's possible by using 
slices:

  /var/www/${domain}[:1]/${domain}[1:2]/${domain}

This same slicing mechanism can also be used in the "custom" log. I cannot 
think of a fairly useful example for it though. Anyway, since it's part of the 
template system it's available.

The slicing system is basically the same one as in Python. It supports positive 
and negative indexes, and the omission of one of the index numbers. Odds are 
you are already familiar with it.

It'd be great if you guys could give it a try. The code seems the be working 
alright, although it isn't tested enough to make it safely to the next release. 
Feedback is more than welcome.

Cheers!

--
Octality
http://www.octality.com/

_______________________________________________
Cherokee mailing list
[email protected]
http://lists.octality.com/listinfo/cherokee

Reply via email to