Index: services/univention-printserver/cups-printers.py =================================================================== --- services/univention-printserver/cups-printers.py (Revision 15303) +++ services/univention-printserver/cups-printers.py (Arbeitskopie) @@ -53,7 +53,11 @@ f=open(filename, 'w+') os.chmod(filename, 0755) print >>f, '#!/bin/sh' - print >>f, '/usr/sbin/univention-lpadmin %s' % string.join(args, ' ') + # Escape args with '-quotes to allow spaces and special characters. + #+ Therefore each ' in the arg must be escaped or it would end the string prematurely: + #+ To escape a ' the string must be closed ('___') then a __'__ is inserted escaped by surrounding _"_"_ + #+ therefore each ' is replaced by '"'"'. '"'"' as python string is """'"'"'""" or "'\"'\"'" or '\'"\'"\'' + print >>f, '/usr/sbin/univention-lpadmin ' + ' '.join(map(lambda x: "'%s'" % x.replace("'", """'"'"'"""), args)) f.close() def pkprinters(args):