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
Laurent S
erp5
Commits
35a20958
Commit
35a20958
authored
Jun 20, 2012
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to Browser.open() a path relative to the current context.
parent
1e81d39e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
erp5/util/testbrowser/browser.py
erp5/util/testbrowser/browser.py
+11
-9
No files found.
erp5/util/testbrowser/browser.py
View file @
35a20958
...
...
@@ -186,24 +186,26 @@ class Browser(ExtendedTestBrowser):
super
(
Browser
,
self
).
__init__
()
def
open
(
self
,
url_or_path
=
None
,
data
=
None
):
def
open
(
self
,
url_or_path
=
None
,
data
=
None
,
site_relative
=
True
):
"""
Open a relative (to the ERP5 base URL) or absolute URL. If the
given URL is not given, then it will open the home ERP5 page.
Open a relative (to the ERP5 base URL) or absolute URL. If the given URL
is not given, then it will open the home ERP5 page. If C{site_relative} is
False, it will open the URL within the current context.
@param url_or_path: Relative or absolute URL
@type url_or_path: str
"""
# In case url_or_path is an absolute URL, urljoin() will return
# it, otherwise it is a relative path and will be concatenated to
# ERP5 base URL
absolute_url
=
urljoin
(
self
.
_erp5_base_url
,
url_or_path
)
if
site_relative
:
# In case url_or_path is an absolute URL, urljoin() will return
# it, otherwise it is a relative path and will be concatenated to
# ERP5 base URL
url_or_path
=
urljoin
(
self
.
_erp5_base_url
,
url_or_path
)
if
isinstance
(
data
,
dict
):
data
=
urllib
.
urlencode
(
data
)
self
.
_logger
.
debug
(
"Opening
url: "
+
absolute_url
)
super
(
Browser
,
self
).
open
(
absolute_url
,
data
)
self
.
_logger
.
debug
(
"Opening
: "
+
url_or_path
)
super
(
Browser
,
self
).
open
(
url_or_path
,
data
)
def
randomSleep
(
self
,
minimum
,
maximum
):
"""
...
...
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