Skip to content

Commit

Permalink
2008-06-20 Tim Waugh <[email protected]>
Browse files Browse the repository at this point in the history
        * cupsppd.c (Attribute_repr): New method.
        (cups_AttributeType): Set repr function.

git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pycups/trunk@322 e7545f15-59ab-4934-8816-61942c173d0f
  • Loading branch information
twaugh committed Jun 20, 2008
1 parent 2daafca commit 25035e7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
2008-06-20 Tim Waugh <[email protected]>

* cupsppd.c (Attribute_repr): New method.
(cups_AttributeType): Set repr function.

* cupsppd.c (Group_repr): New method.
(cups_GroupType): Set repr function.

Expand Down
15 changes: 14 additions & 1 deletion cupsppd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1372,6 +1372,19 @@ Attribute_dealloc (Attribute *self)
self->ob_type->tp_free ((PyObject *) self);
}

static PyObject *
Attribute_repr (Attribute *self)
{
ppd_attr_t *attribute = self->attribute;
if (!attribute)
return PyString_FromString ("<cups.Attribute>");

return PyString_FromFormat ("<cups.Attribute *%s%s%s>",
attribute->name,
attribute->spec[0] != '\0' ? " ": "",
attribute->spec);
}

///////////////
// Attribute // ATTRIBUTES
///////////////
Expand Down Expand Up @@ -1453,7 +1466,7 @@ PyTypeObject cups_AttributeType =
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
(reprfunc)Attribute_repr, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
Expand Down

0 comments on commit 25035e7

Please sign in to comment.