Skip to content

Commit

Permalink
Possible workaround for
Browse files Browse the repository at this point in the history
  • Loading branch information
kunzimariano committed Jun 11, 2014
1 parent 566c79d commit 98e010c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@


.idea
*.pyc
\#*\#

Expand Down
14 changes: 14 additions & 0 deletions examples/sum_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from v1pysdk import V1Meta

v1 = V1Meta(
address = 'www14.v1host.com',
instance = 'v1sdktesting',
username = 'admin',
password = 'admin'
)

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']
6 changes: 5 additions & 1 deletion v1pysdk/v1meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,11 @@ def add_attribute_to_output(self, output, relation, values):
(container, leaf) = self.split_relation_to_container_and_leaf(relation)

for (asset, value) in zip(self.get_related_assets(output, container), values):
asset.with_data({leaf: value})
# for calculated values it is not an asset so take the value directly
if hasattr(asset, 'with_data'):
asset.with_data({leaf: value})
else:
output[relation] = value
else:
output[relation] = values[0]

Expand Down

0 comments on commit 98e010c

Please sign in to comment.