mirror of
https://github.com/openSUSE/osc.git
synced 2025-09-08 14:08:42 +02:00
core.Request - implement ordering compatible with py3
This commit is contained in:
12
osc/core.py
12
osc/core.py
@@ -28,7 +28,7 @@ import sys
|
||||
import tempfile
|
||||
import textwrap
|
||||
import time
|
||||
from functools import cmp_to_key
|
||||
from functools import cmp_to_key, total_ordering
|
||||
from http.client import IncompleteRead
|
||||
from io import StringIO
|
||||
from urllib.parse import urlsplit, urlunsplit, urlparse, quote_plus, urlencode, unquote
|
||||
@@ -2812,6 +2812,7 @@ class Action:
|
||||
return Action(action_node.get('type'), **kwargs)
|
||||
|
||||
|
||||
@total_ordering
|
||||
class Request:
|
||||
"""Represents a request (``<request />``)"""
|
||||
|
||||
@@ -2831,6 +2832,12 @@ class Request:
|
||||
self.statehistory = []
|
||||
self.reviews = []
|
||||
|
||||
def __eq__(self, other):
|
||||
return int(self.reqid) == int(other.reqid)
|
||||
|
||||
def __lt__(self, other):
|
||||
return int(self.reqid) < int(other.reqid)
|
||||
|
||||
def read(self, root):
|
||||
"""read in a request"""
|
||||
self._init_attributes()
|
||||
@@ -3097,9 +3104,6 @@ class Request:
|
||||
|
||||
return '\n'.join(lines)
|
||||
|
||||
def __cmp__(self, other):
|
||||
return cmp(int(self.reqid), int(other.reqid))
|
||||
|
||||
def create(self, apiurl, addrevision=False, enforce_branching=False):
|
||||
"""create a new request"""
|
||||
query = {'cmd': 'create'}
|
||||
|
Reference in New Issue
Block a user