comparison roundup/cgi/client.py @ 7813:928c20d4344b

chore(ruff): sort imports; tuples for import not supported in python2.
author John Rouillard <rouilj@ieee.org>
date Sat, 16 Mar 2024 21:31:26 -0400
parents be6cb2e0d471
children 9adf37c63b56
comparison
equal deleted inserted replaced
7812:ecc34b7917e2 7813:928c20d4344b
13 import re 13 import re
14 import socket 14 import socket
15 import stat 15 import stat
16 import sys 16 import sys
17 import time 17 import time
18
19 from email.mime.multipart import MIMEMultipart 18 from email.mime.multipart import MIMEMultipart
20 from traceback import format_exc 19 from traceback import format_exc
20
21 try: 21 try:
22 from OpenSSL.SSL import SysCallError 22 from OpenSSL.SSL import SysCallError
23 except ImportError: 23 except ImportError:
24 class SysCallError(Exception): 24 class SysCallError(Exception):
25 pass 25 pass
26 26
27 import roundup.anypy.email_ # noqa: F401 -- patches for email library code
28 from roundup import hyperdb, rest, xmlrpc
29 # quality of random checked below
30 from roundup.anypy import http_, random_, urllib_, xmlrpc_
27 from roundup.anypy.cgi_ import cgi 31 from roundup.anypy.cgi_ import cgi
28 import roundup.anypy.email_ # noqa: F401 -- patches for email library code 32 from roundup.anypy.cookie_ import BaseCookie, CookieError, SimpleCookie, get_cookie_date
29 import roundup.anypy.random_ as random_ # quality of random checked below
30
31 from roundup import hyperdb, rest, xmlrpc
32
33 from roundup.anypy import http_, urllib_, xmlrpc_
34 from roundup.anypy.cookie_ import BaseCookie, CookieError, get_cookie_date, \
35 SimpleCookie
36 from roundup.anypy.html import html_escape 33 from roundup.anypy.html import html_escape
37 from roundup.anypy.strings import s2b, b2s, bs2b, uchr, is_us 34 from roundup.anypy.strings import b2s, bs2b, is_us, s2b, uchr
38 35 from roundup.cgi import TranslationService, accept_language, actions, cgitb, templating
39 from roundup.cgi import accept_language, actions, cgitb, templating, \ 36 from roundup.cgi.exceptions import DetectorError, FormError, \
40 TranslationService 37 IndexerQueryError, NotFound, NotModified, Redirect, SendFile, \
41 from roundup.cgi.exceptions import ( 38 SendStaticFile, SeriousError
42 DetectorError, FormError, IndexerQueryError, NotFound, NotModified, 39
43 Redirect, SendFile, SendStaticFile, SeriousError)
44 from roundup.cgi.form_parser import FormParser 40 from roundup.cgi.form_parser import FormParser
45
46 from roundup.exceptions import LoginError, RateLimitExceeded, Reject, \ 41 from roundup.exceptions import LoginError, RateLimitExceeded, Reject, \
47 RejectRaw, Unauthorised, UsageError 42 RejectRaw, Unauthorised, UsageError
48
49 from roundup.mailer import Mailer, MessageSendError 43 from roundup.mailer import Mailer, MessageSendError
50 44
51 logger = logging.getLogger('roundup') 45 logger = logging.getLogger('roundup')
52 46
53 if not random_.is_weak: 47 if not random_.is_weak:
54 logger.debug("Importing good random generator") 48 logger.debug("Importing good random generator")
55 else: 49 else:
56 logger.warning("**SystemRandom not available. Using poor random generator") 50 logger.warning("**SystemRandom not available. Using poor random generator")
57
58 51
59 def initialiseSecurity(security): 52 def initialiseSecurity(security):
60 '''Create some Permissions and Roles on the security object 53 '''Create some Permissions and Roles on the security object
61 54
62 This function is directly invoked by security.Security.__init__() 55 This function is directly invoked by security.Security.__init__()

Roundup Issue Tracker: http://roundup-tracker.org/