Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PyOTRS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Som Connexió
OTRS
PyOTRS
Commits
ad6bfcd3
Commit
ad6bfcd3
authored
8 years ago
by
Robert Habermann
Browse files
Options
Downloads
Patches
Plain Diff
add @authenticated decorator
parent
9059aa21
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pyotrs/lib.py
+22
-0
22 additions, 0 deletions
pyotrs/lib.py
tests/test_client.py
+143
-113
143 additions, 113 deletions
tests/test_client.py
with
165 additions
and
113 deletions
pyotrs/lib.py
+
22
−
0
View file @
ad6bfcd3
...
...
@@ -60,6 +60,10 @@ class SessionCreateError(PyOTRSError):
pass
class
SessionNotCreated
(
PyOTRSError
):
pass
class
APIError
(
PyOTRSError
):
pass
...
...
@@ -68,6 +72,19 @@ class HTTPError(PyOTRSError):
pass
def
authenticated
(
func
):
"""
Decorator to check whether a Session IDs is already stored
"""
def
check_session_id_store_for_value
(
self
,
*
args
,
**
kwargs
):
if
not
self
.
session_id_store
.
value
:
raise
SessionNotCreated
(
"
Call session_create() or
"
"
session_restore_or_set_up_new() first
"
)
return
func
(
self
,
*
args
,
**
kwargs
)
return
check_session_id_store_for_value
class
Article
(
object
):
"""
PyOTRS Article class
"""
...
...
@@ -775,6 +792,7 @@ class Client(object):
* ticket_create
"""
@authenticated
def
ticket_create
(
self
,
ticket
=
None
,
article
=
None
,
...
...
@@ -830,6 +848,7 @@ class Client(object):
* ticket_get_by_number
"""
@authenticated
def
ticket_get_by_id
(
self
,
ticket_id
,
articles
=
False
,
...
...
@@ -864,6 +883,7 @@ class Client(object):
else
:
return
self
.
result
[
0
]
@authenticated
def
ticket_get_by_list
(
self
,
ticket_id_list
,
articles
=
False
,
...
...
@@ -953,6 +973,7 @@ class Client(object):
* ticket_search_full_text
"""
@authenticated
def
ticket_search
(
self
,
**
kwargs
):
"""
Wrapper for search ticket
...
...
@@ -1015,6 +1036,7 @@ class Client(object):
* ticket_update_set_pending
"""
@authenticated
def
ticket_update
(
self
,
ticket_id
,
article
=
None
,
...
...
This diff is collapsed.
Click to expand it.
tests/test_client.py
+
143
−
113
View file @
ad6bfcd3
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment