Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Titouan Soulard
erp5
Commits
37c1af0a
Commit
37c1af0a
authored
Aug 26, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into zope4py3
parents
2f19899b
ae7f0809
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
106 additions
and
31 deletions
+106
-31
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testRestrictedPythonSecurity.py
...rtal_components/test.erp5.testRestrictedPythonSecurity.py
+56
-0
bt5/erp5_l10n_ja/bt/dependency_list
bt5/erp5_l10n_ja/bt/dependency_list
+1
-0
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_dronelogfollower_js.js
...em/web_page_module/drone_simulator_dronelogfollower_js.js
+5
-0
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_dronelogfollower_js.xml
...m/web_page_module/drone_simulator_dronelogfollower_js.xml
+2
-2
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_fixedwingdrone_js.js
...Item/web_page_module/drone_simulator_fixedwingdrone_js.js
+6
-3
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_fixedwingdrone_js.xml
...tem/web_page_module/drone_simulator_fixedwingdrone_js.xml
+2
-2
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_logic_js.js
...hTemplateItem/web_page_module/drone_simulator_logic_js.js
+21
-12
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_logic_js.xml
...TemplateItem/web_page_module/drone_simulator_logic_js.xml
+2
-2
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/web_page_module/test_drone_simulator_flight_js.js
...ateItem/web_page_module/test_drone_simulator_flight_js.js
+1
-1
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/web_page_module/test_drone_simulator_flight_js.xml
...teItem/web_page_module/test_drone_simulator_flight_js.xml
+2
-2
bt5/erp5_trade/PortalTypeTemplateItem/portal_types/Delivery%20Node%20Module.xml
...ypeTemplateItem/portal_types/Delivery%20Node%20Module.xml
+0
-6
product/CMFActivity/Activity/SQLBase.py
product/CMFActivity/Activity/SQLBase.py
+1
-1
product/ERP5Type/patches/Restricted.py
product/ERP5Type/patches/Restricted.py
+5
-0
product/ERP5Type/patches/sqlvar.py
product/ERP5Type/patches/sqlvar.py
+2
-0
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testRestrictedPythonSecurity.py
View file @
37c1af0a
...
@@ -853,6 +853,62 @@ class TestRestrictedPythonSecurity(ERP5TypeTestCase):
...
@@ -853,6 +853,62 @@ class TestRestrictedPythonSecurity(ERP5TypeTestCase):
return ip_interface(u'2a01:cb14:818:0:7312:e251:f251:ffbe').with_prefixlen
return ip_interface(u'2a01:cb14:818:0:7312:e251:f251:ffbe').with_prefixlen
'''
)
'''
)
def
testPytzNonExistentTimeError
(
self
):
"""
Test if we can import NonExistentTimeError from the
pytz package. This is important to catch exceptions
which can be raised by pandas tz_localize, see:
https://pandas.pydata.org/pandas-docs/version/2.0.3/reference/api/pandas.Series.tz_localize.html
Test data/structure taken from
https://github.com/pandas-dev/pandas/blob/c1f673b71d2a4a7d11cb05d4803f279914c543d4/pandas/tests/scalar/timestamp/test_timezones.py#L124-L141
"""
self
.
createAndRunScript
(
'''
import pandas as pd
import pytz
ts = pd.Timestamp("2015-03-08 02:00")
try:
ts.tz_localize("US/Eastern")
except pytz.NonExistentTimeError:
return "not existent time error"
'''
,
expected
=
"not existent time error"
)
def
testPytzExceptions
(
self
):
"""
Test that all pytz exceptions can be used in restricted python.
All of them are very simple classes that can't harm the system.
"""
self
.
createAndRunScript
(
'''
import pytz
c = 0
for e in 'UnknownTimeZoneError InvalidTimeError AmbiguousTimeError NonExistentTimeError'.split():
getattr(pytz, e)
c += 1
return c
'''
,
expected
=
4
,
)
def
testPytzProhibitedObjects
(
self
):
"""
Test that prohibited objects of the pytz module can't be
used within restricted python.
"""
self
.
assertRaises
(
ZopeGuardsUnauthorized
,
self
.
createAndRunScript
,
'''
import pytz
pytz.timezone
'''
)
def
add_tests
(
suite
,
module
):
def
add_tests
(
suite
,
module
):
if
hasattr
(
module
,
'test_suite'
):
if
hasattr
(
module
,
'test_suite'
):
...
...
bt5/erp5_l10n_ja/bt/dependency_list
0 → 100644
View file @
37c1af0a
erp5_base
\ No newline at end of file
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_dronelogfollower_js.js
View file @
37c1af0a
...
@@ -13,6 +13,11 @@ var DroneLogAPI = /** @class */ (function () {
...
@@ -13,6 +13,11 @@ var DroneLogAPI = /** @class */ (function () {
this
.
_drone_info
=
drone_info
;
this
.
_drone_info
=
drone_info
;
this
.
_flight_parameters
=
flight_parameters
;
this
.
_flight_parameters
=
flight_parameters
;
}
}
Object
.
defineProperty
(
DroneLogAPI
.
prototype
,
"
isCollidable
"
,
{
get
:
function
()
{
return
false
;
},
enumerable
:
true
,
configurable
:
true
});
/*
/*
** Function called at start phase of the drone, just before onStart AI script
** Function called at start phase of the drone, just before onStart AI script
*/
*/
...
...
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_dronelogfollower_js.xml
View file @
37c1af0a
...
@@ -246,7 +246,7 @@
...
@@ -246,7 +246,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1010.13
157.33937.23381
</string>
</value>
<value>
<string>
1010.13
501.40623.51950
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -266,7 +266,7 @@
...
@@ -266,7 +266,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1691
051883.97
</float>
<float>
1691
588429.76
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_fixedwingdrone_js.js
View file @
37c1af0a
...
@@ -32,6 +32,11 @@ var FixedWingDroneAPI = /** @class */ (function () {
...
@@ -32,6 +32,11 @@ var FixedWingDroneAPI = /** @class */ (function () {
this
.
_loiter_mode
=
false
;
this
.
_loiter_mode
=
false
;
this
.
_drone_dict_list
=
[];
this
.
_drone_dict_list
=
[];
}
}
Object
.
defineProperty
(
FixedWingDroneAPI
.
prototype
,
"
isCollidable
"
,
{
get
:
function
()
{
return
true
;
},
enumerable
:
true
,
configurable
:
true
});
/*
/*
** Function called on start phase of the drone, just before onStart AI script
** Function called on start phase of the drone, just before onStart AI script
*/
*/
...
@@ -393,9 +398,7 @@ var FixedWingDroneAPI = /** @class */ (function () {
...
@@ -393,9 +398,7 @@ var FixedWingDroneAPI = /** @class */ (function () {
}
}
var
processed_coordinates
=
var
processed_coordinates
=
this
.
_mapManager
.
convertToLocalCoordinates
(
lat
,
lon
,
z
);
this
.
_mapManager
.
convertToLocalCoordinates
(
lat
,
lon
,
z
);
if
(
processed_coordinates
.
z
>
this
.
_map_dict
.
start_AMSL
)
{
processed_coordinates
.
z
-=
this
.
_map_dict
.
start_AMSL
;
processed_coordinates
.
z
-=
this
.
_map_dict
.
start_AMSL
;
}
//this._last_altitude_point_reached = -1;
//this._last_altitude_point_reached = -1;
//this.takeoff_path = [];
//this.takeoff_path = [];
return
processed_coordinates
;
return
processed_coordinates
;
...
...
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_fixedwingdrone_js.xml
View file @
37c1af0a
...
@@ -240,7 +240,7 @@
...
@@ -240,7 +240,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1010.
13155.61424.54442
</string>
</value>
<value>
<string>
1010.
22099.47894.60006
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -260,7 +260,7 @@
...
@@ -260,7 +260,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1691
051762.91
</float>
<float>
1691
588633.42
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_logic_js.js
View file @
37c1af0a
...
@@ -37,7 +37,7 @@ var DroneManager = /** @class */ (function () {
...
@@ -37,7 +37,7 @@ var DroneManager = /** @class */ (function () {
// Create the control mesh
// Create the control mesh
this
.
_controlMesh
=
BABYLON
.
Mesh
.
CreateBox
(
this
.
_controlMesh
=
BABYLON
.
Mesh
.
CreateBox
(
"
droneControl_
"
+
id
,
"
droneControl_
"
+
id
,
0.01
,
1.55
,
// 155 cm long wingspan
this
.
_scene
this
.
_scene
);
);
this
.
_controlMesh
.
isVisible
=
false
;
this
.
_controlMesh
.
isVisible
=
false
;
...
@@ -421,7 +421,7 @@ var MapManager = /** @class */ (function () {
...
@@ -421,7 +421,7 @@ var MapManager = /** @class */ (function () {
[
map_dict
.
min_lat
,
map_dict
.
max_lon
]),
[
map_dict
.
min_lat
,
map_dict
.
max_lon
]),
max_height
=
this
.
latLonDistance
([
map_dict
.
min_lat
,
map_dict
.
min_lon
],
max_height
=
this
.
latLonDistance
([
map_dict
.
min_lat
,
map_dict
.
min_lon
],
[
map_dict
.
max_lat
,
map_dict
.
min_lon
]),
[
map_dict
.
max_lat
,
map_dict
.
min_lon
]),
map_size
=
Math
.
ceil
(
Math
.
max
(
max_width
,
max_height
))
*
0.6
;
map_size
=
Math
.
ceil
(
Math
.
max
(
max_width
,
max_height
));
this
.
map_info
=
{
this
.
map_info
=
{
"
depth
"
:
map_size
,
"
depth
"
:
map_size
,
"
height
"
:
map_dict
.
height
,
"
height
"
:
map_dict
.
height
,
...
@@ -622,13 +622,14 @@ var GameManager = /** @class */ (function () {
...
@@ -622,13 +622,14 @@ var GameManager = /** @class */ (function () {
this
.
_flight_log
[
drone
.
_id
].
push
(
error
.
stack
);
this
.
_flight_log
[
drone
.
_id
].
push
(
error
.
stack
);
};
};
GameManager
.
prototype
.
_checkDroneRules
=
function
(
drone
)
{
GameManager
.
prototype
.
_checkCollision
=
function
(
drone
,
other
)
{
//TODO move this to API methods.
if
(
drone
.
colliderMesh
&&
other
.
colliderMesh
&&
//each type of drone should define its rules
drone
.
colliderMesh
.
intersectsMesh
(
other
.
colliderMesh
,
false
))
{
if
(
drone
.
getCurrentPosition
())
{
drone
.
_internal_crash
(
new
Error
(
'
Drone
'
+
drone
.
id
+
return
drone
.
getCurrentPosition
().
z
>
1
;
'
touched drone
'
+
other
.
id
+
'
.
'
));
other
.
_internal_crash
(
new
Error
(
'
Drone
'
+
drone
.
id
+
'
touched drone
'
+
other
.
id
+
'
.
'
));
}
}
return
false
;
};
};
GameManager
.
prototype
.
_update
=
function
(
delta_time
,
fullscreen
)
{
GameManager
.
prototype
.
_update
=
function
(
delta_time
,
fullscreen
)
{
...
@@ -664,11 +665,19 @@ var GameManager = /** @class */ (function () {
...
@@ -664,11 +665,19 @@ var GameManager = /** @class */ (function () {
this
.
_droneList
.
forEach
(
function
(
drone
)
{
this
.
_droneList
.
forEach
(
function
(
drone
)
{
queue
.
push
(
function
()
{
queue
.
push
(
function
()
{
drone
.
_tick
+=
1
;
drone
.
_tick
+=
1
;
if
(
_this
.
_checkDroneRules
(
drone
))
{
if
(
drone
.
_API
.
isCollidable
&&
drone
.
can_play
)
{
return
drone
.
internal_update
(
delta_time
);
if
(
drone
.
getCurrentPosition
().
z
<=
0
)
{
drone
.
_internal_crash
(
new
Error
(
'
Drone
'
+
drone
.
id
+
'
touched the floor.
'
));
}
else
{
_this
.
_droneList
.
forEach
(
function
(
other
)
{
if
(
other
.
can_play
&&
drone
.
id
!==
other
.
id
)
{
_this
.
_checkCollision
(
drone
,
other
);
}
});
}
}
}
//TODO error must be defined by the api?
return
drone
.
internal_update
(
delta_time
);
drone
.
_internal_crash
(
'
Drone touched the floor
'
);
});
});
});
});
...
...
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_logic_js.xml
View file @
37c1af0a
...
@@ -240,7 +240,7 @@
...
@@ -240,7 +240,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1010.
13183.29224.8874
</string>
</value>
<value>
<string>
1010.
42341.16308.11025
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -260,7 +260,7 @@
...
@@ -260,7 +260,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
169
1053915.45
</float>
<float>
169
2802878.6
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/web_page_module/test_drone_simulator_flight_js.js
View file @
37c1af0a
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
'
me.setTargetCoordinates(
\n
'
+
'
me.setTargetCoordinates(
\n
'
+
'
me.initialPosition.x + 0.01,
\n
'
+
'
me.initialPosition.x + 0.01,
\n
'
+
'
me.initialPosition.y,
\n
'
+
'
me.initialPosition.y,
\n
'
+
'
me.
initialPosition.z
\n
'
+
'
me.
getAltitudeAbs()
\n
'
+
'
);
\n
'
+
'
);
\n
'
+
'
};
\n
'
+
'
};
\n
'
+
'
\n
'
+
'
\n
'
+
...
...
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/web_page_module/test_drone_simulator_flight_js.xml
View file @
37c1af0a
...
@@ -246,7 +246,7 @@
...
@@ -246,7 +246,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1010.1
0621.5765.11161
</string>
</value>
<value>
<string>
1010.1
2196.1891.61832
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -266,7 +266,7 @@
...
@@ -266,7 +266,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
169
0900659.22
</float>
<float>
169
1485888.5
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_trade/PortalTypeTemplateItem/portal_types/Delivery%20Node%20Module.xml
View file @
37c1af0a
...
@@ -76,12 +76,6 @@
...
@@ -76,12 +76,6 @@
<tuple/>
<tuple/>
</value>
</value>
</item>
</item>
<item>
<key>
<string>
type_mixin
</string>
</key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
...
...
product/CMFActivity/Activity/SQLBase.py
View file @
37c1af0a
...
@@ -1048,7 +1048,7 @@ CREATE TABLE %s (
...
@@ -1048,7 +1048,7 @@ CREATE TABLE %s (
" date = DATE_ADD(UTC_TIMESTAMP(6), INTERVAL %s SECOND)"
" date = DATE_ADD(UTC_TIMESTAMP(6), INTERVAL %s SECOND)"
"%s WHERE uid IN (%s)"
%
(
"%s WHERE uid IN (%s)"
%
(
self
.
sql_table
,
delay
,
self
.
sql_table
,
delay
,
",
priority = priority + 1,
retry = retry + 1"
if
retry
else
""
,
", retry = retry + 1"
if
retry
else
""
,
","
.
join
(
map
(
str
,
uid_list
))))
","
.
join
(
map
(
str
,
uid_list
))))
def
finalizeMessageExecution
(
self
,
activity_tool
,
message_list
,
def
finalizeMessageExecution
(
self
,
activity_tool
,
message_list
,
...
...
product/ERP5Type/patches/Restricted.py
View file @
37c1af0a
...
@@ -584,6 +584,11 @@ else:
...
@@ -584,6 +584,11 @@ else:
allow_full_write
(
pd
.
MultiIndex
)
allow_full_write
(
pd
.
MultiIndex
)
allow_full_write
(
pd
.
Index
)
allow_full_write
(
pd
.
Index
)
# pytz exceptions are sometimes needed when using pandas
# see https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.tz_localize.html
for
e
in
'UnknownTimeZoneError InvalidTimeError AmbiguousTimeError NonExistentTimeError'
.
split
():
ModuleSecurityInfo
(
'pytz'
).
declarePublic
(
e
)
import
ipaddress
import
ipaddress
allow_module
(
'ipaddress'
)
allow_module
(
'ipaddress'
)
allow_type
(
ipaddress
.
IPv4Address
)
allow_type
(
ipaddress
.
IPv4Address
)
...
...
product/ERP5Type/patches/sqlvar.py
View file @
37c1af0a
...
@@ -74,6 +74,8 @@ if IS_ZOPE2: # BBB Zope2
...
@@ -74,6 +74,8 @@ if IS_ZOPE2: # BBB Zope2
elif
t
==
'nb'
and
not
v
:
elif
t
==
'nb'
and
not
v
:
t
=
'empty string'
t
=
'empty string'
else
:
else
:
if
v
is
None
:
return
'null'
v
=
md
.
getitem
(
'sql_quote__'
,
0
)(
v
=
md
.
getitem
(
'sql_quote__'
,
0
)(
v
if
isinstance
(
v
,
basestring
)
else
str
(
v
))
v
if
isinstance
(
v
,
basestring
)
else
str
(
v
))
#if find(v,"\'") >= 0: v=join(split(v,"\'"),"''")
#if find(v,"\'") >= 0: v=join(split(v,"\'"),"''")
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment