~ubuntu-branches/ubuntu/karmic/python-launchpad-bugs/karmic

« back to all changes in this revision

Viewing changes to launchpadbugs/tasksbase.py

  • Committer: Bazaar Package Importer
  • Author(s): Brian Murray, Markus Korn, Brian Murray
  • Date: 2008-08-27 12:26:27 UTC
  • Revision ID: james.westby@ubuntu.com-20080827122627-mq2cruz3lo3t27r2
Tags: 0.3
[ Markus Korn ]
* Improved LPBugList and LPBugPage:
  These two classes now have a cleaner structure, filtering of bug lists
  with python-launchpad-bugs is now a lot easier. With
  LPBugList.set_progress_hook() it is now possible to visualize the
  process of fetching bug lists (LP: #240750).
* launchpadbugs/{tasksbase,html_bug.py,text_bug.py}: if a task is a
  bugwatch then task.remote returns the remote-url, otherwise it returns
  'None'
* Improved error handling in python-launchpad-bugs and added
  infrastructure for unittests. This also contains some basic testcases in
  tests/ (LP: #189572)
* Added ability to parse bugtracker overviews (LP: #203312)
* launchpadbugs/html_bug.py: added a default value for comment subject which
  Launchpad now requires (LP: #259680)
* It is now possible to filter bug lists based on milestones. This also
  implements a helper function to list all active milestones of a project
  in launchpad (LP: #200457)
* Added function to filter buglists based on Bug.date_reported
  (LP: #185357)
* added 'move-duplicates' written by Kjell Braden and 'README' to
  examples/ (LP: #208148)
* launchpadbugs/attachmentsbase.py: LPAttachment.download() now also
  accepts an optional argument to specify the location where to download
  the attachment (LP: #242317)
* Added method to let the user choose which version/server of launchpad to
  use, so it is possible to explicitly use bugs.launchpad.net or
  bugs.edge.launchpad.net (LP: #188298)
* launchpadbugs/html_bug.py: InfoTable: fixed parsing of milestones in
  read-only mode (LP: #243057)
* Added functionality for adding new tasks to bug reports.
  With this implementation so far you are able to add 'project' and
  'distro' tasks, but unable to create bugwatches and change task
  attributes before committing the changes. (LP: #193853)
* launchpadbugs/html_bug.py: Stephan Hermann fixed html connector to work
  with the newest launchpad rollout (LP: #243193, #244452)
* fixed parsing of remote url for bugwatches in the html mode
* fixed LPBugList to be usable with python2.4 again
* launchpadbugs/http_connection.py: removed possible issue in the
  constructor of HTTPConnection.
* launchpadbugs/buglistbase.py: replaced super() call with ordinary
  delegation method to fix (LP: #245408)
* launchpadbugs/html_buglist.py, launchpadbugs/html_blueprintlist.py:
  adjusted parsing methods to be uasable with the latest LP rollout
* launchpadbugs/basebuglistfilter.py: added 'batch' to valid options for
  URLBugListFilter.
* Stephan Hermann added support for getting list of projects to
  python-launchpad-bugs
* Stephan Hermann added support package lists, thanks Stephan
  (LP: #249461)
* launchpadbugs/html_buglist.py: support parsing of '+expirable-bugs'
  lists (LP: #249381), this also adds better debugging functionality to
  all parsing methods.
* launchpadbugs/http_connection.py: reworked the HTTPConnection class to
  reduce number of one-shot sessions (LP: #245552)
* launchpadbugs/config.py: added module to handle global configuration
* tests/*: added more test-cases and added more functionality to testing
  framework.
  .
  Unfortunately this update breaks some compatibilty. Please update your 
  code to make use of the python-launchpad-bugs 0.3 API. It's worth it.
  More details at:
  https://wiki.ubuntu.com/BugHelper/Dev/python-launchpad-bugs/changes_0.3

[ Brian Murray ]
* launchpadbugs/utils.py: send bzr messages, used to get the py-lp-b
  revision number, to ~/.bzr.log and not stderr (LP: #260515)
* launchpadbugs/connector.py: merged patch from Markus to add wrapper for
  Bug.Error.LPUrlError (LP: #254556) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
        self._milestone = value_dict.get("milestone", None)
82
82
        self._available_milestone = value_dict.get("available_milestone", {})
83
83
        self._targeted_to = value_dict.get("targeted_to", None)
84
 
        self._remote = value_dict.get("remote", False)
 
84
        self._remote = value_dict.get("remote", None)
85
85
        
86
86
        #"date-created", "date-confirmed", "date-assigned", "date-inprogress", "date-closed"
87
87
        self._date_created = value_dict.get("date-created", None)
91
91
        self._date_closed = value_dict.get("date-closed", None)
92
92
        self._date_left_new = value_dict.get("date-left-new", None)
93
93
        self._date_incomplete = value_dict.get("date-incomplete", None)
 
94
        self._date_triaged = value_dict.get("date-triaged", None)
 
95
        self._date_fix_committed = value_dict.get("date-fix-committed", None)
 
96
        self._date_fix_released = value_dict.get("date-fix-released", None)
94
97
        
95
98
        #user==reporter
96
99
        self._user = value_dict.get("reporter", user(None))
149
152
    def get_date_incomplete(self):
150
153
        raise NotImplementedError, 'this method must be implemented by a concrete subclass'
151
154
    date_incomplete = LateBindingProperty(get_date_incomplete)
 
155
 
 
156
    def get_date_triaged(self):
 
157
        raise NotImplementedError, 'this method must be implemented by a concrete subclass'
 
158
    date_triaged = LateBindingProperty(get_date_triaged)
 
159
 
 
160
    def get_date_fix_committed(self):
 
161
        raise NotImplementedError, 'this method must be implemented by a concrete subclass'
 
162
    date_fix_committed = LateBindingProperty(get_date_fix_committed)
 
163
 
 
164
    def get_date_fix_released(self):
 
165
        raise NotImplementedError, 'this method must be implemented by a concrete subclass'
 
166
    date_fix_released = LateBindingProperty(get_date_fix_released)
152
167
    
153
168
    def get_user(self):
154
169
        raise NotImplementedError, 'this method must be implemented by a concrete subclass'
262
277
        self._url = conf_data.get("url","")
263
278
        self._xml = conf_data.get("xml","")
264
279
        self._connection = conf_data.get("connection",None)
 
280
        self.__added = []
265
281
        list.__init__(self)
266
282
        
267
283
    def __repr__(self):
270
286
    def __str__(self):
271
287
        x = (len(self) > 1 and "[%s]") or "%s"
272
288
        return x %",".join(str(i) for i in self)
 
289
        
 
290
    def addTask(self, task):
 
291
        if not isinstance(task, LPTask):
 
292
            raise TypeError, "task has to be instance of 'LPTask'"
 
293
        self.__added.append(task)
 
294
        self.append(task)
 
295
        
 
296
    def remove(self, item):
 
297
        if not item in self.__added:
 
298
            raise RuntimeError, "LP does not allow to remove Tasks"
 
299
        list.remove(self, item)
273
300
 
274
301
    def parse(self):
275
302
        pass
315
342
        
316
343
    @property
317
344
    def changed(self):
318
 
        try:
319
 
            return [change_obj(i) for i in self if i.changed]
320
 
        except AttributeError:
321
 
            return []
 
345
        ret = list()
 
346
        for i in self:
 
347
            if i in self.__added:
 
348
                ret.append(change_obj(i, "added"))
 
349
            elif i.changed:
 
350
                ret.append(change_obj(i))
 
351
        return ret
322
352
        
323
353
    def commit(self, force_changes=False, ignore_lp_errors=True):
324
354
        """ delegates commit() to each changed element """
325
355
        for i in self.changed:
326
 
            i.component.commit(force_changes, ignore_lp_errors)
 
356
            if i.action == "added":
 
357
                self._LP_create_task(i, force_changes, ignore_lp_errors)
 
358
            else:
 
359
                i.component.commit(force_changes, ignore_lp_errors)
 
360
                
 
361
    def _LP_create_task(task, force_changes, ignore_lp_errors):
 
362
        raise NotImplementedError
327
363
            
328
364
 
329
365
#some test-cases