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
f7b3ebd0
Commit
f7b3ebd0
authored
8 years ago
by
Robert Habermann
Browse files
Options
Downloads
Patches
Plain Diff
update cli and change lib to satisfy tests
parent
1f2b31e8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cli/PyOTRS.py
+7
-7
7 additions, 7 deletions
cli/PyOTRS.py
pyotrs/lib.py
+9
-12
9 additions, 12 deletions
pyotrs/lib.py
with
16 additions
and
19 deletions
cli/PyOTRS.py
+
7
−
7
View file @
f7b3ebd0
...
...
@@ -19,12 +19,12 @@ def load_config(config_file):
"""
try
:
if
not
oct
(
stat
.
S_IMODE
(
os
.
stat
(
config_file
).
st_mode
))
==
"
0600
"
:
raise
Exception
(
"
Permissions to %s too open. Should be 0600!
"
%
config_file
)
except
OSError
:
# non existent file can not be checked for permissions; that's fine -> pass
pass
if
not
os
.
path
.
isfile
(
config_file
)
:
click
.
secho
(
"
No config file found at: %s
"
%
config_file
,
fg
=
"
yellow
"
)
return
if
not
oct
(
stat
.
S_IMODE
(
os
.
stat
(
config_file
).
st_mode
))
==
"
0600
"
:
raise
Exception
(
"
Permissions to %s too open. Should be 0600!
"
%
config_file
)
try
:
with
click
.
open_file
(
config_file
)
as
f
:
...
...
@@ -41,7 +41,7 @@ def load_config(config_file):
except
IOError
:
# no config file in default location; that's fine -> continue
click
.
secho
(
"
No
config
file found at: %s
"
%
config_file
,
fg
=
"
yellow
"
)
click
.
secho
(
"
No
valid
file found at: %s
(I/O Error)
"
%
config_file
,
fg
=
"
yellow
"
)
except
ValueError
as
err
:
click
.
secho
(
"
Does not look like a valid config file: %s
"
%
config_file
,
fg
=
"
yellow
"
)
raise
Exception
(
"
Does not look like a valid config file: %s
"
%
err
)
...
...
This diff is collapsed.
Click to expand it.
pyotrs/lib.py
+
9
−
12
View file @
f7b3ebd0
...
...
@@ -99,10 +99,12 @@ class Article(object):
def
__init__
(
self
,
dct
):
for
key
,
value
in
dct
.
items
():
"""
try:
logger.debug(
"
Parse Article: {0} --> {1}
"
.format(key, value))
except UnicodeEncodeError:
logger.warn(
"
Parse Article: Unicode error for Value of Key {0}
"
.format(key))
"""
self
.
__dict__
=
dct
def
__repr__
(
self
):
...
...
@@ -183,14 +185,7 @@ class Attachment(object):
Returns:
"""
b64_content
=
(
"
IyBjb250ZW50IG9mIHNldHVwLmNmZwpbcHl0ZXN0XQpub3JlY3Vyc2VkaXJzID0gL
"
"
mdpdAphZGRvcHRzID0gLS1kb2N0ZXN0LW1vZHVsZXMKClttZXRhZGF0YV0KZGVzY3
"
"
JpcHRpb24tZmlsZSA9IFJFQURNRS5tZCAgIyBUaGlzIHRlbGxzIFB5UEkgd2hlcmU
"
"
geW91ciBSRUFETUUgZmlsZSBpcy4K
"
)
return
Attachment
(
b64_content
,
"
text/plain
"
,
"
dümmy.txt
"
)
return
Attachment
(
"
YmFyCg==
"
,
"
text/plain
"
,
"
dümmy.txt
"
)
class
AttachmentList
(
object
):
...
...
@@ -250,7 +245,7 @@ class DynamicField(object):
def
__init__
(
self
,
name
=
None
,
value
=
None
,
dct
=
None
):
if
dct
:
if
name
or
value
:
raise
Exception
(
"
Please provide
r
either
\"
dct
\"
or
\"
name and value
\"
"
)
raise
Exception
(
"
Please provide either
\"
dct
\"
or
\"
name and value
\"
"
)
self
.
name
=
dct
[
"
Name
"
]
self
.
value
=
dct
[
"
Value
"
]
...
...
@@ -259,7 +254,7 @@ class DynamicField(object):
self
.
name
=
name
self
.
value
=
value
else
:
raise
Exception
(
"
Please provide
r
either
\"
dct
\"
or
\"
name and value
\"
"
)
raise
Exception
(
"
Please provide either
\"
dct
\"
or
\"
name and value
\"
"
)
def
__repr__
(
self
):
return
"
<{0}: {1} --> {2} >
"
.
format
(
self
.
__class__
.
__name__
,
self
.
name
,
self
.
value
)
...
...
@@ -319,6 +314,7 @@ class DynamicFieldList(object):
Returns:
"""
self
.
dynamic_field_list
.
append
(
dynamic_field
)
def
to_dct
(
self
):
...
...
@@ -349,11 +345,12 @@ class Ticket(object):
def
__init__
(
self
,
dct
):
for
key
,
value
in
dct
.
items
():
"""
try:
logger.debug(
"
Parse Ticket: {0} --> {1}
"
.format(key, value))
except UnicodeEncodeError:
logger.warn(
"
Parse Ticket: Unicode error for Value of Key {0}
"
.format(key))
"""
if
isinstance
(
value
,
dict
):
dct
[
key
]
=
Ticket
(
value
)
self
.
__dict__
=
dct
...
...
@@ -1172,7 +1169,7 @@ class Client(object):
Returns:
bool True
"""
if
self
.
operation
==
"
SessionCreate
"
:
...
...
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