* Version $Id$
*
*/
-
/*
- Copyright (C) 2005 Kern Sibbald
+ Copyright (C) 2005-2006 Kern Sibbald
This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of
- the License, or (at your option) any later version.
+ modify it under the terms of the GNU General Public License
+ version 2 as amended with additional clauses defined in the
+ file LICENSE in the main source directory.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- MA 02111-1307, USA.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ the file LICENSE for additional details.
*/
/* Read-only variables */
static struct s_vars getvars[] = {
- { N_("FDName"), "s"}, /* 0 */
- { N_("Level"), "s"}, /* 1 */
- { N_("Type"), "s"}, /* 2 */
- { N_("JobId"), "i"}, /* 3 */
- { N_("Client"), "s"}, /* 4 */
- { N_("JobName"), "s"}, /* 5 */
- { N_("JobStatus"), "s"}, /* 6 */
+ { NT_("FDName"), "s"}, /* 0 */
+ { NT_("Level"), "s"}, /* 1 */
+ { NT_("Type"), "s"}, /* 2 */
+ { NT_("JobId"), "i"}, /* 3 */
+ { NT_("Client"), "s"}, /* 4 */
+ { NT_("JobName"), "s"}, /* 5 */
+ { NT_("JobStatus"), "s"}, /* 6 */
{ NULL, NULL}
};
/* Writable variables */
static struct s_vars setvars[] = {
- { N_("JobReport"), "s"},
+ { NT_("JobReport"), "s"},
{ NULL, NULL}
};
jcr = get_jcr_from_PyObject(self);
if (!jcr) {
- bstrncpy(errmsg, "Job pointer not found.", sizeof(errmsg));
+ bstrncpy(errmsg, _("Job pointer not found."), sizeof(errmsg));
goto bail_out;
}
for (i=0; getvars[i].name; i++) {
buf[0] = jcr->JobStatus;
return Py_BuildValue(getvars[i].fmt, buf);
}
- bsnprintf(errmsg, sizeof(errmsg), "Attribute %s not found.", attrname);
+ bsnprintf(errmsg, sizeof(errmsg), _("Attribute %s not found."), attrname);
bail_out:
PyErr_SetString(PyExc_AttributeError, errmsg);
return NULL;
Dmsg2(100, "In job_setattr=%s val=%p.\n", attrname, value);
if (value == NULL) { /* Cannot delete variables */
- bsnprintf(buf, sizeof(buf), "Cannot delete attribute %s", attrname);
+ bsnprintf(buf, sizeof(buf), _("Cannot delete attribute %s"), attrname);
errmsg = buf;
goto bail_out;
}
jcr = get_jcr_from_PyObject(self);
if (!jcr) {
- errmsg = "Job pointer not found.";
+ errmsg = _("Job pointer not found.");
goto bail_out;
}
}
}
if (!found) {
- bsnprintf(buf, sizeof(buf), "Cannot find attribute %s", attrname);
+ bsnprintf(buf, sizeof(buf), _("Cannot find attribute %s"), attrname);
errmsg = buf;
goto bail_out;
}
/* Get argument value ***FIXME*** handle other formats */
if (setvars[i].fmt != NULL) {
if (!PyArg_Parse(value, setvars[i].fmt, &strval)) {
- PyErr_SetString(PyExc_TypeError, "Read-only attribute");
+ PyErr_SetString(PyExc_TypeError, _("Read-only attribute"));
return -1;
}
}
Jmsg(jcr, M_INFO, 0, "%s", strval);
return 0;
}
- bsnprintf(buf, sizeof(buf), "Cannot find attribute %s", attrname);
+ bsnprintf(buf, sizeof(buf), _("Cannot find attribute %s"), attrname);
errmsg = buf;
bail_out:
PyErr_SetString(PyExc_AttributeError, errmsg);
}
jcr = get_jcr_from_PyObject(self);
if (!jcr) {
- PyErr_SetString(PyExc_AttributeError, "Job pointer not found.");
+ PyErr_SetString(PyExc_AttributeError, _("Job pointer not found."));
return NULL;
}
Py_XDECREF((PyObject *)jcr->Python_events); /* release any old events Object */
return 0;
}
- PyEval_AcquireLock();
+ lock_python();
+// PyEval_AcquireLock();
method = find_method(events, method, event);
if (!method) {
Py_XDECREF(result);
bail_out:
- PyEval_ReleaseLock();
+ unlock_python();
+// PyEval_ReleaseLock();
return stat;
}