Ticket #46 (closed Defect: To be investigated)
PUT new element
| Reported by: | raf_n | Owned by: | Mircea Amarascu |
|---|---|---|---|
| Priority: | Minor | Milestone: | |
| Component: | XCAP protocol | Version: | |
| Severity: | Non-critical | Keywords: | |
| Cc: |
Description
When trying to put a new element in an xml document we receive an exception. Problem is in xcap/appusage/init.py line 125: def _create_element(self, parent, terminal_selector, elem):
left = target.find('[')
variable target is not global, parameter terminal_selector should be renamed to target.
The testcases don't cover this scenario, they only replace existing elements (function _replace_element).
After fixing this issue i tried to put an element in a presence-document, but i still couldn't get it to work... No exception and response is 200 OK...
Existing xml document:
<?xml version="1.0" encoding="UTF-8"?>
<ruleset xmlns="urn:ietf:params:xml:ns:common-policy" xmlns:pr="urn:ietf:params:xml:ns:pres-rules" xmlns:cp="www.counterpath.com/privacy-lists">
<rule id="bleh"/>
</ruleset>
PUT [url]/pres-rules/users/test01@domain.com/pres_rules/~ ~/cp:ruleset/cp:rule[1]/?xmlns(pr=urn:ietf:params:xml:ns:pres-rules)?xmlns(cp=urn:ietf:params:xml:ns:common-policy)
body = <rule id="pres_whitelist"> <conditions> <identity> <one id="sip:2233350608@sip2sip.info"/> <one id="sip:31208005164@ag-projects.com"/> </identity> </conditions> <actions> <pr:sub-handling>allow</pr:sub-handling> </actions> <transformations> <pr:provide-services> <pr:all-services/> </pr:provide-services> <pr:provide-persons> <pr:all-persons/> </pr:provide-persons> <pr:provide-devices> <pr:all-devices/> </pr:provide-devices> <pr:provide-all-attributes/> </transformations> </rule>
Content-Type: application/xcap-el+xml
response = 409
