I have a template file: 'template.txt' like below:
class Core_Model_DbTable_{table_name} extends YouNet_Db_Table
{
const TYPE_PRINTED = 1;
const TYPE_DIGITAL = 2;
protected $_name = '{table_name}';
protected $_rowClass = 'Core_Model_{table_name:short}';
}
And I use Python 3.2 to read that file and try to replace:
- {table_name} => Coupons
- {table_name:short} => Coupon
and here my code:
in_file = open("template.txt","r")
text = in_file.read()
in_file.close()
txt = text.replace("{table_name}","Coupons")
txt = text.replace("{table_name:short}","Coupon")
But the output only shows the result:
c:\Python32\python.exe builder.py
<?php
class Core_Model_DbTable_{table_name} extends YouNet_Db_Table
{
const TYPE_PRINTED = 1;
const TYPE_DIGITAL = 2;
protected $_name = '{table_name}';
protected $_rowClass = 'Core_Model_Coupon';
}
Could you please tell me anything is wrong here?