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 (Option_repr): New method.
        (cups_OptionType): Set repr function.

git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pycups/trunk@320 e7545f15-59ab-4934-8816-61942c173d0f
  • Loading branch information
twaugh committed Jun 20, 2008
1 parent ef2c337 commit 553136c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
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 (Option_repr): New method.
(cups_OptionType): Set repr function.

* cupsconnection.c (Dest_repr): New method.
(cups_DestType): Set repr function.

Expand Down
15 changes: 13 additions & 2 deletions cupsppd.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* cups - Python bindings for CUPS
* Copyright (C) 2002, 2005, 2006, 2007 Tim Waugh <[email protected]>
* Copyright (C) 2002, 2005, 2006, 2007, 2008 Tim Waugh <[email protected]>
*
* 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
Expand Down Expand Up @@ -783,6 +783,17 @@ Option_dealloc (Option *self)
self->ob_type->tp_free ((PyObject *) self);
}

static PyObject *
Option_repr (Option *self)
{
ppd_option_t *option = self->option;
if (!option)
return PyString_FromFormat ("<cups.Option>");

return PyString_FromFormat ("<cups.Option %s=%s>",
option->keyword, option->defchoice);
}

////////////
// Option // ATTRIBUTES
////////////
Expand Down Expand Up @@ -941,7 +952,7 @@ PyTypeObject cups_OptionType =
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
(reprfunc)Option_repr, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
Expand Down

0 comments on commit 553136c

Please sign in to comment.