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
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
4a31baf4
Commit
4a31baf4
authored
Jul 01, 2020
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Products.ERP5Type: Remove modules never used since their introduction many years ago.
parent
04d33bdf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
176 deletions
+0
-176
product/ERP5Type/Context.py
product/ERP5Type/Context.py
+0
-86
product/ERP5Type/Errors.py
product/ERP5Type/Errors.py
+0
-10
product/ERP5Type/SSHConnection.py
product/ERP5Type/SSHConnection.py
+0
-80
No files found.
product/ERP5Type/Context.py
deleted
100644 → 0
View file @
04d33bdf
##############################################################################
#
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
Acquisition
import
aq_base
from
Products.ERP5Type.Globals
import
InitializeClass
from
Products.ERP5Type.Base
import
TempBase
from
zLOG
import
LOG
def
newContext
(
context
=
None
,
REQUEST
=
None
,
**
kw
):
# Create context object
context_obj
=
Context
(
context
=
context
,
REQUEST
=
REQUEST
,
**
kw
)
# Wrap the context
if
context
is
not
None
:
return
context_obj
.
asContext
(
context
=
context
)
else
:
return
context_obj
class
Context
(
TempBase
):
"""
Context objects are used all over ERP5 in so-called context
dependent function. Examples of context dependent methods
include:
- price methods (price depends on the context: customer,
quantity, etc.)
- BOM methods
"""
def
__init__
(
self
,
context
=
None
,
REQUEST
=
None
,
**
kw
):
"""
context -- The
REQUEST -- the request object
kw -- user specified parameters
"""
# Copy REQUEST properties to self
if
REQUEST
is
not
None
:
self
.
__dict__
.
update
(
REQUEST
)
# Define local properties
if
kw
is
not
None
:
self
.
__dict__
.
update
(
kw
)
def
asContext
(
self
,
context
=
None
,
REQUEST
=
None
,
**
kw
):
"""
Update args of context
"""
# Copy REQUEST properties to self
if
REQUEST
is
not
None
:
aq_base
(
self
).
__dict__
.
update
(
REQUEST
)
# Define local properties
if
kw
is
not
None
:
aq_base
(
self
).
__dict__
.
update
(
kw
)
# Wrap context
if
context
is
not
None
:
return
self
.
__of__
(
context
)
else
:
return
self
InitializeClass
(
Context
)
product/ERP5Type/Errors.py
View file @
4a31baf4
...
...
@@ -18,15 +18,6 @@ class DeferredCatalogError(Exception):
self
.
field_id
=
context
.
getRelativeUrl
()
class
SSHConnectionError
(
Exception
):
def
__init__
(
self
,
message
):
Exception
.
__init__
(
self
,
message
)
self
.
message
=
message
def
__str__
(
self
):
return
self
.
message
class
UnsupportedWorkflowMethod
(
WorkflowException
):
def
__init__
(
self
,
instance
,
workflow_id
,
transition_id
):
...
...
@@ -48,7 +39,6 @@ class SimulationError(Exception):pass
allow_class
(
DeferredCatalogError
)
allow_class
(
SSHConnectionError
)
allow_class
(
ImmobilisationValidityError
)
allow_class
(
ImmobilisationCalculationError
)
allow_class
(
WorkflowException
)
...
...
product/ERP5Type/SSHConnection.py
deleted
100644 → 0
View file @
04d33bdf
##############################################################################
#
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Lucas Carvalho Teixeira <lucas@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
Products.ERP5Type.Globals
import
InitializeClass
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type.Errors
import
SSHConnectionError
from
zLOG
import
LOG
,
WARNING
try
:
import
paramiko
from
paramiko.ssh_exception
import
SSHException
except
ImportError
:
LOG
(
WARNING
,
0
,
'The SSHConnection can not be used because Paramiko '
'is not installed!'
)
import
os
class
SSHConnection
(
object
):
"""
Holds an SHH connection to a remote SSH server.
"""
security
=
ClassSecurityInfo
()
def
__init__
(
self
,
username
,
host
,
port
,
key_path
):
self
.
username
=
username
self
.
host
=
host
self
.
port
=
port
if
os
.
path
.
exists
(
key_path
):
self
.
key_path
=
key_path
else
:
raise
ValueError
,
'key_path does not exist: %s'
%
key_path
security
.
declarePublic
(
Permissions
.
ManagePortal
,
'connect'
)
def
connect
(
self
):
"""
Get a handle to a remote connection.
"""
self
.
transport
=
paramiko
.
Transport
((
self
.
host
,
int
(
self
.
port
)))
rsa_key
=
paramiko
.
RSAKey
.
from_private_key_file
(
self
.
key_path
)
try
:
self
.
transport
.
connect
(
username
=
self
.
username
,
pkey
=
rsa_key
)
except
SSHException
,
e
:
self
.
transport
.
close
()
raise
SSHConnectionError
(
str
(
e
))
else
:
self
.
sftp
=
paramiko
.
SFTPClient
.
from_transport
(
self
.
transport
)
security
.
declarePublic
(
Permissions
.
ManagePortal
,
'close'
)
def
close
(
self
):
"""
It must close the sftp and transport connection.
"""
self
.
sftp
.
close
()
self
.
transport
.
close
()
InitializeClass
(
SSHConnection
)
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