lucuma/Clay — pull request #16 by przerull (2013-11-15 18:12:07+00:00)
Title: Now storing the project settings in a python module rather than a yaml file.

I think Clay is an awesome piece of software. I've been using it to create static websites for my clients and it's been going great.

But I had a use case which didn't appear to work with Clay as it was. I wanted to be able to loop through a csv file to populate data for one of the pages. This would mean passing a csv reader object into the template. But as far as I can tell, yaml only supports the creation of primitive types (ints, strings) and basic collections (list, dict, etc...).

So I modified Clay to store the project settings in a python file.

so with the following settings.py

```python
FILTER_PARTIALS=True
FILTER=['base.html']
INCLUDE=[]

host='0.0.0.0'
port=8080

def csvlooper(filepath):
import csv
return csv.reader(open(filepath))
```

then In my templates I can call
```html
{% for row in csvlooper('source/contacts.csv') %}

{{row[0]}}

{{row[1]}}

{{row[2]}}

{{row[3]}}

{% endfor %}
```

The tests have been updated. All of them pass. Also I started using this with one of my Clay projects and it still works too.

Please let me know your thoughts on these changes. If you'd like to include them or if you'd like me to make some changes first.

Thanks,

PhilZ