Skip to content

Commit

Permalink
Minimal port to python3
Browse files Browse the repository at this point in the history
  • Loading branch information
zeha committed Jun 9, 2020
1 parent bc8d681 commit c9d9ead
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion debian/control
Expand Up @@ -13,7 +13,7 @@ Bugs: mailto:bugs@grml.org

Package: grml-paste
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}, python
Depends: ${shlibs:Depends}, ${misc:Depends}, python3
Description: command line interface for paste.grml.org
This package provides a command line interface tool to upload
plain text to http://paste.grml.org/ - being the official paste
Expand Down
20 changes: 10 additions & 10 deletions grml-paste
@@ -1,12 +1,12 @@
#!/usr/bin/python
#!/usr/bin/python3
# Filename: grml-paste
# Purpose: XmlRpc interface client to paste.grml.org
# Author: Michael Gebetsroither <gebi@grml.org>
# License: This file is licensed under the GPL v2.
################################################################################

import sys
import xmlrpclib
from xmlrpc.client import ServerProxy
import optparse
import inspect
import getpass
Expand All @@ -32,7 +32,7 @@ class Action(object):
self.opts_ = opts

def _createProxy(self):
return xmlrpclib.ServerProxy(self.opts_.server, verbose=False)
return ServerProxy(self.opts_.server, verbose=False)

def _callProxy(self, functor, server=None):
'''Wrapper for xml-rpc calls to server which throws an
Expand Down Expand Up @@ -127,10 +127,10 @@ class Action(object):

if alias in actions:
fun = actions[alias]
print inspect.getdoc(self.__getattribute__(fun))
print "\naliase: " + " ".join([i for i in actions_r[fun] if i != alias])
print(inspect.getdoc(self.__getattribute__(fun)))
print("\naliase: " + " ".join([i for i in actions_r[fun] if i != alias]))
else:
print "Error: No such command - %s" % (alias)
print("Error: No such command - %s" % (alias))
OPT_PARSER.print_usage()
sys.exit(0)

Expand Down Expand Up @@ -192,13 +192,13 @@ if __name__ == "__main__":
try:
(msg, ret) = action.call(actions[cmd])
if opts.verbose == 0:
print msg
print(msg)
else:
print ret
except ActionFailedException, e:
print(ret)
except ActionFailedException as e:
sys.stderr.write('Server Error: %s\n' % e.what())
if opts.verbose >0:
print e.dwhat()
print(e.dwhat())
sys.exit(1)
else:
parser.error('Unknown action: %s' % args[0])

0 comments on commit c9d9ead

Please sign in to comment.