Skip to content

Commit

Permalink
appears to be working
Browse files Browse the repository at this point in the history
  • Loading branch information
haarcuba committed Jan 22, 2017
0 parents commit da72558
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import yaml_mako
import pprint
import datetime

stream = open( 'example.yaml' )
today = datetime.date.today()
oneYearLater = today + datetime.timedelta( 1 )
pprint.pprint( yaml_mako.load( stream, start_date = today, end_date = oneYearLater ) )
6 changes: 6 additions & 0 deletions example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
name: "subscription"
details:
start time: ${start_date}
end time: ${end_date}
comment: dates should appear above after temlating
8 changes: 8 additions & 0 deletions yaml_mako.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import yaml
import mako.template

def load( yamlSource, ** kwargs ):
content = yamlSource.read()
template = mako.template.Template( content )
yamlContent = template.render( ** kwargs )
return yaml.load( yamlContent )

0 comments on commit da72558

Please sign in to comment.