Skip to content

Commit 7693036

Browse files
author
MichalO
committed
Merge remote-tracking branch 'remotes/origin/main' into origin/BUG-176725_WS_Thickness_layers_direction
2 parents 234a55d + 8460b8d commit 7693036

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

RFEM/initModel.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import RFEM.dependencies # dependency check ahead of imports
44
import socket
55
import requests
6+
import xmltodict
7+
from urllib import request
68
from suds import WebFault
79
from suds.client import Client
810
from RFEM.enums import ObjectTypes, ModelType, AddOn
@@ -42,14 +44,23 @@ def connectToServer(url=connectionGlobals.url, port=connectionGlobals.port):
4244
a_socket.close()
4345
sys.exit()
4446

45-
# Delete cached WSDL older than 1 day to reflect newer version of RFEM
47+
# Delete old cache if the version or mode doesn't correlate
4648
connectionGlobals.cacheLoc = os.path.join(gettempdir(), 'WSDL')
47-
currentTime = time.time()
49+
new_wsdl = request.urlopen(urlAndPort+'/wsdl')
50+
new_wsdl_data = new_wsdl.read()
51+
new_wsdl.close()
52+
new_tns = xmltodict.parse(new_wsdl_data)['definitions']['@targetNamespace']
53+
4854
if os.path.exists(connectionGlobals.cacheLoc):
4955
for file in os.listdir(connectionGlobals.cacheLoc):
5056
filePath = os.path.join(connectionGlobals.cacheLoc, file)
51-
if (currentTime - os.path.getmtime(filePath)) > 86400:
52-
os.remove(filePath)
57+
if file.endswith('.xml'):
58+
with open(filePath,'r', encoding='utf-8') as old_wsdl:
59+
old_wsdl_data = old_wsdl.read()
60+
old_wsdl.close()
61+
old_tns = xmltodict.parse(old_wsdl_data)['definitions']['@targetNamespace']
62+
if new_tns != old_tns:
63+
os.remove(filePath)
5364

5465
# Check for issues locally and remotely
5566
try:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
setup(
99
name='RFEM',
10-
version='1.19.3',
10+
version='1.19.4',
1111
description='Python Framework for RFEM6 Web Services',
1212
long_description=readme,
1313
long_description_content_type = "text/markdown",

0 commit comments

Comments
 (0)