[wingide-users] OS Commands

Mike Weichert mweichert at gmail.com
Sun Oct 21 11:05:30 MDT 2007


I have a python script that I use to validate zope page templates.
It's a simple script that works well. I edit my page templates using
wingide. I've setup an os command to call this script using the
following command: zpt-validator %s

The script gets called, but WING_FILENAME doesn't get passed as an argument.

Here is the script that I call:
---
#!/opt/Plone-2.5.3/bin/python

from Products.PageTemplates.PageTemplateFile import PageTemplateFile
import sys

pt = None

if len(sys.argv) > 1:
  try:
    pt = PageTemplateFile(sys.argv[1])
    pt.read()
  except:
    print "Could not open or read %s" % sys.argv[1]
  else:
    if pt:
      errors = pt.pt_errors()
      if errors:
        for error in errors:
          print error
      else:
        print "No errors found in %s" % sys.argv[1]
else:
  print "Usage: zpt-validator [filename]"
  print "Arguments received: %s" % sys.argv
---

Thanks,
Mike


More information about the wingide-users mailing list