0
I Use This!
Activity Not Available
Analyzed 7 months ago. based on code collected 7 months ago.

Project Summary

The main functions and classes of the ctemplate library are wrapped as native Python objects. This enables quick prototyping and testing of a ctemplate system.

Run python internal help() for an API overview: $ python -c "import ctemplate; help(ctemplate)"

Example

# loads example.tpl in current directory
template = ctemplate.Template("example.tpl", ctemplate.DO_NOT_STRIP)
dictionary = ctemplate.Dictionary("my example dict")
dictionary.SetValue("VALUE1", "TEST1")
# dict setters call SetValue() automatically
dictionary["VALUE2"] = "TEST2"
# all objects except booleans are converted to strings with str()
dictionary["NUMBER"] = 87411 # stores "87411"
dictionary["TUPLE"] = (1, 2, 3) # stores "(1, 2, 3)"
# Sections
dictionary.ShowSection("A_SECTION")
# boolean True calls ShowSection() automatically
dictionary["IN_CA"] = True
# boolean False is ignored (ie. this statement has no effect)
dictionary["IGNORED"] = False
# And of course the expand function
print template.Expand(dictionary)

Tags

template templating wrapper python ctemplate

In a Nutshell, python-ctemplate...

This Project has No vulnerabilities Reported Against it

Did You Know...

  • ...
    Black Duck offers a free tool to discover if there are open source vulnerabilities in your code
  • ...
    you can subscribe to e-mail newsletters to receive update from the Open Hub blog
  • ...
    55% of companies leverage OSS for production infrastructure
  • ...
    you can embedded statistics from Open Hub on your site

Languages

Languages?height=75&width=75
C++
82%
Python
10%
Make
6%
HTML
2%

30 Day Summary

Apr 10 2016 — May 10 2016

12 Month Summary

May 10 2015 — May 10 2016

Ratings

Be the first to rate this project
Click to add your rating
   Spinner
Review this Project!