On 07/ 8/10 05:48 PM, Shawn Walker wrote:
...
* instead of having add_cert as its own operation, see if you can
add a new version of the /file/ operation, rename add_cert to
file_1, and have cherrypy use that to handle uploads. Be
certain that it requires a Transaction ID header be present.

So how this would work is that the file_1 function would provide both the retrieval and upload functionality.

If you want to detect if an upload is being done, simply check the cherrypy.request.method property. It will be "GET", "POST", etc.

So something like:

def file_1(self, *tokens):
    """ ... """

    method = cherrypy.request.method
    if method == "GET":
        return self.__get_file(...)
    elif method == "POST":
        return self.__upload_file(...)
    raise cherrypy.HTTPError(httplib.METHOD_NOT_ALLOWED,
        "%s is not allowed." % method)

Cheers,
-Shawn
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to