Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions .github/workflows/DailyTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,22 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
python ./setup.py install
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Setup.py Tests
run: |
pip install setuptools
setup.py test
- name: Test with pytest
run: |
pip install pytest
pytest

# Tests no longer work after API update
# - name: Setup.py Tests
# run: |
# pip install setuptools
# python ./setup.py test
# Temporarily commented out until support is added
# - name: Test with pytest
# run: |
# pip install pytest
# pytest
21 changes: 12 additions & 9 deletions .github/workflows/PullRequestTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,22 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
python ./setup.py install
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with setup.py tests
run: |
pip install setuptools
setup.py test
- name: Test with pytest
run: |
pip install pytest
pytest

# Tests no longer work after API update
# - name: Test with setup.py tests
# run: |
# pip install setuptools
# python ./setup.py test
# Temporarily commented out until support is added
# - name: Test with pytest
# run: |
# pip install pytest
# pytest
61 changes: 61 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Changelog
2018-07-02 v0.6.2 - Fix a critical memoization bug, error reponse printing, some HTTP/PUT calls, authentication error handling

A critical memoization bug caused by the decorator being used prevented the same field of more than
one item of the same type from being updated in a single invocation of the Python intepreter; i.e. it's
only possible to update the Title of one Story within a Python script, regardless of how many V1Meta objects
are created. It also prevented the V1Meta objects from being created with separate credentials.

Bug in how HTTP 400 responses were handled caused an exception to be thrown during handling and raising of
an exception, preventing the actual error response provided with the HTTP 400 from being printed.

Bug in how NTLM authentication was handled prevented the HTTP 401 authentication error from being raised and
handled so the errors would silently fail without the GET/POST command completing.

A bug in the creation of the HTTP POST commands in Python3 caused a TypeError exception to be thrown when no
data payload was needed. This prevent Operations with no arguments from being used on V1 objects.

Unittests were added to ensure some Operations work properly. Connection tests to ensure bad credentials
result in an identifable failed connection were also added. Tests specifically to ensure separation of
credentials between different V1Meta objects within the same tests produce different results, thereby
checking that memoization is working properly on a per-V1Meta object basis were also added.

2018-06-21 v0.6.1 - Fix a new item creation bug and added unittests for creation

2018-06-21 v0.6 - Rebased to include some historical changes that were lost between 0.4 and 0.5.

Fixed the tests so they can be run and succeed, including adding tests that check functionality
of connections and some basic querying.

Critical lost differences that were recovered:
OAuth token support
memoization fixes

2018-06-13 v0.5.1 - PyPi upload so it's available via pip as "v1pysdk".

2018-06-12 v0.5 - Dynamic Python3 support added.

Add page(), sort(), queryAll(), find(), max_length(), length(), and support for len() usage to
the query objects.

Primary repository moved to a fork that's maintained.

2013-09-27 v0.4 - A correction has been made to the multi-valued relation setter code. It used the
wrong value for the XML "act" attribute, so multi-value attributes never got set correctly. Note
that at this time, there is no way to un-set a value from a multi-valued relation.

2013-07-09 v0.3 - To support HTTPS, A "scheme" argument has been added to the V1Meta and V1Client
constructors.

An instance_url keyword argument was added to V1Meta and V1Client. This argument can be
specified instead of the address, instance_path, scheme, and port arguments.

A performance enhancement was made to calls such as "list(v1.Story.Name)". The requested
attribute is added to the select list if it's not present, thus preventing an HTTP GET
for each matched asset.

Some poor examples were removed and logging cleaned up in places.

Fix some issues with NTLM and urllib2. (thanks campbellr)

Missing attributes now return a None-like object can be deferenced to any depth. (thanks bazsi)
63 changes: 0 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -527,66 +527,3 @@ Ran <X> tests in <Y> s
OK

