Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

think of a more convenient way to pass requested attributes #12

Closed
sbellem opened this issue Dec 4, 2013 · 2 comments
Closed

think of a more convenient way to pass requested attributes #12

sbellem opened this issue Dec 4, 2013 · 2 comments
Assignees
Labels

Comments

@sbellem
Copy link
Contributor

sbellem commented Dec 4, 2013

For instance:

when requesting the attributes of a printer, if one wishes to only retrieve the name and state, the current way will be:

requested_attributes = 'printer-name,printer-state'
get_printer_attributes(uri, printer_uri=printer_uri, requested_attributes=requested_attributes)

one approach that would perhaps be more convenient would be the possibility to pass the requested attributes as a tuple, or list ...

requested_attributes = ('printer-name' , 'printer-state')
get_printer_attributes(uri, printer_uri=printer_uri, requested_attributes=requested_attributes)

we would then internally convert the list/tuple into a string ...

def get_printer_attributes(uri,
                           printer_uri=None,
                           requesting_user_name=colander.null,
                           requested_attributes=colander.null):
    if requested_attributes:
        requested_attributes = ','.join(requested_attributes)
    # ...    

thus allowing users of the function to simply pass a list/tuple for the attributes they wish to retrieve

this obviously requires the user to properly use the function, meaning that passing a string won't work, for instance ...

@ghost ghost assigned sbellem Dec 4, 2013
@ticosax
Copy link
Contributor

ticosax commented Dec 4, 2013

Not sure it is a good idea.
Users of pyipptool should know IPP. Since the protocol mention that requested_attributes is a string containing comma separated tokens. I would prefer to stick with the protocol. For sake of consistency.

@ticosax
Copy link
Contributor

ticosax commented Jan 3, 2014

I changed my mind. Let's go for it. Since we give arguments like True or False, that are pythonic, accepting a tuple, will be more consistent.

But the transformation of list to string must be done in Widgets

ticosax pushed a commit to ticosax/pyipptool that referenced this issue Jan 3, 2014
@ticosax ticosax closed this as completed Jan 8, 2014
ticosax pushed a commit to ticosax/pyipptool that referenced this issue Feb 5, 2014
ticosax pushed a commit to ticosax/pyipptool that referenced this issue Feb 5, 2014
sbellem added a commit that referenced this issue Feb 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants