Closed nbastin closed 7 years ago
I'm suspicious that something else has gone wrong. The default text is part of the portal code, not part of the clearinghouse code. Is it possible that you're looking at a different request when you look it up?
@nbastin could you run another test? I could be missing something, but I don't see how that request_text could have been added by the clearinghouse code.
Apparently I already had a request pending, and it just kept giving it back to me (id 7069). After I rejected that request now I try to make a new one and get an error that makes me think perhaps it never worked:
CH2.create_request(context.cf._sa, *context._chargs, project_id = uid, desc="Foo!")
Out[34]:
{'code': 101,
'output': "[SERVER] SERVER_ERROR (ProgrammingError: (ProgrammingError) can't adapt type 'dict' 'INSERT INTO pa_project_member_request (context_type, context_id, request_text, request_type, request_details, requestor, status, creation_timestamp) VALUES (%(context_type)s, %(context_id)s, %(request_text)s, %(request_type)s, %(request_details)s, %(requestor)s, %(status)s, %(creation_timestamp)s) RETURNING pa_project_member_request.id' {'status': 0, 'request_text': 'Foo!', 'context_type': 1, 'context_id': '10c88fc8-9d57-4971-8820-5b14323557f5', 'requestor': '2d8ff6b0-ee1f-4c09-a986-088dbf058867', 'request_type': 0, 'request_details': {}, 'creation_timestamp': datetime.datetime(2017, 2, 1, 19, 14, 54, 312146)})",
'value': None}
Seems that possibly the problem is that request_details
is a dict, so maybe I need to change the datatype I'm giving you (I feel like I was led to do whatever I did from the docs, but maybe not...)
Ah so the docs just have ? for request_details...what should I put in there? :-)
The portal passes an empty string for request_details. I recommend you do the same (for better or worse). I've updated the doc locally for now. I imagine there will be other changes needed as well.
Huzzah! Victoire!
CH2.create_request(context.cf._sa, *context._chargs, project_id = uid, desc="Foo!")
Out[9]:
{'code': 0, 'output': '', 'value': 7222}
>>> PP(context.cf.getPendingProjectRequests(context))
[{'context_id': '10c88fc8-9d57-4971-8820-5b14323557f5',
'context_type': 1,
'creation_timestamp': '2017-02-01T20:42:20Z',
'id': 7222,
'request_details': '',
'request_text': 'Foo!',
'request_type': 0,
'requestor': '2d8ff6b0-ee1f-4c09-a986-088dbf058867',
'resolution_description': None,
'resolution_timestamp': None,
'resolver': None,
'status': 0}]
I dug around a bit in the project schema to figure out what the values of these arguments should be, and it does seem to work:
The innards of that request are:
It does actually make the request for me to act on, but the text is the default dummy text:
This is not a deal breaker at the moment, but I didn't see any obvious reason why it was broken in a quick perusal of the
SAv1PersistentImplementation
code.