Comments (4)
As I check, there is no "UserProfile" attribute in "user" object fetched from RallyRESTResponse on our Rally instance. As a workaround, I put "if getattr(user,"UserProfile",None):" before code below as a condition:
# do our own brute force "join" operation on User to UserProfile info
for user in users:
# get any matching user profiles (aka mups), there really should only be 1 matching...
mups = [prof for prof in profiles
if prof._ref == user.UserProfile._ref]
if not mups:
problem = "unable to find a matching UserProfile record for User: %s UserProfile: %s"
warning("%s" % (problem % (user.DisplayName, user.UserProfile)))
continue
else:
if len(mups) > 1:
anomaly = "Found %d UserProfile items associated with username: %s"
warning("%s" % (anomaly % (len(mups), user.UserName)))
# now attach the first matching UserProfile to the User
user.UserProfile = mups[0]
The code should consider condition that an attribute of an object may not exist
from rallyresttoolkitforpython.
I've also encountered this issue.
My fix was to add the following to line 570:
mups = [prof for prof in profiles
if hasattr(user, 'UserProfile') and prof._ref == user.UserProfile._ref]
from rallyresttoolkitforpython.
Incorporated user contributed code in 1.1.1
from rallyresttoolkitforpython.
I'm still getting this in 1.1.1 when doing rally.getAllUsers() and user isn't found
Traceback (most recent call last):
File "C:\Users\ross\python\integration_rally-trello\rallyPython.py", line 67, in <module>
all_users = rally.getAllUsers()
File "C:\Python27\lib\site-packages\pyral\restapi.py", line 575, in getAllUsers
warning("%s" % (problem % (user.DisplayName, user.UserProfile)))
File "C:\Python27\lib\site-packages\pyral\entity.py", line 172, in __getattr__
raise AttributeError(description)
AttributeError: User instance has no attribute: 'UserProfile'
Solution is to guard the UserProfile here as well. I've guarded both properties.
if hasattr(user, 'UserProfile') and hasattr(user, 'DisplayName'):
warning("%s" % (problem % (user.DisplayName, user.UserProfile)))
from rallyresttoolkitforpython.
Related Issues (20)
- 'RallyRESTResponse' object has no attribute 'ref' HOT 2
- Error trying to add a feature to collection (milestone) HOT 1
- First python example in the Simple Use section of overview.rst has a bug HOT 2
- How can we override "User" name in "Revision History" in case we are using service account API key of Rally? HOT 2
- I can not connect to rally when I'm using VPN HOT 4
- getAllUsers() is broken HOT 4
- **Exception: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))** happens 2 out of 5 times HOT 4
- Project is required when I tried to query through Pyral. However, Project is not required in Rally REST API. HOT 2
- ReleasedBy value of a UserStory is always Null HOT 5
- How to directly extract all attributes from a single pyral.entity.Defect? HOT 5
- How to get `_refObjectUUID` for a <pyral.entity.RevisionHistory>? HOT 1
- Will pyral support using multiple users? HOT 2
- Please do not call socket.setdefaulttimeout()
- Pyral returns incorrect results for ConversationPosts sometimes
- Milestones returns empty list if accessed from a Feature that was accessed from a UserStory that had "Milestones" in its fetch params. HOT 2
- Pyral: AttributeError: PortfolioItem instance has no attribute: '_generateRallyCompliance__collection_ref_for_UserStories' HOT 1
- Unable to update/Post milestone to a userStory
- getAttachments() - 'bytes' object has no attribute 'oid' error
- Should throw error/warning when start > MAX_SIZE
- MAX_ITEMS 1M value can be insufficient for large objects like ConversationPost
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rallyresttoolkitforpython.