简体   繁体   中英

z3c.form issue: ImportError: No module named ptcompat

Has z3c.form API changes recently. I try to do following:

  from z3c.form.ptcompat import ViewPageTemplateFile
  widget.template = ViewPageTemplateFile("templates/minmax.pt")

I get:

  ImportError: No module named ptcompat

How to fix?

You should be using the z3c.ptcompat package instead.

The z3c.form.ptcompat module was removed for the z3c.form 2.5.0 release in October 2011.

When using z3c.ptcompat , replace your import with:

zope.browserpage.viewpagetemplatefile import ViewPageTemplateFile
widget.template = ViewPageTemplateFile("templates/minmax.pt")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM