Converter 2:thinkphp template to Django template

Source: Internet
Author: User

The day before yesterday wrote a "thinkphp template to Flask template"

I was despised by my colleague because he was using Django, and I used flask to avoid being so powerful as he continued to be with the Amway Django. I decided to write a Django template converter.

In order to reuse the code, I had to use inheritance, I divided the original code into three paragraphs, and suddenly got three converters.

classconvertertemplateencoding (object): Separators= [('<','>')]    def __init__(self): Self.match= {'opening': 0,'closing': 0,'Extra': 0,'Script':"','content':"','Cache':"','Separator': ()}    defConvert_tag (self, tag, extra="'):        returntag ...classConverterthinkphp2jinja (convertertemplateencoding): Separators= [('{','}'), ('__','__'), ('<','>'), ('<?','?>')]classConverterthinkphp2django (Converterthinkphp2jinja):Pass

What I did not say is that the flask template is quite similar to the Django template, at least I didn't implement it. Ha.

if __name__ ' __main__ ' :    Converterthinkphp2jinja (). Convert_templates ('src'DST ')

Source: Converterv0.2.zip

Converter 2:thinkphp template to Django template

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.