File tree Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -4,3 +4,4 @@ __pycache__
4
4
.DS_Store
5
5
github_settings.py
6
6
* .pyc
7
+ .venv
Original file line number Diff line number Diff line change @@ -21,16 +21,20 @@ Then checkout this repository:
21
21
cd ...wherever...
22
22
git clone https://github.com/csev/dj4e-samples.git
23
23
cd dj4e-samples
24
- virtualenv .venv
24
+ python3.11 -m venv .venv
25
25
source .venv/bin/activate
26
26
python --version
27
27
pip install -r requirements42.txt
28
+ python -m django --version
28
29
29
30
python manage.py migrate
30
31
python manage.py createsuperuser --username dj4e-samples
31
32
# python manage.py changepassword dj4e-samples
32
33
# dj4e_nn_!
33
34
35
+ ...
36
+ deactivate
37
+
34
38
Running Locally on the Mac
35
39
--------------------------
36
40
Original file line number Diff line number Diff line change @@ -56,14 +56,19 @@ def post(self, request):
56
56
xmlstr = data .decode ()
57
57
try :
58
58
dom = minidom .parseString (data )
59
- xmlstr = dom . toprettyxml ( encoding = "utf-8" );
59
+ note = ""
60
60
except Exception as e :
61
61
soup = BeautifulSoup (xmlstr , "xml" ) # Use "xml" parser for XML files
62
- # xmlstr = ("XML parse failed "+str(e)+"\n"+"Re-parsed with BeautifulSoup\n").encode() + soup.prettify().encode()
63
62
dom = minidom .parseString (soup .prettify ());
64
- xmlstr = ("XML parse failed " + str (e )+ "\n " + "Re-parsed with BeautifulSoup\n " ).encode () + dom .toprettyxml (encoding = "utf-8" );
65
- pass
66
- xmlstr = xmlstr .decode ()
63
+ note = "XML parse failed " + str (e )+ "\n " + "Re-parsed with BeautifulSoup\n "
64
+ for elem in dom .getElementsByTagName ("property" ):
65
+ print (elem .nodeName )
66
+ if elem .nodeName == "property" :
67
+ if elem .getAttribute ("enc" ) != "BASE64" : continue
68
+ decoded = base64 .b64decode (elem .getAttribute ("value" ))
69
+ elem .setAttribute ("B64Decoded" , decoded .decode ())
70
+ xmlstr = dom .toprettyxml (encoding = "utf-8" );
71
+ xmlstr = note + xmlstr .decode ()
67
72
xmlstr = re .sub (r'^\s*\n' , '' , xmlstr , flags = re .MULTILINE )
68
73
htm = "<pre>\n " + html .escape (xmlstr ) + "\n </pre>\n "
69
74
piece ['html' ] = htm
You can’t perform that action at this time.
0 commit comments