```

## Revision History

2018-07-02 v0.6.2 - Fix a critical memoization bug, error reponse printing, some HTTP/PUT calls, authentication error handling

A critical memoization bug caused by the decorator being used prevented the same field of more than
one item of the same type from being updated in a single invocation of the Python intepreter; i.e. it's
only possible to update the Title of one Story within a Python script, regardless of how many V1Meta objects
are created. It also prevented the V1Meta objects from being created with separate credentials.

Bug in how HTTP 400 responses were handled caused an exception to be thrown during handling and raising of
an exception, preventing the actual error response provided with the HTTP 400 from being printed.

Bug in how NTLM authentication was handled prevented the HTTP 401 authentication error from being raised and
handled so the errors would silently fail without the GET/POST command completing.

A bug in the creation of the HTTP POST commands in Python3 caused a TypeError exception to be thrown when no
data payload was needed. This prevent Operations with no arguments from being used on V1 objects.

Unittests were added to ensure some Operations work properly. Connection tests to ensure bad credentials
result in an identifable failed connection were also added. Tests specifically to ensure separation of
credentials between different V1Meta objects within the same tests produce different results, thereby
checking that memoization is working properly on a per-V1Meta object basis were also added.

2018-06-21 v0.6.1 - Fix a new item creation bug and added unittests for creation

2018-06-21 v0.6 - Rebased to include some historical changes that were lost between 0.4 and 0.5.

Fixed the tests so they can be run and succeed, including adding tests that check functionality
of connections and some basic querying.

Critical lost differences that were recovered:
OAuth token support
memoization fixes

2018-06-13 v0.5.1 - PyPi upload so it's available via pip as "v1pysdk".

2018-06-12 v0.5 - Dynamic Python3 support added.

Add page(), sort(), queryAll(), find(), max_length(), length(), and support for len() usage to
the query objects.

Primary repository moved to a fork that's maintained.

2013-09-27 v0.4 - A correction has been made to the multi-valued relation setter code. It used the
wrong value for the XML "act" attribute, so multi-value attributes never got set correctly. Note
that at this time, there is no way to un-set a value from a multi-valued relation.

2013-07-09 v0.3 - To support HTTPS, A "scheme" argument has been added to the V1Meta and V1Client
constructors.

An instance_url keyword argument was added to V1Meta and V1Client. This argument can be
specified instead of the address, instance_path, scheme, and port arguments.

A performance enhancement was made to calls such as "list(v1.Story.Name)". The requested
attribute is added to the select list if it's not present, thus preventing an HTTP GET
for each matched asset.

Some poor examples were removed and logging cleaned up in places.

Fix some issues with NTLM and urllib2. (thanks campbellr)

Missing attributes now return a None-like object can be deferenced to any depth. (thanks bazsi)
10 changes: 5 additions & 5 deletions examples/meta_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

my_story = v1.Story('1005')

print s.Name
print(my_story.Name)
# 'New Story 2'
s.Owners
my_story.Owners
# [<v1pysdk.v1meta.Member object at 0x02AD9710>]
s.Scope
my_story.Scope
# <v1pysdk.v1meta.Scope object at 0x02AB2550>


for my_story in v1.Story,where(Name='New Story 2'):
print my_story.Name
for my_story in v1.Story.where(Name='New Story 2'):
print(my_story.Name)


6 changes: 3 additions & 3 deletions examples/query_fluent_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@


for t in v1.AssetType.select('Name').where(Name='Story'):
print t
print(t)


for s in v1.Story.select('Name'):
print s.CreateDate # fetched on demand
print s.Name
print(s.CreateDate) # fetched on demand
print(s.Name)



4 changes: 2 additions & 2 deletions examples/speed_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def process_queries(queries):
try:
asset._v1_refresh()
yield str(asset)
except Exception, e:
except Exception as e:
yield 'Error! %s(%s)'%(asset._v1_asset_type_name, asset._v1_oid)

all_assets = list(process_queries())
Expand All @@ -22,7 +22,7 @@ def process_queries(queries):
elapsed = t1 - t0
count = len(all_assets)

print "%d assets in %0.4fs (%0.4fs/asset)"%(count, elapsed, elapsed/count)
print("%d assets in %0.4fs (%0.4fs/asset)"%(count, elapsed, elapsed/count))

out = open('output.txt', 'w').write('\n'.join([str(a) for a in all_assets]))

Expand Down
4 changes: 2 additions & 2 deletions examples/sum_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
term="Actuals.Value.@Sum"
for task in v1.Task.select("Name",term):
if('Actuals.Value.@Sum' in task.data):
print task['Name']
print task['Actuals.Value.@Sum']
print(task['Name'])
print(task['Actuals.Value.@Sum'])
2 changes: 1 addition & 1 deletion examples/test_attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@

attachment.file_data = '\x00\xFF'*20000

print len(attachment.file_data)
print(len(attachment.file_data))


3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Topic :: Software Development :: Bug Tracking",
),

Expand Down