- rewrote Request class and friends
authorMarcus Huewe <suse-tux@gmx.de>
Thu, 30 Dec 2010 01:30:37 +0000 (02:30 +0100)
committerMarcus Huewe <suse-tux@gmx.de>
Thu, 30 Dec 2010 01:30:37 +0000 (02:30 +0100)
commitb2838dd88d536210d29ede7ba730976b65878553
tree1967990d035a912b6fbf7597e5ae1c0c8e106c3f
parent8c26c746209176f143562f34b0e3a98eaefb8149
- rewrote Request class and friends

- rewrote Action class: instances only provide attributes for their specific type (for details see class doc).
  Renamed "dst_project" attribute to "tgt_project" and "dst_package" attribute to "tgt_package" (only affects
  types which have a <target /> element)
- added AbstractState class: Base class which represents state-like objects (<review />, <state />)
- rewrote ReviewState and RequestState classes
- rewrote Request class: apart from internal rewrites the format of the "__str__" and "list_view" methods
  slightly changed

Now it should be much easier to create new requests without constructing the
request xml by hand.
Example:
 r = Request()
 r.add_action('submit', src_project='foo', src_package='bar', tgt_project='targetprj', tgt_package='targetpkg')
 r.add_action('set_bugowner', tgt_project='foobar', person_name='buguser')
 r.add_action('delete', tgt_project='prj', tgt_package='deleteme')
 print r.to_str()
 ->
<request>
  <action type="submit">
    <source package="bar" project="foo" />
    <target package="targetpkg" project="targetprj" />
  </action>
  <action type="set_bugowner">
    <target project="foobar" />
    <person name="buguser" />
  </action>
  <action type="delete">
    <target package="deleteme" project="prj" />
  </action>
</request>
osc/core.py