How to access a var like WORKSPACE_LOC from jython scripting (pytemplate_xx.py)?

28 views Asked by At

I'm trying to add my user variables to use them for templates in PyDev. After reading this plugins/org.python.pydev.jython/jysrc/pytemplate_defaults.py I created a file pytemplate_from_ini.py, and put there something like

import template_helper
from configparser import ConfigParser

def GetIniUserEmail(context):

    ini_path = ? # This is located in workspace dir, or in project dir. How to get them from given context?

    ini = ConfigParser()
    ini.read(ini_path)
    return ini.get("user", "user_email", fallback="user_email")

template_helper.AddTemplateVariable(py_context_type, 'user_email', 'My user email from ini', GetIniUserEmail)

So, the question is how can I get values for ${WORKSPACE_LOC}, ${PROJECT_DIR_NAME}, etc in python from passed context variable?

0

There are 0 answers