- Timestamp:
- 06/10/05 22:39:13 (19 years ago)
- Location:
- pykota/trunk
- Files:
-
- 19 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/cupspykota
r2303 r2308 239 239 self.logdebug("Precomputed job's size is %s pages, price is %s units" % (self.softwareJobSize, self.softwareJobPrice)) 240 240 241 denyduplicates = self.config.getDenyDuplicates(printer.Name) 241 242 if not self.jobSizeBytes : 242 243 # if no data to pass to real backend, probably a filter … … 245 246 self.printMoreInfo(user, printer, _("Job contains no data. Printing is denied."), "warn") 246 247 action = "DENY" 247 elif self.config.getDenyDuplicates(printer.Name)\248 elif denyduplicates \ 248 249 and printer.LastJob.Exists \ 249 250 and (printer.LastJob.UserName == user.Name) \ 250 251 and (printer.LastJob.JobMD5Sum == self.checksum) : 251 self.printMoreInfo(user, printer, _("Job is a duplicate. Printing is denied."), "warn") 252 action = "DENY" 252 if denyduplicates == 1 : 253 self.printMoreInfo(user, printer, _("Job is a duplicate. Printing is denied."), "warn") 254 action = "DENY" 255 else : 256 self.logdebug("Launching subprocess [%s] to see if dupes should be allowed or not." % denyduplicates) 257 fanswer = os.popen(denyduplicates, "r") 258 action = fanswer.read().strip().upper() 259 fanswer.close() 260 if action == "DENY" : 261 self.printMoreInfo(user, printer, _("Job is a duplicate. Printing is denied by subprocess."), "warn") 262 else : 263 self.printMoreInfo(user, printer, _("Job is a duplicate. Printing is allowed by subprocess."), "warn") 264 action = "ALLOW" # just to be sure, in the case the external command returns something else... 253 265 else : 254 266 # checks the user's quota -
pykota/trunk/conf/pykota.conf.sample
r2307 r2308 851 851 # one just after the other. 852 852 # 853 # Possible values are 'yes' and 'no' 854 # 853 # Possible values are 'yes', 'no', or any other string. 854 # If the string is not recognized as a truth value, 855 # it is considered to be a command to launch. 856 # PyKota launches the command and parses its standard 857 # output. The special keywords 'ALLOW' and 'DENY' are 858 # recognized, allowing an external tool to decide if 859 # the job is to be allowed or denied. 860 # 861 # denyduplicates : /usr/bin/myowncommand with some arguments 862 # denyduplicates : yes 855 863 denyduplicates : no 856 864 -
pykota/trunk/NEWS
r2307 r2308 24 24 - 1.23alpha9 : 25 25 26 - The denyduplicates directive now accepts a command line as an 27 argument beside yes/no. The command is launched and must 28 print either ALLOW or DENY to its standard output. Then the 29 job gets allowed or denied by PyKota. 30 This will allow user interaction in the near future. 31 26 32 - Introduced the new 'striptitle' directive to remove ugly prefixes 27 33 from print job's titles whenever a new print job is submitted. -
pykota/trunk/po/de/pykota.po
r2303 r2308 2367 2367 2368 2368 msgid "only for payments or history" 2369 msgstr "" 2370 2371 msgid "Job is a duplicate. Printing is denied by subprocess." 2372 msgstr "" 2373 2374 msgid "Job is a duplicate. Printing is allowed by subprocess." 2369 2375 msgstr "" 2370 2376 -
pykota/trunk/po/el_GR/pykota.po
r2303 r2308 2337 2337 2338 2338 msgid "only for payments or history" 2339 msgstr "" 2340 2341 msgid "Job is a duplicate. Printing is denied by subprocess." 2342 msgstr "" 2343 2344 msgid "Job is a duplicate. Printing is allowed by subprocess." 2339 2345 msgstr "" 2340 2346 -
pykota/trunk/po/es/pykota.po
r2303 r2308 2691 2691 2692 2692 msgid "only for payments or history" 2693 msgstr "" 2694 2695 msgid "Job is a duplicate. Printing is denied by subprocess." 2696 msgstr "" 2697 2698 msgid "Job is a duplicate. Printing is allowed by subprocess." 2693 2699 msgstr "" 2694 2700 -
pykota/trunk/po/fr/pykota.po
r2303 r2308 2808 2808 msgid "only for payments or history" 2809 2809 msgstr "seulement pour les paiements ou l'historique" 2810 2811 msgid "Job is a duplicate. Printing is denied by subprocess." 2812 msgstr "" 2813 "Le travail d'impression est un doublon. Impression interdite par le sous-" 2814 "processus." 2815 2816 msgid "Job is a duplicate. Printing is allowed by subprocess." 2817 msgstr "" 2818 "Le travail d'impression est un doublon. Impression autoris�par le sous-" 2819 "processus." -
pykota/trunk/po/it/pykota.po
r2303 r2308 1929 1929 msgstr "" 1930 1930 1931 msgid "Job is a duplicate. Printing is denied by subprocess." 1932 msgstr "" 1933 1934 msgid "Job is a duplicate. Printing is allowed by subprocess." 1935 msgstr "" 1936 1931 1937 #~ msgid "" 1932 1938 #~ "Group used soft hard balance grace total " -
pykota/trunk/po/nb_NO/pykota.po
r2303 r2308 2291 2291 2292 2292 msgid "only for payments or history" 2293 msgstr "" 2294 2295 msgid "Job is a duplicate. Printing is denied by subprocess." 2296 msgstr "" 2297 2298 msgid "Job is a duplicate. Printing is allowed by subprocess." 2293 2299 msgstr "" 2294 2300 -
pykota/trunk/po/pt_BR/pykota.po
r2303 r2308 1918 1918 msgstr "" 1919 1919 1920 msgid "Job is a duplicate. Printing is denied by subprocess." 1921 msgstr "" 1922 1923 msgid "Job is a duplicate. Printing is allowed by subprocess." 1924 msgstr "" 1925 1920 1926 #~ msgid "" 1921 1927 #~ "Group used soft hard balance grace total " -
pykota/trunk/po/pt/pykota.po
r2303 r2308 1926 1926 msgstr "" 1927 1927 1928 msgid "Job is a duplicate. Printing is denied by subprocess." 1929 msgstr "" 1930 1931 msgid "Job is a duplicate. Printing is allowed by subprocess." 1932 msgstr "" 1933 1928 1934 #~ msgid "" 1929 1935 #~ "Group used soft hard balance grace total " -
pykota/trunk/po/pykota.pot
r2303 r2308 1851 1851 msgid "only for payments or history" 1852 1852 msgstr "" 1853 1854 msgid "Job is a duplicate. Printing is denied by subprocess." 1855 msgstr "" 1856 1857 msgid "Job is a duplicate. Printing is allowed by subprocess." 1858 msgstr "" -
pykota/trunk/po/sv_SE/pykota.po
r2303 r2308 1910 1910 msgstr "" 1911 1911 1912 msgid "Job is a duplicate. Printing is denied by subprocess." 1913 msgstr "" 1914 1915 msgid "Job is a duplicate. Printing is allowed by subprocess." 1916 msgstr "" 1917 1912 1918 #~ msgid "" 1913 1919 #~ "Group used soft hard balance grace total " -
pykota/trunk/po/th/pykota.po
r2303 r2308 1891 1891 msgstr "" 1892 1892 1893 msgid "Job is a duplicate. Printing is denied by subprocess." 1894 msgstr "" 1895 1896 msgid "Job is a duplicate. Printing is allowed by subprocess." 1897 msgstr "" 1898 1893 1899 #~ msgid "" 1894 1900 #~ "Group used soft hard balance grace total " -
pykota/trunk/po/tr/pykota.po
r2303 r2308 2254 2254 msgstr "" 2255 2255 2256 msgid "Job is a duplicate. Printing is denied by subprocess." 2257 msgstr "" 2258 2259 msgid "Job is a duplicate. Printing is allowed by subprocess." 2260 msgstr "" 2261 2256 2262 #~ msgid "" 2257 2263 #~ "Internal SNMP accounting asked, but Python-SNMP is not available. Please " -
pykota/trunk/po/zh_TW/pykota.po
r2303 r2308 1885 1885 msgstr "" 1886 1886 1887 msgid "Job is a duplicate. Printing is denied by subprocess." 1888 msgstr "" 1889 1890 msgid "Job is a duplicate. Printing is allowed by subprocess." 1891 msgstr "" 1892 1887 1893 #~ msgid "" 1888 1894 #~ "Internal SNMP accounting asked, but Python-SNMP is not available. Please " -
pykota/trunk/pykota/config.py
r2307 r2308 49 49 def isTrue(self, option) : 50 50 """Returns 1 if option is set to true, else 0.""" 51 if (option is not None) and (option.upper().strip() in ['Y', 'YES', '1', 'ON', 'T', 'TRUE']) : 51 if (option is not None) and (option.strip().upper() in ['Y', 'YES', '1', 'ON', 'T', 'TRUE']) : 52 return 1 53 else : 54 return 0 55 56 def isFalse(self, option) : 57 """Returns 1 if option is set to false, else 0.""" 58 if (option is not None) and (option.strip().upper() in ['N', 'NO', '0', 'OFF', 'F', 'FALSE']) : 52 59 return 1 53 60 else : … … 394 401 395 402 def getDenyDuplicates(self, printername) : 396 """Returns 1 if we want to deny duplicate jobs, else 0."""403 """Returns 1 or a command if we want to deny duplicate jobs, else 0.""" 397 404 try : 398 return self.isTrue(self.getPrinterOption(printername, "denyduplicates"))405 denyduplicates = self.getPrinterOption(printername, "denyduplicates") 399 406 except PyKotaConfigError : 400 407 return 0 408 else : 409 if self.isTrue(denyduplicates) : 410 return 1 411 elif self.isFalse(denyduplicates) : 412 return 0 413 else : 414 # it's a command to run. 415 return denyduplicates 401 416 402 417 def getWinbindSeparator(self) : -
pykota/trunk/TODO
r2307 r2308 22 22 TODO, in no particular order : 23 23 24 - Allow 'external' syntax for denyduplicates :25 26 in pykota.conf, if denyduplicates is set to :27 28 - yes ==> then duplicates are denied silently (with a log)29 - no (or unset) ==> then duplicates are allowed (without a log)30 - external(some_command_here) then the command is launched31 and its output is parsed, it may contain only ALLOW or DENY.32 And it should handle the dialog with the user, if any.33 34 24 - Add a new external hook to allow the overwriting of the job's ticket 35 25 (mainly username and billing code) at startup time :