← Back to team overview

arsenal-devel team mailing list archive

lp:~apw/arsenal/python-launchpadlib-toolkit-task_date_accessors into lp:arsenal

 

Andy Whitcroft has proposed merging lp:~apw/arsenal/python-launchpadlib-toolkit-task_date_accessors into lp:arsenal.

Requested reviews:
  arsenal-devel (arsenal-devel)

For more details, see:
https://code.launchpad.net/~apw/arsenal/python-launchpadlib-toolkit-task_date_accessors/+merge/49272

Add accessors for all of the exported date attributes on launchpad tasks.
-- 
https://code.launchpad.net/~apw/arsenal/python-launchpadlib-toolkit-task_date_accessors/+merge/49272
Your team arsenal-devel is requested to review the proposed merge of lp:~apw/arsenal/python-launchpadlib-toolkit-task_date_accessors into lp:arsenal.
=== added file 'AUTHORS'
--- AUTHORS	1970-01-01 00:00:00 +0000
+++ AUTHORS	2011-02-10 18:57:44 +0000
@@ -0,0 +1,6 @@
+Maintainers:
+        Bryce Harrington <bryce@xxxxxxxxxxxxx>
+
+Contributions, ideas, and inspiration from:
+        Markus Korn <thekorn@xxxxxx>
+        Brad Figg <brad.figg@xxxxxxxxxxxxx>

=== renamed file 'AUTHORS' => 'AUTHORS.moved'
=== added file 'COPYING'
--- COPYING	1970-01-01 00:00:00 +0000
+++ COPYING	2011-02-10 18:57:44 +0000
@@ -0,0 +1,341 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+

=== added file 'COPYING.LIB'
--- COPYING.LIB	1970-01-01 00:00:00 +0000
+++ COPYING.LIB	2011-02-10 18:57:44 +0000
@@ -0,0 +1,510 @@
+
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+	51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations
+below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it
+becomes a de-facto standard.  To achieve this, non-free programs must
+be allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+                  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control
+compilation and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at least
+    three years, to give the same user the materials specified in
+    Subsection 6a, above, for a charge no more than the cost of
+    performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply, and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License
+may add an explicit geographical distribution limitation excluding those
+countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                            NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms
+of the ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.
+It is safest to attach them to the start of each source file to most
+effectively convey the exclusion of warranty; and each file should
+have at least the "copyright" line and a pointer to where the full
+notice is found.
+
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or
+your school, if any, to sign a "copyright disclaimer" for the library,
+if necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James
+  Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+

=== added file 'NEWS'
--- NEWS	1970-01-01 00:00:00 +0000
+++ NEWS	2011-02-10 18:57:44 +0000
@@ -0,0 +1,41 @@
+July 22, 2010 - Version 0.4
+===========================
+Brad Figg has been hammering out wrapper classes for Launchpad API
+objects.  These do call caching and provide other convenience functions
+to simplify use of launchpadlib.
+
+LaunchpadLib now mostly handles credentials now via login_anonymously()
+and login_with(), so we've transitioned launchpadlib-toolkit (or lpltk
+as we're nicknaming it now) to using those calls rather than manage the
+credentials at this level.
+
+While this package is not intended to be a collection of scripts, we've
+included a few small tools in the scripts directory that may be useful
+in other scripts, where you need to e.g. dynamically look up the name of
+the current version of ubuntu under development.
+
+
+Sept 29, 2009 - Version 0.1
+===========================
+This is a first draft of the python-launchpadlib-toolkit package.  The
+principle motivation is the widespread duplication of effort in
+implementing credential handling across a vast array of launchpadlib
+applications.
+
+At Plumbers' it seems there is strong desire for more collaboration
+between LPL scripters.  Since pretty much every LPL script needs to do
+credentials management, standardizing this into a sharable library seems
+like a logical first step.
+
+There's so much similarity from one credentials implementation to
+another that this probably could have started from anyone's code.  I
+opted to start with my own implementation from Arsenal since that's the
+one I'm most familiar with.  I've integrated some good implementation
+ideas from Markus Korn's work on ilaunchpad-shell and ubuntu-dev-tools,
+such as the nifty DebugStdOut trickery, the use of environment variables
+for configuration, and the essense of his HTTPError exception handling.
+
+One of my major design goals was to keep it simple, so there's been
+several ideas I've left out simply on the grounds that I wasn't sure if
+they'd be that useful in real-world cases.  Stuff can always be added
+later as it's proven necessary!

=== added file 'README'
--- README	1970-01-01 00:00:00 +0000
+++ README	2011-02-10 18:57:44 +0000
@@ -0,0 +1,118 @@
+LaunchpadLib Toolkit (lpltk)
+============================
+lpltk is a set of classes for interacting with the Launchpad
+service API library.  It takes care of certain common chores such as
+obtaining and managing login credentials.
+
+By factoring this common code out of individual launchpadlib projects,
+it makes them more concise and more compatible with one another.
+
+
+Basic Usage
+===========
+For most purposes, simply create the LaunchpadService object, which will
+attend to the credentials automatically.  Then retrieve a project object
+(such as "ubuntu") and from there you can use all the regular Launchpad
+API calls.  In other words:
+
+  import lpltk
+
+  lp   = lpltk.LaunchpadService()
+  prj  = lp.load_project("ubuntu")
+
+
+See example-ls-series.py for a complete working example.  Also try
+running it with LPDEBUG turned on to see how to get debug info:
+
+  $ ./example-ls-series.py
+
+  $ LPDEBUG=1 ./example-ls-series.py
+
+For more elaborate real-world scripts, refer to the Arsenal project at:
+
+  http://launchpad.net/arsenal
+
+
+Environment Variables
+=====================
+Configuration of the LaunchpadService behavior can be done via
+environmental variables.  This is done principly to make it easy to
+debug issues without needing to tweak source code.
+
+The following environment variables are supported:
+
+  LPDEBUG       Prints extra debugging messages to stderr if defined.
+                If set to a numerical argument, it sets the httpdlib2
+                debuglevel to that value; the http debug output will be
+                filtered to redact your oauth token and signature, so
+                you can attach debug info to public bugs without
+                revealing anything sensitive.
+
+  LPSTAGING     Use the staging service root rather than the live (edge)
+                service.  This allows testing of your script without
+                risking actual changes to the official Launchpad.
+
+  LPCONFIG      Use this directory path for configuration files, rather
+                than the default of ~/.config/<consumer>.  The directory
+                will be created if it does not already exist.
+
+  LPCACHE       Use this directory path for cache files (such as credentials),
+                rather than the default of ~/.cache/<consumer>.  The
+                directory will be created if it does not already exist.
+
+
+API - LaunchpadService
+======================
+
+lp = LaunchpadService([config_path], [cache_path], [consumer])
+
+     Creates the Launchpad service object and retrieve credentials from
+     Launchpad.  LPSTAGING, LPCONFIG, and LPCACHE must be specified
+     prior to instantiating the LaunchpadService object in order to have
+     any effect.
+
+     config_path and cache_path allow the calling script to define the
+     default paths if not specified by the environment variables.
+
+     On any unrecoverable error an exception is thrown.
+
+lp.load_project(project)
+
+     Loads the named project (such as "ubuntu" distro), returning its
+     launchpadapi object.
+
+lp.reset()
+
+     Reloads the credentials and project (if any is specified).  This is
+     handy for recovering from Launchpad out-of-service or other such
+     transient errors.
+
+lp.name:              The credentialed consumer name (default: lpltk)
+lp.launchpad:         The launchpadlib launchpad object
+lp.project:           The loaded Launchpad project (default: None)
+
+
+API - Debug
+===========
+dbg(msg), err(msg), die(msg)
+
+     Convenience routines for printing error and debug messages to
+     stderr.  dbg() only prints if LPDEBUG is defined.
+
+StdOut, DebugStdOut
+
+     STDOUT overloads for debug output filtering.  Set sys.stdout to
+     DebugStdOut to filter out oauth token and signature details.
+
+
+Wishlist
+========
+* Unit tests
+* API documentation
+* Get this package into Main
+* Add a framework for storing config elements beyond just credentials
+* Integrate into existing launchpadlib scripts/applications
+* Wrapper classes for Bugs, SourcePackages, etc.
+* Strengthen the fault handling, provide better diagnostics, and be more
+  robust against Launchpad service failures
+

=== renamed file 'README' => 'README.moved'
=== added directory 'debian'
=== renamed directory 'debian' => 'debian.moved'
=== added file 'debian/changelog'
--- debian/changelog	1970-01-01 00:00:00 +0000
+++ debian/changelog	2011-02-10 18:57:44 +0000
@@ -0,0 +1,77 @@
+python-launchpadlib-toolkit (0.4.1ubuntu1) UNRELEASED; urgency=low
+
+  * Add new script launchpad-service-status which looks to see if
+    launchpad is up and running.
+  * control: Add dependency on python-feedparser
+  * bug_task: add all of the date accessors exported by launchpad
+
+ -- Bryce Harrington <bryce@xxxxxxxxxx>  Wed, 09 Feb 2011 16:00:27 -0800
+
+python-launchpadlib-toolkit (0.4.1) natty; urgency=low
+
+  * Added --prefix=/usr to distutils for executable install
+    in correct directory, fix ftbfs (LP: #701207)
+
+ -- Angel Abad <angelabad@xxxxxxxxxx>  Mon, 10 Jan 2011 21:45:26 +0100
+
+python-launchpadlib-toolkit (0.4) natty; urgency=low
+
+  * Update close-fix-committed-bugs to use lpltk instead of arsenal
+  * Restrict example scripts to read-only anonymous access.  This allows
+    them to run without needing the user to set up credentials.
+  * Add key:value parsing of bug descriptions
+  * Improve error handling of auth errors
+  * Add example script to print out bugs matching status and date
+  * Add several tutorials and simple examples
+  * New classes and methods for interacting with bugs
+
+ -- Bryce Harrington <bryce@xxxxxxxxxx>  Thu, 23 Dec 2010 20:12:10 -0800
+
+python-launchpadlib-toolkit (0.3.1~lucid) lucid; urgency=low
+
+  * Added --no-compile to distutils
+
+ -- Kamran Riaz Khan <krkhan@xxxxxxxxxxxxxx>  Sat, 14 Aug 2010 10:45:44 +0500
+
+python-launchpadlib-toolkit (0.3~karmic) karmic; urgency=low
+
+  [Brian Murray]
+  * Catch failures to import LPNET_SERVICE_ROOT
+  
+  [Bryce Harrington]
+  * Add scripts/current-ubuntu-series-name: Displays current development
+    series for Ubuntu
+  * Add scripts/ls-series: Lists all series for Ubuntu
+  * Add scripts/find-similar-bugs: Searches for what LP thinks might be
+    duplicates of the given bug.
+  * Add scripts/close-fix-committed-bugs: Closes all Fix Committed
+    bugs (such as when doing a release)
+  * Add scripts/ls-assigned-bugs: Lists user's assigned bugs
+
+  [ Kamran Riaz Khan ]
+  * Added support for send-attachments-upstream
+
+ -- Kamran Riaz Khan <krkhan@xxxxxxxxxxxxxx>  Sat, 14 Aug 2010 01:03:41 +0500
+
+python-launchpadlib-toolkit (0.2.1) maverick; urgency=low
+
+  * Fix parameter name in debug routine.
+  * First upload to Ubuntu
+
+ -- Bryce Harrington <bryce@xxxxxxxxxx>  Thu, 17 Jun 2010 17:21:21 -0700
+
+python-launchpadlib-toolkit (0.2) karmic; urgency=low
+
+  * Add handling of socket.error exceptions, which can be triggered when
+    the Launchpad service is unreachable (such as from a busted router).
+
+ -- Bryce Harrington <bryce@xxxxxxxxxx>  Tue, 06 Oct 2009 11:19:08 -0700
+
+python-launchpadlib-toolkit (0.1) karmic; urgency=low
+
+  * New revision, split off from arsenal, with ideas brazenly thieved from
+    Markus Korn's launchpadlib-shell.
+  * debian packaging borrowed/adapted from python-launchpad-bugs
+
+ -- Bryce Harrington <bryce@xxxxxxxxxx>  Tue, 29 Sep 2009 16:16:09 -0700
+

=== added file 'debian/compat'
--- debian/compat	1970-01-01 00:00:00 +0000
+++ debian/compat	2011-02-10 18:57:44 +0000
@@ -0,0 +1,1 @@
+5

=== added file 'debian/control'
--- debian/control	1970-01-01 00:00:00 +0000
+++ debian/control	2011-02-10 18:57:44 +0000
@@ -0,0 +1,20 @@
+Source: python-launchpadlib-toolkit
+Section: python
+Priority: extra
+Maintainer: Arsenal Developers <arsenal-devel@xxxxxxxxxxxxxxxxxxx>
+Build-Depends: cdbs (>= 0.4.43), debhelper (>= 5), python-central (>= 0.5), python-all-dev (>= 2.5)
+Standards-Version: 3.8.3
+XS-Vcs-Bzr: https://code.launchpad.net/~arsenal-devel/python-launchpadlib-toolkit/main
+XS-Python-Version: all
+
+Package: python-launchpadlib-toolkit
+Section: python
+Architecture: all
+Depends: ${python:Depends}, ${misc:Depends}, python (>= 2.5), python-launchpadlib, python-feedparser
+XB-Python-Version: ${python:Versions}
+Description: convenience library for launchpadlib
+ Classes to manage credentials and access bug information
+ in Launchpad using the Launchpad API.
+ .
+ https://launchpad.net/arsenal/
+

=== added file 'debian/copyright'
--- debian/copyright	1970-01-01 00:00:00 +0000
+++ debian/copyright	2011-02-10 18:57:44 +0000
@@ -0,0 +1,34 @@
+This package was debianized by Bryce Harrington <bryce@xxxxxxxxxxxxx> on
+Mon Sep 28 23:54:18 PDT 2009
+
+It was downloaded from 
+#TBD
+
+Upstream Author: 
+	Bryce Harrington <bryce@xxxxxxxxxxxxx>
+
+Copyright: 
+	# Written by Bryce Harrington
+	# (C) Canonical, Ltd. Licensed under the GPL
+
+License:
+
+   This package is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This package is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this package; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+The Debian packaging is (C) 2006, Daniel Holbach <daniel.holbach@xxxxxxxxxx> and
+is licensed under the GPL, see above.

=== added file 'debian/docs'
--- debian/docs	1970-01-01 00:00:00 +0000
+++ debian/docs	2011-02-10 18:57:44 +0000
@@ -0,0 +1,1 @@
+README

=== added file 'debian/pycompat'
--- debian/pycompat	1970-01-01 00:00:00 +0000
+++ debian/pycompat	2011-02-10 18:57:44 +0000
@@ -0,0 +1,1 @@
+>= 2.4

=== added file 'debian/rules'
--- debian/rules	1970-01-01 00:00:00 +0000
+++ debian/rules	2011-02-10 18:57:44 +0000
@@ -0,0 +1,14 @@
+#!/usr/bin/make -f
+
+DEB_PYTHON_SYSTEM	:= pycentral
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/python-distutils.mk
+
+DEB_PYTHON_INSTALL_ARGS_ALL := --no-compile --prefix=/usr
+DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc $(DEB_BUILD_PROG_OPTS)
+arch-build::
+	rm -rf debian/arch-build
+	mkdir -p debian/arch-build/$(DEB_SOURCE_PACKAGE)-$(DEB_VERSION)
+	tar -c --exclude=arch-build --no-recursion -f - `bzr inventory` | (cd debian/arch-build/$(DEB_SOURCE_PACKAGE)-$(DEB_VERSION);tar xf -)
+	(cd debian/arch-build/$(DEB_SOURCE_PACKAGE)-$(DEB_VERSION) && $(DEB_BUILD_PROG))

=== added directory 'examples'
=== added file 'examples/tut.01'
--- examples/tut.01	1970-01-01 00:00:00 +0000
+++ examples/tut.01	2011-02-10 18:57:44 +0000
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+#
+# Tutorial:
+#    Show how to establish a connection to Launchpad services. This must
+#    be done in every script which tries to obtain information from
+#    Launchpad.
+#
+
+from lpltk.service                   import LaunchpadService
+
+# LpltkTutorial
+#
+class LpltkTutorial():
+    # main
+    #
+    def main(self):
+        # By instantiating a LaunchpadService object, a connection is
+        # made with Launchpad, credentials are exchanged, the sign-on
+        # processes is executed and credentials are cached. Once this
+        # succeeds, further communication with Launchpad can happen.
+        #
+        lp = LaunchpadService()
+        print("We've successfully established a connection to Launchpad services.")
+
+if __name__ == '__main__':
+    app = LpltkTutorial()
+    app.main()
+
+# vi:set ts=4 sw=4 expandtab:
+

=== added file 'examples/tut.02'
--- examples/tut.02	1970-01-01 00:00:00 +0000
+++ examples/tut.02	2011-02-10 18:57:44 +0000
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+#
+# Tutorial:
+#    Now that a connection has been established with the Launchpad service,
+#    demonstrate one way of getting access to the informtation for a single
+#    bug.
+#
+
+from lpltk.service                   import LaunchpadService
+
+# LpltkTutorial
+#
+class LpltkTutorial():
+    # main
+    #
+    def main(self):
+        lp  = LaunchpadService()  # Connect to Launchpad
+
+        # Get an instance of a bug object for a well known bug. Print out
+        # the title of the bug.
+        #
+        bug = lp.get_bug(1)
+        print("Title: %s" % bug.title)
+
+        # Note: To see all the methods and properties on any python object
+        #       you can always print out the results from a dir() call.
+        #
+        print dir(bug)
+
+if __name__ == '__main__':
+    app = LpltkTutorial()
+    app.main()
+
+# vi:set ts=4 sw=4 expandtab:
+

=== added file 'examples/tut.03'
--- examples/tut.03	1970-01-01 00:00:00 +0000
+++ examples/tut.03	2011-02-10 18:57:44 +0000
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+#
+# Tutorial:
+#    We've seen how to get the basic information from a bug getting more
+#    information isn't much different. It usually just involves additional
+#    objects that some of the bug properties return.
+#
+
+from lpltk.service                   import LaunchpadService
+
+# LpltkHelloWorld
+#
+class LpltkHelloWorld():
+    # __init__
+    #
+    def __init__(self):
+        return
+
+    # main
+    #
+    def main(self):
+        try:
+            lp  = LaunchpadService()
+            bug = lp.get_bug(1)
+
+            # The title just returns a simple string.
+            #
+            title = bug.title
+
+            # Getting the origninal bug submitter means going through a "person"
+            # object wich we get via the bug.owner property.
+            #
+            submitter = bug.owner.display_name
+
+            # Getting a list of all the tags that are currently applied to a bug
+            # comes from the bug.tags property.
+            #
+            tags = bug.tags
+
+            # Important dates related to a bug:
+            #   bug.date_created      - Date the bug was first entered into Launchpad
+            #   bug.date_last_updated - When the bug was last updated (status, tags, etc.)
+            #   bug.date_last_message - When the last comment was added to the bug.
+            #
+            created = bug.date_created
+            updated = bug.date_last_updated
+            date_last_message = bug.date_last_message
+
+        # Handle the user presses <ctrl-C>.
+        #
+        except KeyboardInterrupt:
+            pass
+
+        return
+
+if __name__ == '__main__':
+    app = LpltkHelloWorld()
+    app.main()
+
+# vi:set ts=4 sw=4 expandtab:
+

=== added file 'examples/tut.04'
--- examples/tut.04	1970-01-01 00:00:00 +0000
+++ examples/tut.04	2011-02-10 18:57:44 +0000
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+#
+# Tutorial:
+#    The difference between this tutorial/example and tut.01 is that this shows
+#    how to point at one of the other Launchpad services.
+#
+#    The staging service, exists for testing various things. This is running
+#    against a snapshot of the database. Changes made on the staging server are
+#    not permanent changes and will disapear when the database is reloaded (once
+#    each day).
+#
+
+from lpltk.service                   import LaunchpadService
+
+# LpltkTutorial
+#
+class LpltkTutorial():
+    # main
+    #
+    def main(self):
+        configuration = {}
+        configuration['launchpad_services_root'] = 'staging'
+
+        # By passing in the configuration dictionary, we've instructed the class
+        # to connect to the Launchpad staging server.
+        #
+        lp = LaunchpadService(configuration)
+        print("We've successfully established a connection to Launchpad services.")
+
+if __name__ == '__main__':
+    app = LpltkTutorial()
+    app.main()
+
+# vi:set ts=4 sw=4 expandtab:
+

=== added file 'examples/tut.05'
--- examples/tut.05	1970-01-01 00:00:00 +0000
+++ examples/tut.05	2011-02-10 18:57:44 +0000
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+#
+# Tutorial:
+#    The difference between this tutorial/example and tut.01 is that this shows
+#    how to point at one of the other Launchpad services.
+#
+#    The staging service, exists for testing various things. This is running
+#    against a snapshot of the database. Changes made on the staging server are
+#    not permanent changes and will disapear when the database is reloaded (once
+#    each day).
+#
+
+from lpltk.service                   import LaunchpadService
+from datetime                        import datetime
+
+# LpltkTutorial
+#
+class LpltkTutorial():
+    # main
+    #
+    def main(self):
+        configuration = {}
+
+        # By passing in the configuration dictionary, we've instructed the class
+        # to connect to the Launchpad staging server.
+        #
+        lp = LaunchpadService(configuration)
+
+        # The service.distributions property is a collection of distributions. We
+        # pretty much only care about one, 'ubuntu'.
+        #
+        distro         = lp.distributions['ubuntu']
+
+        # Within a distribution are many source packages. We actually care about
+        # several, but _mostly_ the 'linux' source package.
+        #
+        source_package = distro.get_source_package('linux')
+
+        # Searching for bug tasks, the search can be quite complicated and made up
+        # of several components. The following can be combined in many ways to get
+        # the search you want. The search happens on the server and returns a
+        # collection of bug tasks that match the search criteria.
+        #
+        # tasks = pkg.search_tasks(tags=search_tags, tags_combinator=search_tags_combinator,
+        #                          status=self.cfg['task_search_status'], modified_since=since)
+        #
+        search_tags            = [] # A list of the tags we care about
+        search_tags_combinator = "All"
+        search_status          = ["New"] # A list of the bug statuses that we care about
+        search_since           = datetime(year=2010, month=11, day=29)
+        tasks = source_package.search_tasks(status=search_status, modified_since=search_since)
+
+        for task in tasks:
+            bug = task.bug
+            print(bug.id)
+
+if __name__ == '__main__':
+    app = LpltkTutorial()
+    app.main()
+
+# vi:set ts=4 sw=4 expandtab:
+

=== added directory 'lpltk'
=== added file 'lpltk/LaunchpadService.py'
--- lpltk/LaunchpadService.py	1970-01-01 00:00:00 +0000
+++ lpltk/LaunchpadService.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,193 @@
+#!/usr/bin/python
+
+import os
+import sys
+import json
+import httplib2
+import launchpadlib
+from launchpadlib.launchpad     import *
+from debug                      import *
+from bug                        import Bug
+from distributions              import Distributions
+from projects                   import Projects
+import json
+
+class LaunchpadServiceError(Exception):
+    """LaunchpadServiceError
+
+    An exception class that will be raised if there are any errors initializing
+    a LaunchpadService instance.
+    """
+
+    # __init__
+    #
+    def __init__(self, error):
+        self.msg = error
+
+class LaunchpadService:
+    """
+    Manages connection to Launchpad services.
+    """
+
+    def __init__(self, config=None):
+        """Initialize the Arsenal instance.
+
+        The user's configuration (if one exists) is loaded and
+        incorporated into the standard options. Access to Launchpad is
+        initialized.
+
+        Configuration values to override can be passed in through config.
+        For example:
+
+        lp = LaunchpadService(config={
+                'launchpad_services_root': 'edge',
+                'read_only':               True
+                })
+
+        lp = LaunchpadService(config={
+                'launchpad_client_name':   'my-lpltoolkit-project',
+                'launchpad_services_root': 'https://api.launchpad.dev'
+                })
+
+        """
+
+        self.project = None
+
+        # Setting LPLTK_DEBUG environment variable enables debug messages in this
+        # class and in httplib2 as well.
+        #
+        if "LPLTK_DEBUG" in os.environ:
+            httplib2.debuglevel = os.getenv("LPLTK_DEBUG", None)
+            sys.stdout = DebugStdOut()
+
+        # Default configuration parameters
+        #
+        self.config = {}
+        self.config['launchpad_client_name']   = 'lpltk'
+        self.config['launchpad_services_root'] = 'production' # 'staging' 'edge' 'production'
+        self.config['project_name']            = ''
+        self.config['read_only']               = False        # FIXME: 'read_only' doesn't seem very descriptive here.
+        self.config['launchpad_version']       = 'devel'
+
+        # The configuration dictionary which is ~/.lpltkrc will override the
+        # default configuration parameters.
+        #
+        self._load_user_config()
+
+        # The config dictionary passed into this method override all config parameters.
+        #
+        if config != None:
+            for k in config.keys():
+                self.config[k] = config[k]
+
+        # So that we can use any change a user may have made via their config file, we
+        # need to set the 'launchpad_cachedir' after loading the user's config file.
+        #
+        if 'launchpad_cachedir' not in self.config:
+            self.config['launchpad_cachedir'] = os.path.join(os.path.expanduser('~'),
+                                                             '.cache',
+                                                             self.config['launchpad_client_name'])
+
+        self.reset()
+        return
+
+    def reset(self):
+        """
+        Re-establish access to Launchpad and reload the specific project if one is
+        specified.
+        """
+        dbg("Launchpadlib Version: %s" %(launchpadlib.__version__))
+        dbg("Login With:  %s %s" %(self.config['launchpad_client_name'], self.config['launchpad_services_root']))
+        dbg("Read Only:  %s" %(self.config['read_only']))
+
+        try:
+            if self.config['read_only']:
+                self.launchpad = Launchpad.login_anonymously(
+                    self.config['launchpad_client_name'],
+                    self.config['launchpad_services_root'],
+                    version=self.config['launchpad_version'])
+            else:
+                self.launchpad = Launchpad.login_with(
+                    self.config['launchpad_client_name'],
+                    self.config['launchpad_services_root'],
+                    self.config['launchpad_cachedir'],
+                    version=self.config['launchpad_version'])
+            if self.config['project_name'] != '':
+                self.load_project(self.config['project_name'])
+        except:
+            errmsg = "Problem logging into Launchpad, possible issue retrieving credentials."
+            if 'launchpad_cachedir' in self.config:
+                errmsg += "\n* Try deleting your cache directory (%s) and retrying." %(
+                    self.config['launchpad_cachedir'])
+            raise LaunchpadServiceError(errmsg)
+        return
+
+    # get_bug
+    #
+    def get_bug(self, bug_number):
+        return Bug(self, bug_number)
+
+    # get_launchpad_bug
+    #
+    def get_launchpad_bug(self, bug_number):
+        """ Fetch a Launchpad bug object for a specific Launchpad bug id. """
+        return self.launchpad.bugs[bug_number]
+
+    def load_project(self, project):
+        """ Connect to a specific Launchpad project. """
+        try:
+            self.project = self.launchpad.projects[project]
+        except KeyError:
+            raise LaunchpadServiceError("%s is not a recognize Launchpad project." % (project))
+        if self.project is None:
+            try:
+                self.project = self.launchpad.distributions[project]
+            except KeyError:
+                raise LaunchpadServiceError("%s is not a recognize Launchpad distribution." % (project))
+        self.config['project_name'] = project
+        return self.project
+
+    def _load_user_config(self):
+        """ Load configuration from ~/.lpltkrc
+
+        If the users home directory contains a configuration file, load that in. The
+        name of the configuration file is '.lpltkrc'. The format of the file is
+        json. The json format should be an array. The contents of that array will
+        be merged with the default one 'self.config' in this class.
+        """
+        if 'configuration_file' in self.config:
+            cfg_path = self.config['configuration_file']
+        else:
+            cfg_path = os.path.join(os.path.expanduser('~'), ".lpltkrc")
+        if os.path.exists(cfg_path):
+            with open(cfg_path, 'r') as f:
+                user_config = json.load(f)
+            for k in user_config.keys():
+                self.config[k] = user_config[k]
+
+    #--------------------------------------------------------------------------
+    # distributions
+    #
+    @property
+    def distributions(self):
+        return Distributions(self)
+
+    #--------------------------------------------------------------------------
+    # projects
+    #
+    @property
+    def projects(self):
+        return Projects(self)
+
+    #--------------------------------------------------------------------------
+    # create_bug
+    #
+    #    Create a new, launchpad bug.
+    #
+    def create_bug(self, project, package, title, description):
+        proj    = self.projects[project]
+        target  = self.launchpad.load(proj.self_link + "/+source/" + package);
+        lp_bug = self.launchpad.bugs.createBug(target=target, title=title, description=description)
+        return self.get_bug(lp_bug.id)
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'lpltk/__init__.py'
--- lpltk/__init__.py	1970-01-01 00:00:00 +0000
+++ lpltk/__init__.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,3 @@
+from lpltk.LaunchpadService import LaunchpadService
+from lpltk.debug import dbg, err, die, StdOut, DebugStdOut, dump_launchpad_object
+

=== added file 'lpltk/attachment.py'
--- lpltk/attachment.py	1970-01-01 00:00:00 +0000
+++ lpltk/attachment.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,171 @@
+#!/usr/bin/python
+
+from utils                      import o2str
+from message                    import Message
+from fnmatch                    import fnmatch
+
+# Attachment
+#
+class Attachment(object):
+    TAR_ARCHIVE_TYPES = [
+        'application/x-tar',
+        ]
+    TAR_ARCHIVE_EXTS = [
+        '*.tar.gz',
+        '*.tgz',
+        '*.tar.bz2',
+        ]
+    ZIP_ARCHIVE_TYPES = [
+        'application/zip'
+        ]
+    ZIP_ARCHIVE_EXTS = [
+        '*.zip'
+        ]
+    MIMETYPES = {
+            '*.txt' : 'text/plain',
+            '*.log' : 'text/plain',
+            }
+
+    # __init__
+    #
+    def __init__(self, tkbug, lpattachment, force_mimetype=False):
+        self.__tkbug          = tkbug
+        self.__commit_changes = tkbug.commit_changes
+        self.__attachment     = lpattachment
+        self.__force_mimetype = force_mimetype
+        self.__title          = None
+        self.__type           = None
+        self.__message        = None
+        self.__data           = None
+        self.__remotefd       = None
+        self.__content        = None
+        self.__filename       = None
+
+    # __del__
+    #
+    def __del__(self):
+        if self.__remotefd:
+            self.__remotefd.close()
+
+    # __len__
+    #
+    def __len__(self):
+        return self.remotefd.len
+
+    def __eq__(self, other):
+        return self.__attachment == other.__attachment
+
+    def __ne__(self, other):
+        return self.__attachment != other.__attachment
+
+    def __find_mimetype(self):
+        for pattern, mimetype in self.MIMETYPES.iteritems():
+            if fnmatch(self.title, pattern):
+                return mimetype
+
+    # title
+    #
+    @property
+    def title(self):
+        if self.__title == None:
+            self.__title = o2str(self.__attachment.title)
+        return self.__title
+
+    # kind
+    #
+    @property
+    def kind(self):
+        if self.__type == None:
+            self.__type = self.__attachment.type
+        return self.__type
+
+    # content_type
+    #
+    @property
+    def content_type(self):
+        if self.__force_mimetype:
+            return self.__find_mimetype()
+        else:
+            return self.remotefd.content_type
+
+    # message
+    #
+    @property
+    def message(self):
+        if self.__message == None:
+            self.__message = Message(self.__tkbug, self.__attachment.message)
+        return self.__message
+
+    # owner
+    #
+    @property
+    def owner(self):
+        if not self.message:
+            return None
+        return self.message.owner
+
+    # age (in days)
+    #
+    @property
+    def age(self):
+        if not self.message:
+            return None
+        t = self.message.date_created
+        now = t.now(t.tzinfo)
+        return 0 + (now - t).days
+
+    # data
+    #
+    @property
+    def data(self):
+        if self.__data == None:
+            self.__data = self.__attachment.data
+        return self.__data
+
+    # remotefd
+    #
+    @property
+    def remotefd(self):
+        if self.__remotefd == None:
+            self.__remotefd = self.data.open()
+        return self.__remotefd
+
+    # filename
+    #
+    @property
+    def filename(self):
+        if self.__filename == None:
+            self.__filename = self.remotefd.filename
+        return self.__filename
+
+    # content
+    #
+    @property
+    def content(self):
+        if self.__content == None:
+            self.__content = self.remotefd.read()
+        return self.__content
+
+    def is_patch(self):
+        return bool(self.kind == 'Patch')
+
+    def is_archive_type(self, type):
+        type = type.upper()
+        if not hasattr(self, '%s_ARCHIVE_TYPES' % type):
+            return False
+        archive_types = getattr(self, '%s_ARCHIVE_TYPES' % type)
+        archive_exts = getattr(self, '%s_ARCHIVE_EXTS' % type)
+
+        if self.remotefd.content_type in archive_types:
+            return True
+
+        for ext in archive_exts:
+            if fnmatch(self.title, ext):
+                return True
+
+        return False
+
+    def is_archive(self):
+        return is_archive_type('tar') or is_archive_type('zip')
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'lpltk/attachments.py'
--- lpltk/attachments.py	1970-01-01 00:00:00 +0000
+++ lpltk/attachments.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,302 @@
+#!/usr/bin/python
+
+import gzip
+import os
+import shutil
+import tarfile
+
+from copy                       import copy
+from locale                     import getpreferredencoding
+from zipfile                    import ZipFile
+
+from attachment                 import Attachment
+from fnmatch                    import fnmatch
+
+# Attachments
+#
+# A collection class for files added into launchpad, also known
+# as an attachment.
+#
+
+class LocalAttachment(object):
+    class Data:
+        class Fd(file):
+            @property
+            def content_type(self):
+                return None
+
+            @property
+            def len(self):
+                stat = os.stat(self.name)
+                return stat.st_size
+
+        def set_path(self, path):
+            self.__path = path
+        def open(self):
+            if self.__path:
+                return LocalAttachment.Data.Fd(self.__path)
+
+    def __init__(self):
+        self.data = LocalAttachment.Data()
+
+class Attachments(object):
+    # __init__
+    #
+    # Initialize the instance from a Launchpad bug.
+    #
+    def __init__(self, tkbug):
+        self.__tkbug                = tkbug
+        self.__commit_changes       = tkbug.commit_changes
+        self.__attachments          = None
+        self.__filters              = []
+
+        self.__download             = False
+        self.__download_dir         = None
+
+        self.__extract              = False
+        self.__extract_dir          = None
+        self.__extract_limit        = None
+
+        self.__gzip                 = False
+        self.__gzip_dir             = None
+
+        self.__force_mimetype       = False
+
+    # __len__
+    #
+    def __len__(self):
+        return len(list(self.__iter__()))
+
+    # __getitem__
+    #
+    def __getitem__(self, key):
+        return list(self.__iter__())[key]
+
+    # __iter__
+    #
+    def __iter__(self):
+        self.__fetch_if_needed()
+        for attachment in self.__attachments:
+            if self.__gzip:
+                attachment = self.__gzip_if_needed(attachment)
+
+            included = True
+            a = Attachment(self.__tkbug, attachment, self.__force_mimetype)
+            for f, params in self.__filters:
+                if not f(a, params):
+                    included = False
+            if included:
+                if self.__extract and \
+                            a.is_archive_type('tar') and \
+                            not self.__exceeds_tar_limit(a.remotefd):
+                    for member in self.__get_tar_members(a):
+                        yield member
+                elif self.__extract and \
+                            a.is_archive_type('zip') and \
+                            not self.__exceeds_zip_limit(a.remotefd):
+                    for member in self.__get_zip_members(a):
+                        yield member
+                else:
+                    if self.__download and \
+                            not isinstance(attachment, LocalAttachment):
+                        tmpfile = os.path.join(self.__download_dir, a.title)
+                        with open(tmpfile, 'w+b') as localfd:
+                            localfd.write(a.content)
+                    yield a
+
+    # __contains__
+    #
+    def __contains__(self, item):
+        return item in self.__iter__()
+
+    # __fetch_if_needed
+    #
+    def __fetch_if_needed(self):
+        if self.__attachments == None:
+            self.__attachments = self.__tkbug.lpbug.attachments_collection
+
+    def __gzip_if_needed(self, attachment):
+        filters = dict(self.__filters)
+        if not filters.has_key(filter_size_between):
+            return attachment
+
+        minsize, maxsize = filters[filter_size_between]
+        remotefd = attachment.data.open()
+
+        if remotefd.len > maxsize:
+            gzip_attachment = LocalAttachment()
+            gzip_attachment.title = attachment.title + '.gz'
+            gzip_attachment.type = attachment.type
+
+            tmpfile = os.path.join(self.__gzip_dir, gzip_attachment.title)
+            gzipfd = gzip.open(tmpfile, 'w+b')
+            gzipfd.write(remotefd.read())
+            gzipfd.close()
+
+            gzip_attachment.data.set_path(tmpfile)
+            attachment = gzip_attachment
+
+        remotefd.close()
+        return attachment
+
+    def __find_mime_type(self, attachment):
+        for pattern, mimetype in self.MIMETYPES.iteritems():
+            if fnmatch(attachment.title, pattern):
+                return mimetype
+
+    def __get_tar_members(self, tarattachment):
+        tar = tarfile.open(fileobj=tarattachment.remotefd)
+
+        attachments = []
+        for member in tar:
+            if member.isfile():
+                attachment = LocalAttachment()
+                attachment.title = os.path.basename(member.name)
+                if (fnmatch(attachment.title, '*.diff') or
+                    fnmatch(attachment.title, '*.patch')):
+                    attachment.type = 'Patch'
+                else:
+                    attachment.type = None
+
+                tar.extract(member, self.__extract_dir)
+                oldpath = os.path.join(self.__extract_dir,
+                                       member.name)
+                newpath = os.path.join(self.__extract_dir,
+                                       os.path.basename(member.name))
+                shutil.move(oldpath, newpath)
+                attachment.data.set_path(newpath)
+
+                attachments.append(Attachment(self.__tkbug,
+                                              attachment,
+                                              self.__force_mimetype))
+
+        return attachments
+
+    def __exceeds_tar_limit(self, fd):
+        if not self.__extract_limit:
+            return False
+
+        tar = tarfile.open(fileobj=fd)
+        result = len(tar.getnames()) > self.__extract_limit
+        fd.seek(0)
+
+        return result
+
+    def __get_zip_members(self, zipattachment):
+        zip = ZipFile(file=zipattachment.remotefd)
+
+        attachments = []
+        for member in [zip.open(name) for name in zip.namelist()]:
+            if member.name[-1] == '/':
+                continue
+
+            attachment = LocalAttachment()
+            attachment.title = os.path.basename(member.name)
+            if (fnmatch(attachment.title, '*.diff') or
+                fnmatch(attachment.title, '*.patch')):
+                attachment.type = 'Patch'
+            else:
+                attachment.type = None
+
+            zip.extract(member.name, self.__extract_dir)
+            oldpath = os.path.join(self.__extract_dir, member.name)
+            newpath = os.path.join(self.__extract_dir,
+                                   os.path.basename(member.name))
+            shutil.move(oldpath, newpath)
+            attachment.data.set_path(newpath)
+
+            attachments.append(Attachment(self.__tkbug,
+                                          attachment,
+                                          self.__force_mimetype))
+
+        return attachments
+
+    def __exceeds_zip_limit(self, fd):
+        if not self.__extract_limit:
+            return False
+
+        zip = ZipFile(file=fd)
+        result = len(zip.namelist()) > self.__extract_limit
+        fd.seek(0)
+
+        return result
+
+    def download_in_dir(self, download_dir):
+        self.__download = True
+        self.__download_dir = download_dir
+
+    def extract_archives(self, extract_dir, extract_limit=None):
+        self.__extract = True
+        self.__extract_dir = extract_dir
+        self.__extract_limit = extract_limit
+
+    def try_gzip(self, gzip_dir):
+        self.__gzip = True
+        self.__gzip_dir = gzip_dir
+
+    def force_mimetype(self):
+        self.__force_mimetype = True
+
+    def add_filter(self, f, params):
+        """ Add filter f to constrain the list of attachments.
+
+        f is a function which takes as arguments an Attachment
+        object, and a list of parameters specific to the given
+        filter.
+        """
+        self.__filters.append( (f, params) )
+
+    def check_required_files(self, glob_patterns):
+        """ Check that collection includes required filenames
+
+        Given a list of glob filename patterns, looks through the
+        attachments to verify at least one attachment fulfils the
+        required file pattern.  Returns a list of globs that were
+        not matched.  Returns an empty list if all requirements
+        were met.
+        """
+        missing = []
+        for glob_pattern in glob_patterns:
+            found = False
+
+            for a in self.__iter__():
+                if fnmatch(a.filename, glob_pattern):
+                    found = True
+                    break
+
+            if not found:
+                missing.append(glob_pattern)
+        return missing
+
+# Filters
+def filter_owned_by_person(attachment, persons):
+    """ File owned by specific person(s) (e.g. original bug reporter) """
+    return bool(attachment.owner and
+                attachment.owner in persons)
+
+def filter_filename_matches_globs(attachment, glob_patterns):
+    """ Filename matches one of a set of glob patterns (e.g. Xorg.*.log) """
+    filename = attachment.title
+    for glob_pattern in glob_patterns:
+        if fnmatch(filename, glob_pattern):
+            return False
+    return True
+
+def filter_size_between(attachment, sizes):
+    """ File size is within [min, max] bounds """
+    assert(len(sizes) == 2)
+    min_size = sizes[0]
+    max_size = sizes[1]
+    return bool(min_size <= len(attachment) and len(attachment) <= max_size)
+
+def filter_age_between(attachment, ages_in_days):
+    """ File was attached to bug between [min, max] days """
+    assert(len(ages_in_days) == 2)
+    min_age = ages_in_days[0]
+    max_age = ages_in_days[1]
+    return bool(min_age <= attachment.age and attachment.age <= max_age)
+
+def filter_is_patch(attachment, is_patch):
+    return attachment.is_patch() == is_patch
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'lpltk/bug.py'
--- lpltk/bug.py	1970-01-01 00:00:00 +0000
+++ lpltk/bug.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,237 @@
+#!/usr/bin/python
+
+import re
+from utils                      import o2str
+from tags                       import BugTags
+from attachments                import Attachments
+from person                     import Person
+from messages                   import Messages
+from nominations                import Nominations
+from bug_activity               import Activity
+
+# Bug
+#
+# A class that provides a convenient interface to a Launchpad bug.
+#
+class Bug(object):
+    # __init__
+    #
+    # Initialize the Bug instance from a Launchpad bug.
+    #
+    def __init__(self, service, bug_number, commit_changes=True):
+        self.__service      = service
+        launchpad           = self.__service.launchpad
+        self.lpbug          = launchpad.bugs[bug_number]
+        self.id             = self.lpbug.id
+        self.commit_changes = commit_changes
+
+        # Cached copies so we don't go back to launchpad as often
+        #
+        self.__title        = None
+        self.__description  = None
+        self.__tags         = None
+        self.__attachments  = None
+        self.__owner        = None
+        self.__date_created = None
+        self.__date_last_updated = None
+        self.__date_last_message = None
+        self.__private           = None
+        self.__properties   = None
+
+    #--------------------------------------------------------------------------
+    # date_created
+    #
+    # (read-only)
+    #
+    @property
+    def date_created(self):
+        if self.__date_created == None:
+            self.__date_created = self.lpbug.date_created
+        return self.__date_created
+
+    #--------------------------------------------------------------------------
+    # date_last_updated
+    #
+    # (read-only)
+    #
+    @property
+    def date_last_updated(self):
+        if self.__date_last_updated == None:
+            self.__date_last_updated = self.lpbug.date_last_updated
+        return self.__date_last_updated
+
+    #--------------------------------------------------------------------------
+    # date_last_message
+    #
+    # (read-only)
+    #
+    @property
+    def date_last_message(self):
+        if self.__date_last_message == None:
+            self.__date_last_message = self.lpbug.date_last_message
+        return self.__date_last_message
+
+    #--------------------------------------------------------------------------
+    # private
+    #
+    # (read-only)
+    #
+    @property
+    def private(self):
+        if self.__private == None:
+            self.__private = self.lpbug.private
+        return self.__private
+
+    # private
+    #
+    # (read-only)
+    #
+    @private.setter
+    def private(self, value):
+        self.lpbug.private = value
+        if self.commit_changes:
+            self.lpbug.lp_save()
+        self.__private = value
+        return
+
+    #--------------------------------------------------------------------------
+    # title
+    #
+    @property
+    def title(self):
+        '''A one-line summary of the problem being described by the bug.'''
+        if self.__title == None:
+            self.__title = o2str(self.lpbug.title)
+        return self.__title
+
+    @title.setter
+    def title(self, value):
+        if not isinstance(value, str):
+            raise TypeError("Must be a string")
+        self.lpbug.title = value
+        if self.commit_changes:
+            self.lpbug.lp_save()
+        self.__title = value
+
+    #--------------------------------------------------------------------------
+    # description
+    #
+    @property
+    def description(self):
+        '''As complete as possible description of the bug/issue being reported as a bug.'''
+        if self.__description == None:
+            self.__description = o2str(self.lpbug.description)
+        return self.__description
+
+    @description.setter
+    def description(self, value):
+        if not isinstance(value, str):
+            raise TypeError("Must be a string")
+        self.lpbug.description = value
+        if self.commit_changes:
+            self.lpbug.lp_save()
+        self.__description = value
+
+    #--------------------------------------------------------------------------
+    # tags
+    #
+    @property
+    def tags(self):
+        return BugTags(self)
+
+    #--------------------------------------------------------------------------
+    # owner
+    #
+    @property
+    def owner(self):
+        if self.__owner == None:
+            self.__owner = Person(self, self.lpbug.owner)
+        return self.__owner
+
+    #--------------------------------------------------------------------------
+    # attachments
+    #
+    @property
+    def attachments(self):
+        return Attachments(self)
+
+    def _parse_properties(self, text):
+        return props
+
+    #--------------------------------------------------------------------------
+    # properties
+    #
+    @property
+    def properties(self):
+        '''Returns dict of key: value pairs found in the bug description
+
+        This parses the bug report description into a more
+        programmatically digestable dictionary form.
+        '''
+        if self.__properties is None:
+            re_kvp            = re.compile("^(\s*)([\.\-\w]+):\s*(.*)$")
+            re_error          = re.compile("^Error:\s*(.*)$")
+            self.__properties = {}
+            last_key = {'': 'bar'}
+            for line in self.description.split("\n"):
+                m = re_kvp.match(line)
+                if not m:
+                    continue
+
+                level = m.group(1)
+                item = m.group(2)
+                value = m.group(3)
+                key = item
+
+                if len(level) > 0:
+                    key = "%s.%s" %(last_key[''], item)
+                last_key[level] = item
+
+                m = re_error.match(value)
+                if not m:
+                    self.__properties[key] = value
+        
+        return self.__properties
+
+    #--------------------------------------------------------------------------
+    # messages
+    #
+    @property
+    def messages(self):
+        return Messages(self)
+
+    #--------------------------------------------------------------------------
+    # tasks
+    #
+    @property
+    def tasks(self):
+        # The following import is done here to work around a circular import
+        # issue. bug_tasks imports bug.
+        #
+        from bug_tasks import BugTasks
+
+        return BugTasks(self.__service, self.lpbug.bug_tasks_collection)
+
+    #--------------------------------------------------------------------------
+    # new_message
+    #     Add a new comment to an existing bug. This is the equivalent of
+    #     newMessage.
+    #
+    def add_comment(self, content, subject=""):
+        self.lpbug.newMessage(content=content, subject=subject)
+
+    #--------------------------------------------------------------------------
+    # nominations
+    #
+    @property
+    def nominations(self):
+        return Nominations(self.__service, self)
+
+    #--------------------------------------------------------------------------
+    # activity
+    #
+    @property
+    def activity(self):
+        return Activity(self.__service, self)
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'lpltk/bug_activity.py'
--- lpltk/bug_activity.py	1970-01-01 00:00:00 +0000
+++ lpltk/bug_activity.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,96 @@
+#!/usr/bin/python
+
+from person                   import Person
+from utils                    import o2str
+
+class Activity(object):
+    # __init__
+    #
+    # Initialize the instance from a Launchpad bug.
+    #
+    def __init__(self, service, bug):
+        self.__service       = service
+        self.__bug           = bug
+        self.__lp_activities = None
+
+    # __len__
+    #
+    def __len__(self):
+        return len(list(self.__iter__()))
+
+    # __getitem__
+    #
+    def __getitem__(self, key):
+        self.__fetch_if_needed()
+        return BugActivity(self.__service, self.__bug, self.__lp_activities[key])
+
+    # __iter__
+    #
+    def __iter__(self):
+        self.__fetch_if_needed()
+        for activity in self.__lp_activities:
+            n = BugActivity(self.__service, self.__bug, activity)
+            yield n
+
+    # __contains__
+    #
+    def __contains__(self, item):
+        return item in self.__iter__()
+
+    # __fetch_if_needed
+    #
+    def __fetch_if_needed(self):
+        if self.__lp_activities == None:
+            self.__lp_activities = self.__bug.lpbug.activity
+
+class BugActivity(object):
+    # __init__
+    #
+    def __init__(self, service, bug, lp_bug_activity):
+        self.__service           = service
+        self.__bug               = bug
+        self.__lp_bug_activity   = lp_bug_activity
+        self.__date_changed      = None
+        self.__person            = None
+        self.__old_value         = None
+        self.__new_value         = None
+        self.__message           = None
+        self.__what_changed      = None
+
+    @property
+    def date_changed(self):
+        if self.__date_changed == None:
+            self.__date_changed = self.__lp_bug_activity.datechanged
+        return self.__date_changed
+
+    @property
+    def person(self):
+        if self.__person == None:
+            self.__person = Person(self.__bug, self.__lp_bug_activity.person)
+        return self.__person
+
+    @property
+    def old_value(self):
+        if self.__old_value == None:
+            self.__old_value = self.__lp_bug_activity.oldvalue
+        return self.__old_value
+
+    @property
+    def new_value(self):
+        if self.__new_value == None:
+            self.__new_value = self.__lp_bug_activity.newvalue
+        return self.__new_value
+
+    @property
+    def what_changed(self):
+        if self.__what_changed == None:
+            self.__what_changed = self.__lp_bug_activity.whatchanged
+        return self.__what_changed
+
+    @property
+    def message(self):
+        if self.__message == None:
+            self.__message = o2str(self.__lp_bug_activity.message)
+        return self.__message
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'lpltk/bug_target.py'
--- lpltk/bug_target.py	1970-01-01 00:00:00 +0000
+++ lpltk/bug_target.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+
+class BugTarget(object):
+    # __init__
+    #
+    def __init__(self, service, bug, lp_bug_target):
+        self.__service        = service
+        self.__bug            = bug
+        self.__lp_bug_target  = lp_bug_target
+        self.__name           = None
+
+    @property
+    def name(self):
+        if self.__name == None:
+            self.__name = self.__lp_bug_target.name
+        return self.__name
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'lpltk/bug_task.py'
--- lpltk/bug_task.py	1970-01-01 00:00:00 +0000
+++ lpltk/bug_task.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,168 @@
+#!/usr/bin/python
+
+from person                      import Person
+from bug                         import Bug
+from milestone                   import Milestone
+
+# BugTask
+#
+class BugTask(object):
+    # __init__
+    #
+    def __init__(self, service, lp_bug_task):
+        self.__service = service
+        self.__lp_bug_task = lp_bug_task
+        self.__owner        = None
+        self.__bug_target_display_name = None
+        self.__bug_target_name = None
+
+    # __str__
+    #
+    def __str__(self):
+        return self.display_name
+
+    # owner
+    #
+    @property
+    def owner(self):
+        if self.__owner == None:
+            self.__owner = Person(None, self.__lp_bug_task.owner)
+        return self.__owner
+
+    # bug_target_display_name
+    #
+    @property
+    def bug_target_display_name(self):
+        if self.__bug_target_display_name == None:
+            self.__bug_target_display_name = self.__lp_bug_task.bug_target_display_name
+        return self.__bug_target_display_name
+
+    # bug_target_name
+    #
+    @property
+    def bug_target_name(self):
+        if self.__bug_target_name == None:
+            self.__bug_target_name = self.__lp_bug_task.bug_target_display_name
+        return self.__bug_target_name
+
+    # bug
+    #
+    @property
+    def bug(self):
+        return Bug(self.__service, self.__lp_bug_task.bug.id)
+
+    # status
+    #
+    @property
+    def status(self):
+        return self.__lp_bug_task.status
+
+    @status.setter
+    def status(self, value):
+        self.__lp_bug_task.status = value
+        self.__lp_bug_task.lp_save()
+        return
+
+    # title
+    #
+    @property
+    def title(self):
+        return self.__lp_bug_task.title
+
+    # is_complete
+    #
+    @property
+    def is_complete(self):
+        return self.__lp_bug_task.is_complete
+
+    # importance
+    #
+    @property
+    def importance(self):
+        return self.__lp_bug_task.importance
+
+    # assignee
+    #
+    @property
+    def assignee(self):
+        if self.__lp_bug_task.assignee != None:
+            return self.__lp_bug_task.assignee
+        else:
+            return None
+
+    # date_assigned
+    #
+    @property
+    def date_assigned(self):
+        return self.__lp_bug_task.date_assigned
+
+    # date_closed
+    #
+    @property
+    def date_closed(self):
+        return self.__lp_bug_task.date_closed
+
+    # date_confirmed
+    #
+    @property
+    def date_confirmed(self):
+        return self.__lp_bug_task.date_confirmed
+
+    # date_created
+    #
+    @property
+    def date_created(self):
+        return self.__lp_bug_task.date_created
+
+    # date_fix_committed
+    #
+    @property
+    def date_fix_committed(self):
+        return self.__lp_bug_task.date_fix_committed
+
+    # date_fix_released
+    #
+    @property
+    def date_fix_released(self):
+        return self.__lp_bug_task.date_fix_released
+
+    # date_in_progress
+    #
+    @property
+    def date_in_progress(self):
+        return self.__lp_bug_task.date_in_progress
+
+    # date_incomplete
+    #
+    @property
+    def date_incomplete(self):
+        return self.__lp_bug_task.date_incomplete
+
+    # date_left_closed
+    #
+    @property
+    def date_left_closed(self):
+        return self.__lp_bug_task.date_left_closed
+
+    # date_left_new
+    #
+    @property
+    def date_left_new(self):
+        return self.__lp_bug_task.date_left_new
+
+    # date_triaged
+    #
+    @property
+    def date_triaged(self):
+        return self.__lp_bug_task.date_triaged
+
+    # milestone
+    #
+    @property
+    def milestone(self):
+        if self.__lp_bug_task.milestone != None:
+            return Milestone(self.__service, self.__lp_bug_task.milestone)
+        else:
+            return None
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'lpltk/bug_tasks.py'
--- lpltk/bug_tasks.py	1970-01-01 00:00:00 +0000
+++ lpltk/bug_tasks.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,36 @@
+#!/usr/bin/python
+
+from bug_task                        import BugTask
+
+class BugTasks(object):
+    # __init__
+    #
+    # Initialize the instance from a Launchpad bug.
+    #
+    def __init__(self, service, lp_tasks):
+        self.__service       = service
+        self.__lp_tasks      = lp_tasks
+
+    # __len__
+    #
+    def __len__(self):
+        return len(list(self.__iter__()))
+
+    # __getitem__
+    #
+    def __getitem__(self, key):
+        return BugTask(self.__service, self.__lp_tasks[key])
+
+    # __iter__
+    #
+    def __iter__(self):
+        for task in self.__lp_tasks:
+            d = BugTask(self.__service, task)
+            yield d
+
+    # __contains__
+    #
+    def __contains__(self, item):
+        return item in self.__iter__()
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'lpltk/debug.py'
--- lpltk/debug.py	1970-01-01 00:00:00 +0000
+++ lpltk/debug.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,44 @@
+# Utility routines and classes for debugging info
+
+# (C) Copyright 2009, Markus Korn <thekorn@xxxxxx>
+# (C) Copyright 2009, Bryce Harrington <bryce@xxxxxxxxxxxxx>
+
+import re, os, sys
+
+def dbg(msg):
+    if "LPLTOOLKIT_DEBUG" in os.environ:
+        sys.stderr.write("%s\n" %(msg))
+
+def err(msg):
+    sys.stderr.write("Error:  %s\n" %(msg))
+
+def die(msg):
+    sys.stderr.write("Fatal:  %s\n" %(msg))
+    sys.exit(1)
+
+StdOut = sys.stdout                                    
+class DebugStdOut(object):
+    '''
+    Debug version of STDOUT to redact out the oauth credentials
+    so that if the debug output is posted to a bug, it will not include
+    this sensitive info.
+    '''
+
+    RE_OAUTH_TOKEN = re.compile(r"oauth_token=\"([^\"]{2})[^\"]*")
+    RE_OAUTH_SIGNATURE = re.compile(r"oauth_signature=\"([^\"]{3})[^\"]*")
+
+    def write(self, txt):
+        txt = DebugStdOut.RE_OAUTH_SIGNATURE.sub(r"""oauth_signature="\1YYYYYYY""", txt)
+        txt = DebugStdOut.RE_OAUTH_TOKEN.sub(r"""oauth_token="\1XXXXXXXX""", txt)
+        StdOut.write(txt)
+        
+    def __getattr__(self, name):
+        return getattr(StdOut, name)
+
+def dump_launchpad_object(i):
+    print repr(i)
+    print " attr:  ", sorted(i.lp_attributes)
+    print " ops:   ", sorted(i.lp_operations)
+    print " coll:  ", sorted(i.lp_collections)
+    print " entr:  ", sorted(i.lp_entries)
+    print

=== added file 'lpltk/distribution.py'
--- lpltk/distribution.py	1970-01-01 00:00:00 +0000
+++ lpltk/distribution.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,43 @@
+#!/usr/bin/python
+
+from person                      import Person
+from distribution_source_package import DistributionSourcePackage
+
+# Distribution
+#
+class Distribution(object):
+    # __init__
+    #
+    def __init__(self, service, lp_distribution):
+        self.__service = service
+        self.__lp_distribution = lp_distribution
+        self.__owner        = None
+        self.__display_name = None
+
+    # __str__
+    #
+    def __str__(self):
+        return self.display_name
+
+    # owner
+    #
+    @property
+    def owner(self):
+        if self.__owner == None:
+            self.__owner = Person(None, self.__lp_distribution.owner)
+        return self.__owner
+
+    # display_name
+    #
+    @property
+    def display_name(self):
+        if self.__display_name == None:
+            self.__display_name = self.__lp_distribution.display_name
+        return self.__display_name
+
+    # get_source_package
+    #
+    def get_source_package(self, source_pkg):
+        return DistributionSourcePackage(self.__service, self.__lp_distribution.getSourcePackage(name = source_pkg))
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'lpltk/distribution_source_package.py'
--- lpltk/distribution_source_package.py	1970-01-01 00:00:00 +0000
+++ lpltk/distribution_source_package.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,47 @@
+#!/usr/bin/python
+
+from bug_tasks                   import BugTasks
+
+# DistributionSourcePackage
+#
+class DistributionSourcePackage(object):
+    # __init__
+    #
+    def __init__(self, service, lp_distribution):
+        self.__service         = service
+        self.__lp_distribution = lp_distribution
+        self.__display_name    = None
+        self.__name            = None
+        self.__title           = None
+
+    # display_name
+    #
+    @property
+    def display_name(self):
+        if self.__display_name == None:
+            self.__display_name = self.__lp_distribution.display_name
+        return self.__display_name
+
+    # name
+    #
+    @property
+    def name(self):
+        if self.__name == None:
+            self.__name = self.__lp_distribution.name
+        return self.__name
+
+    # title
+    #
+    @property
+    def title(self):
+        if self.__title == None:
+            self.__title = self.__lp_distribution.title
+        return self.__title
+
+    # searchTasks
+    #
+    def search_tasks(self, **params):
+        bt = BugTasks(self.__service, self.__lp_distribution.searchTasks(**params))
+        return bt
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'lpltk/distributions.py'
--- lpltk/distributions.py	1970-01-01 00:00:00 +0000
+++ lpltk/distributions.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+
+from distribution               import Distribution
+
+class Distributions(object):
+    # __init__
+    #
+    # Initialize the instance from a Launchpad bug.
+    #
+    def __init__(self, service):
+        self.__service       = service
+        self.__distributions = None
+
+    # __len__
+    #
+    def __len__(self):
+        return len(list(self.__iter__()))
+
+    # __getitem__
+    #
+    def __getitem__(self, key):
+        self.__fetch_if_needed()
+        return Distribution(self.__service, self.__distributions[key])
+
+    # __iter__
+    #
+    def __iter__(self):
+        self.__fetch_if_needed()
+        for distro in self.__distributions:
+            d = Distribution(self.__service, distro)
+            yield d
+
+    # __contains__
+    #
+    def __contains__(self, item):
+        return item in self.__iter__()
+
+    # __fetch_if_needed
+    #
+    def __fetch_if_needed(self):
+        if self.__distributions == None:
+            self.__distributions = self.__service.launchpad.distributions
+
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'lpltk/distro_series.py'
--- lpltk/distro_series.py	1970-01-01 00:00:00 +0000
+++ lpltk/distro_series.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,98 @@
+#!/usr/bin/python
+
+from person                   import Person
+from utils                    import o2str
+
+class DistroSeries(object):
+    # __init__
+    #
+    def __init__(self, service, bug, lp_distro_series):
+        self.__service           = service
+        self.__bug               = bug
+        self.__lp_distro_series  = lp_distro_series
+        self.__date_created      = None
+        self.__owner             = None
+        self.__status            = None
+        self.__driver            = None
+        self.__active            = None
+        self.__supported         = None
+        self.__description       = None
+        self.__display_name      = None
+        self.__full_series_name  = None
+        self.__name              = None
+        self.__summary           = None
+        self.__title             = None
+
+    @property
+    def date_created(self):
+        if self.__date_created == None:
+            self.__date_created = self.__lp_distro_series.date_created
+        return self.__date_created
+
+    @property
+    def owner(self):
+        if self.__owner == None:
+            self.__owner = Person(self.__bug, self.__lp_distro_series.owner)
+        return self.__owner
+
+    @property
+    def driver(self):
+        if self.__driver == None:
+            self.__driver = Person(self.__bug, self.__lp_distro_series.driver)
+        return self.__driver
+
+    @property
+    def status(self):
+        if self.__status == None:
+            self.__status = self.__lp_distro_series.status
+        return self.__status
+
+    @property
+    def active(self):
+        if self.__active == None:
+            self.__active = self.__lp_distro_series.active
+        return self.__active
+
+    @property
+    def supported(self):
+        if self.__supported == None:
+            self.__supported = self.__lp_distro_series.supported
+        return self.__supported
+
+    @property
+    def description(self):
+        if self.__description == None:
+            self.__description = o2str(self.__lp_distro_series.description)
+        return self.__description
+
+    @property
+    def display_name(self):
+        if self.__display_name == None:
+            self.__display_name = o2str(self.__lp_distro_series.displayname)
+        return self.__display_name
+
+    @property
+    def full_series_name(self):
+        if self.__full_series_name == None:
+            self.__full_series_name = o2str(self.__lp_distro_series.fullseriesname)
+        return self.__full_series_name
+
+    @property
+    def name(self):
+        if self.__name == None:
+            self.__name = o2str(self.__lp_distro_series.name)
+        return self.__name
+
+    @property
+    def summary(self):
+        if self.__summary == None:
+            self.__summary = o2str(self.__lp_distro_series.summary)
+        return self.__summary
+
+    @property
+    def title(self):
+        if self.__title == None:
+            self.__title = o2str(self.__lp_distro_series.title)
+        return self.__title
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'lpltk/message.py'
--- lpltk/message.py	1970-01-01 00:00:00 +0000
+++ lpltk/message.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+
+from utils                      import o2str
+from person                     import Person
+
+# Message
+#
+class Message(object):
+    # __init__
+    #
+    def __init__(self, tkbug, lpmessage):
+        self.__tkbug          = tkbug
+        self.__commit_changes = tkbug.commit_changes
+        self.__message        = lpmessage
+        self.__owner          = None
+        self.__content        = None
+        self.__date_created   = None
+        self.__parent         = None
+        self.__subject        = None
+
+    # owner
+    #
+    @property
+    def owner(self):
+        if self.__owner == None:
+            self.__owner = Person(self.__tkbug, self.__message.owner)
+        return self.__owner
+
+    # content
+    @property
+    def content(self):
+        if self.__content == None:
+            self.__content = o2str(self.__message.content)
+        return self.__content
+
+    # date_created
+    @property
+    def date_created(self):
+        if self.__date_created == None:
+            self.__date_created = self.__message.date_created
+        return self.__date_created
+
+    # parent
+    @property
+    def parent(self):
+        if self.__parent == None:
+            self.__parent = Message(self.__tkbug, self.__message.parent)
+        return self.__parent
+
+    # subject
+    @property
+    def subject(self):
+        if self.__subject == None:
+            self.__subject = o2str(self.__message.subject)
+        return self.__subject
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'lpltk/messages.py'
--- lpltk/messages.py	1970-01-01 00:00:00 +0000
+++ lpltk/messages.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+
+from message                    import Message
+
+class Messages(object):
+    # __init__
+    #
+    # Initialize the instance from a Launchpad bug.
+    #
+    def __init__(self, tkbug):
+        self.__tkbug                = tkbug
+        self.__commit_changes       = tkbug.commit_changes
+        self.__messages             = None
+
+    # __len__
+    #
+    def __len__(self):
+        return len(list(self.__iter__()))
+
+    # __getitem__
+    #
+    def __getitem__(self, key):
+        return list(self.__iter__())[key]
+
+    # __iter__
+    #
+    def __iter__(self):
+        self.__fetch_if_needed()
+        for msg in self.__messages:
+            m = Message(self.__tkbug, msg)
+            yield m
+
+    # __contains__
+    #
+    def __contains__(self, item):
+        return item in self.__iter__()
+
+    # __fetch_if_needed
+    #
+    def __fetch_if_needed(self):
+        if self.__messages == None:
+            self.__messages = self.__tkbug.lpbug.messages_collection
+
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'lpltk/milestone.py'
--- lpltk/milestone.py	1970-01-01 00:00:00 +0000
+++ lpltk/milestone.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,44 @@
+#!/usr/bin/python
+
+from utils                        import o2str
+
+# Milestone
+#
+# A class that provides a convenient interface to a Launchpad milestone.
+#
+class Milestone(object):
+    # __init__
+    #
+    # Initialize the Bug instance from a Launchpad bug.
+    #
+    def __init__(self, service, lp_milestone, commit_changes=True):
+        self.__service        = service
+        self.__lp_milestone   = lp_milestone
+        self.__commit_changes = commit_changes
+
+    @property
+    def code_name(self):
+        return o2str(self.__lp_milestone.code_name)
+
+    @property
+    def date_targeted(self):
+        return self.__lp_milestone.date_targeted
+
+    @property
+    def is_active(self):
+        return self.__lp_milestone.is_active
+
+    @property
+    def name(self):
+        return o2str(self.__lp_milestone.name)
+
+    @property
+    def summary(self):
+        return o2str(self.__lp_milestone.summary)
+
+    @property
+    def title(self):
+        return o2str(self.__lp_milestone.title)
+
+# vi:set ts=4 sw=4 expandtab:
+

=== added file 'lpltk/nomination.py'
--- lpltk/nomination.py	1970-01-01 00:00:00 +0000
+++ lpltk/nomination.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,74 @@
+#!/usr/bin/python
+
+from person                   import Person
+from project_series           import ProjectSeries
+from distro_series            import DistroSeries
+from bug_target               import BugTarget
+
+class Nomination(object):
+    # __init__
+    #
+    def __init__(self, service, bug, lp_nomination):
+        self.__service        = service
+        self.__bug            = bug
+        self.__lp_nomination  = lp_nomination
+        self.__date_created   = None
+        self.__date_decided   = None
+        self.__status         = None
+        self.__distro_series  = None
+        self.__product_series = None
+        self.__target         = None
+
+    @property
+    def date_created(self):
+        if self.__date_created == None:
+            self.__date_created = self.__lp_nomination.date_created
+        return self.__date_created
+
+    @property
+    def date_decided(self):
+        if self.__date_decided == None:
+            self.__date_decided = self.__lp_nomination.date_decided
+        return self.__date_decided
+
+    @property
+    def decider(self):
+        if self.__decider == None:
+            self.__decider = Person(self.__bug, self.__lp_nomination.decider)
+        return self.__decider
+
+    @property
+    def owner(self):
+        if self.__owner == None:
+            self.__owner = Person(self.__bug, self.__lp_nomination.owner)
+        return self.__owner
+
+    @property
+    def status(self):
+        if self.__status == None:
+            self.__status = self.__lp_nomination.status
+        return self.__status
+
+    @property
+    def distro_series(self):
+        if self.__distro_series == None:
+            lp_ds = self.__lp_nomination.distroseries
+            if lp_ds != None:
+                self.__distro_series = DistroSeries(self.__service, self.__bug, lp_ds)
+        return self.__distro_series
+
+    @property
+    def target(self):
+        if self.__target == None:
+            self.__target = BugTarget(self.__service, self.__bug, self.__lp_nomination.target)
+        return self.__target
+
+    @property
+    def product_series(self):
+        if self.__product_series == None:
+            lp_ps = self.__lp_nomination.productseries
+            if lp_ps != None:
+                self.__product_series = ProjectSeries(self.__service, self.__bug, lp_ps)
+        return self.__product_series
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'lpltk/nominations.py'
--- lpltk/nominations.py	1970-01-01 00:00:00 +0000
+++ lpltk/nominations.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+
+from nomination                  import Nomination
+
+class Nominations(object):
+    # __init__
+    #
+    # Initialize the instance from a Launchpad bug.
+    #
+    def __init__(self, service, bug):
+        self.__service       = service
+        self.__bug           = bug
+        self.__lp_nominations   = None
+
+    # __len__
+    #
+    def __len__(self):
+        return len(list(self.__iter__()))
+
+    # __getitem__
+    #
+    def __getitem__(self, key):
+        self.__fetch_if_needed()
+        return Nomination(self.__service, self.__bug, self.__lp_nominations[key])
+
+    # __iter__
+    #
+    def __iter__(self):
+        self.__fetch_if_needed()
+        for nom in self.__lp_nominations:
+            n = Nomination(self.__service, self.__bug, nom)
+            yield n
+
+    # __contains__
+    #
+    def __contains__(self, item):
+        return item in self.__iter__()
+
+    # __fetch_if_needed
+    #
+    def __fetch_if_needed(self):
+        if self.__lp_nominations == None:
+            self.__lp_nominations = self.__bug.lpbug.getNominations()
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'lpltk/person.py'
--- lpltk/person.py	1970-01-01 00:00:00 +0000
+++ lpltk/person.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,64 @@
+#!/usr/bin/python
+
+from utils                      import o2str
+
+# Person
+#
+# A class that provides a convenient interface to a Launchpad person.
+# (as returned from a call to the bug.owner property)
+#
+class Person(object):
+    # __init__
+    #
+    # Initialize the Person instance from a Launchpad bug.
+    #
+    def __init__(self, tkbug, lpperson):
+        self.__tkbug          = tkbug
+        if tkbug != None:
+            self.__commit_changes = tkbug.commit_changes
+        self.__full_name      = None
+        self.__person         = lpperson
+
+    def __eq__(self, other):
+        if other == None:
+            return False
+        return self.lpperson == other.lpperson
+
+    def __ne__(self, other):
+        if other == None:
+            return False
+        return self.lpperson != other.lpperson
+
+    #--------------------------------------------------------------------------
+    # display_name
+    #
+    @property
+    def display_name(self):
+        return self.full_name
+
+    #--------------------------------------------------------------------------
+    # full_name
+    #
+    @property
+    def full_name(self):
+        if self.__full_name == None:
+            self.__full_name = o2str(self.__person.display_name)
+        return self.__full_name
+
+    #--------------------------------------------------------------------------
+    # first_name
+    #
+    @property
+    def first_name(self):
+        if self.__full_name == None:
+            self.__full_name = o2str(self.__person.display_name)
+        return self.__full_name.split(' ')[0]
+
+    #--------------------------------------------------------------------------
+    # lpperson
+    #
+    @property
+    def lpperson(self):
+        return self.__person
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'lpltk/project.py'
--- lpltk/project.py	1970-01-01 00:00:00 +0000
+++ lpltk/project.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,50 @@
+#!/usr/bin/python
+
+from person                      import Person
+from bug_tasks                   import BugTasks
+
+# Project
+#
+class Project(object):
+    # __init__
+    #
+    def __init__(self, service, lp_project):
+        self.__service = service
+        self.__lp_project = lp_project
+        self.__owner        = None
+        self.__display_name = None
+
+    # __str__
+    #
+    def __str__(self):
+        return self.display_name
+
+    # owner
+    #
+    @property
+    def owner(self):
+        if self.__owner == None:
+            self.__owner = Person(None, self.__lp_project.owner)
+        return self.__owner
+
+    # display_name
+    #
+    @property
+    def display_name(self):
+        if self.__display_name == None:
+            self.__display_name = self.__lp_project.display_name
+        return self.__display_name
+
+    # searchTasks
+    #
+    def search_tasks(self, **params):
+        bt = BugTasks(self.__service, self.__lp_project.searchTasks(**params))
+        return bt
+
+    # self_link
+    #
+    @property
+    def self_link(self):
+        return self.__lp_project.self_link
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'lpltk/project_series.py'
--- lpltk/project_series.py	1970-01-01 00:00:00 +0000
+++ lpltk/project_series.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,77 @@
+#!/usr/bin/python
+
+from person                   import Person
+from utils                    import o2str
+
+class ProjectSeries(object):
+    # __init__
+    #
+    def __init__(self, service, bug, lp_project_series):
+        self.__service           = service
+        self.__bug               = bug
+        self.__lp_project_series = lp_project_series
+        self.__date_created      = None
+        self.__owner             = None
+        self.__status            = None
+        self.__driver            = None
+        self.__active            = None
+        self.__display_name      = None
+        self.__name              = None
+        self.__summary           = None
+        self.__title             = None
+
+    @property
+    def date_created(self):
+        if self.__date_created == None:
+            self.__date_created = self.__lp_project_series.date_created
+        return self.__date_created
+
+    @property
+    def owner(self):
+        if self.__owner == None:
+            self.__owner = Person(self.__bug, self.__lp_project_series.owner)
+        return self.__owner
+
+    @property
+    def driver(self):
+        if self.__driver == None:
+            self.__driver = Person(self.__bug, self.__lp_project_series.driver)
+        return self.__driver
+
+    @property
+    def status(self):
+        if self.__status == None:
+            self.__status = self.__lp_project_series.status
+        return self.__status
+
+    @property
+    def active(self):
+        if self.__active == None:
+            self.__active = self.__lp_project_series.active
+        return self.__active
+
+    @property
+    def display_name(self):
+        if self.__display_name == None:
+            self.__display_name = o2str(self.__lp_project_series.displayname)
+        return self.__display_name
+
+    @property
+    def name(self):
+        if self.__name == None:
+            self.__name = o2str(self.__lp_project_series.name)
+        return self.__name
+
+    @property
+    def summary(self):
+        if self.__summary == None:
+            self.__summary = o2str(self.__lp_project_series.summary)
+        return self.__summary
+
+    @property
+    def title(self):
+        if self.__title == None:
+            self.__title = o2str(self.__lp_project_series.title)
+        return self.__title
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'lpltk/projects.py'
--- lpltk/projects.py	1970-01-01 00:00:00 +0000
+++ lpltk/projects.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+
+from project                    import Project
+
+class Projects(object):
+    # __init__
+    #
+    # Initialize the instance from a Launchpad bug.
+    #
+    def __init__(self, service):
+        self.__service       = service
+        self.__projects = None
+
+    # __len__
+    #
+    def __len__(self):
+        return len(list(self.__iter__()))
+
+    # __getitem__
+    #
+    def __getitem__(self, key):
+        self.__fetch_if_needed()
+        return Project(self.__service, self.__projects[key])
+
+    # __iter__
+    #
+    def __iter__(self):
+        self.__fetch_if_needed()
+        for project in self.__projects:
+            d = Project(self.__service, project)
+            yield d
+
+    # __contains__
+    #
+    def __contains__(self, item):
+        return item in self.__iter__()
+
+    # __fetch_if_needed
+    #
+    def __fetch_if_needed(self):
+        if self.__projects == None:
+            self.__projects = self.__service.launchpad.projects
+
+
+# vi:set ts=4 sw=4 expandtab:

=== added symlink 'lpltk/service.py'
=== target is u'LaunchpadService.py'
=== added file 'lpltk/tags.py'
--- lpltk/tags.py	1970-01-01 00:00:00 +0000
+++ lpltk/tags.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,90 @@
+#!/usr/bin/python
+
+class BugTags(object):
+    # __init__
+    #
+    def __init__(self, tkbug):
+        self.__tkbug          = tkbug
+        self.__tags           = None
+        self.__commit_changes = tkbug.commit_changes
+
+    # __len__
+    #
+    def __len__(self):
+        self.__fetch_if_needed()
+        return len(self.__tags)
+
+    # __getitem__
+    #
+    def __getitem__(self, key):
+        self.__fetch_if_needed()
+        return self.__tags[key]
+
+    # __setitem__
+    #
+    def __setitem__(self, key, value):
+        self.__fetch_if_needed()
+        self.__tags[key] = value
+        self.__save_tags()
+
+    # __delitem__
+    #
+    def __delitem__(self, key):
+        self.__fetch_if_needed()
+        del self.__tags[key]
+        self.__save_tags()
+
+    # __iter__
+    #
+    def __iter__(self):
+        self.__fetch_if_needed()
+        for tag in self.__tags:
+            yield tag
+
+    # __contains__
+    #
+    def __contains__(self, item):
+        self.__fetch_if_needed()
+        return item in self.__tags
+
+    # __save_tags
+    #
+    def __save_tags(self):
+        if self.__commit_changes:
+            self.__tkbug.lpbug.tags = self.__tags
+            self.__tkbug.lpbug.lp_save()
+
+    # __fetch_if_needed
+    #
+    def __fetch_if_needed(self):
+        if self.__tags == None:
+            self.__tags = self.__tkbug.lpbug.tags
+
+    # append
+    #
+    def append(self, item):
+        self.__fetch_if_needed()
+        if not isinstance(item, str):
+            raise TypeError("Must be a string")
+        self.__tags.append(item)
+        self.__save_tags()
+
+    # extend
+    #
+    def extend(self, items):
+        self.__fetch_if_needed()
+        if not isinstance(items, list):
+            raise TypeError("Must be a list")
+        self.__tags.extend(items)
+        self.__save_tags()
+
+    # remove
+    #
+    def remove(self, item):
+        self.__fetch_if_needed()
+        if not isinstance(item, str):
+            raise TypeError("Must be a string")
+        self.__tags.remove(item)
+        self.__save_tags()
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'lpltk/utils.py'
--- lpltk/utils.py	1970-01-01 00:00:00 +0000
+++ lpltk/utils.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+from decimal                import Decimal
+
+# o2str
+#
+# Convert a unicode or decial.Decimal object to a str.
+#
+def o2str(obj):
+    retval = None
+    if type(obj) != str:
+        if type(obj) == unicode:
+            retval = obj.encode('ascii', 'ignore')
+        elif type(obj) == Decimal:
+            retval = str(obj)
+    else:
+        retval = obj
+    return retval
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'run-tests'
--- run-tests	1970-01-01 00:00:00 +0000
+++ run-tests	2011-02-10 18:57:44 +0000
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+for t in tests/test-*; do
+    echo $t
+    python $t
+    echo
+done

=== added directory 'scripts'
=== renamed directory 'scripts' => 'scripts.moved'
=== added file 'scripts/close-fix-committed-bugs'
--- scripts/close-fix-committed-bugs	1970-01-01 00:00:00 +0000
+++ scripts/close-fix-committed-bugs	2011-02-10 18:57:44 +0000
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+# Copyright 2010 Bryce Harrington <bryce@xxxxxxxxxxxxx>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+import sys
+from lpltk import LaunchpadService
+
+if len(sys.argv) != 2:
+    print 'Usage: %s <project-name>' % sys.argv[0]
+    sys.exit(1)
+project_name = sys.argv[1]
+
+try:
+    lp          = LaunchpadService()
+    project     = lp.load_project(project_name)
+except:
+    sys.stderr.write("Could not connect to launchpad\n")
+    sys.exit(7)
+
+
+def truncate(text, max_size):
+    if len(text) <= max_size:
+        return text
+    return text[:max_size].rsplit(' ', 1)[0]+"..."
+
+def get_next_milestone(project):
+    next_milestone = None
+    for series in project.series:
+        if series.status == "Active Development" or series.status == "Pre-release Freeze":
+            for milestone in series.active_milestones:
+                if not next_milestone or not next_milestone.date_targeted or \
+                        milestone.date_targeted < next_milestone.date_targeted:
+                    next_milestone = milestone
+    if next_milestone:
+        return next_milestone
+    else:
+        return None
+
+
+next_milestone = get_next_milestone(project)
+if not next_milestone:
+    print "No milestone coming up"
+    sys.exit(0)
+
+for bugtask in project.searchTasks(status = "Fix Committed", milestone = next_milestone):
+    bugtask.status = 'Fix Released'
+    bugtask.lp_save()
+    print "%7s  %s-->Fix Released  %-40s" %(bugtask.bug.id, bugtask.status, truncate(bugtask.bug.title,60) )
+
+
+sys.exit(0)

=== added file 'scripts/current-ubuntu-development-codename'
--- scripts/current-ubuntu-development-codename	1970-01-01 00:00:00 +0000
+++ scripts/current-ubuntu-development-codename	2011-02-10 18:57:44 +0000
@@ -0,0 +1,14 @@
+#!/usr/bin/python
+
+import sys
+from lpltk import LaunchpadService
+
+try:
+    lp          = LaunchpadService(config={'read_only':True})
+    d           = lp.load_project("ubuntu")
+    print d.current_series.name
+
+except:
+    sys.exit(7)
+
+sys.exit(0)

=== added file 'scripts/current-ubuntu-release-codename'
--- scripts/current-ubuntu-release-codename	1970-01-01 00:00:00 +0000
+++ scripts/current-ubuntu-release-codename	2011-02-10 18:57:44 +0000
@@ -0,0 +1,16 @@
+#!/usr/bin/python
+
+import sys
+from lpltk import LaunchpadService
+
+try:
+    lp          = LaunchpadService(config={'read_only':True})
+    d           = lp.load_project("ubuntu")
+    for series in d.series:
+        if series.status == "Current Stable Release":
+            print series.name
+
+except:
+    sys.exit(7)
+
+sys.exit(0)

=== added file 'scripts/current-ubuntu-supported-releases'
--- scripts/current-ubuntu-supported-releases	1970-01-01 00:00:00 +0000
+++ scripts/current-ubuntu-supported-releases	2011-02-10 18:57:44 +0000
@@ -0,0 +1,16 @@
+#!/usr/bin/python
+
+import sys
+from lpltk import LaunchpadService
+
+try:
+    lp          = LaunchpadService(config={'read_only':True})
+    d           = lp.load_project("ubuntu")
+    for series in d.series:
+        if series.status == "Supported":
+            print series.name
+
+except:
+    sys.exit(7)
+
+sys.exit(0)

=== added file 'scripts/find-similar-bugs'
--- scripts/find-similar-bugs	1970-01-01 00:00:00 +0000
+++ scripts/find-similar-bugs	2011-02-10 18:57:44 +0000
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+
+import sys
+from lpltk import LaunchpadService
+
+lp   = LaunchpadService(config={'read_only':True})
+
+if len(sys.argv) < 2:
+    print "Usage:  similar-bugs [bug-id]"
+    sys.exit(2)
+bug_id = sys.argv[1]
+
+bug = lp.launchpad.bugs[bug_id]
+for dupe in bug.bug_tasks[0].findSimilarBugs():
+    print "%12d %s" %(dupe.id, dupe.title)
+

=== added file 'scripts/launchpad-service-status'
--- scripts/launchpad-service-status	1970-01-01 00:00:00 +0000
+++ scripts/launchpad-service-status	2011-02-10 18:57:44 +0000
@@ -0,0 +1,75 @@
+#!/usr/bin/python
+
+# Script to check if launchpad is up and usable.
+#
+# Since this script does some http queries it is a bit slow.  The intent
+# is to run it periodically to 'test' launchpad and cache the result
+# locally; cronjobs can then check this cached status value to see if
+# launchpad is available, and if not, bail out and not bother trying to
+# run.
+
+import re
+import sys
+import feedparser
+from datetime import ( datetime, timedelta )
+import launchpadlib
+from launchpadlib.launchpad import Launchpad
+
+consumer='lpltk'
+service_root='production'
+
+def expected_outage():
+    """Returns tuple of (start, stop) time for the current or next expected outage"""
+
+    (expected_start, expected_end) = (None, None)
+
+    d = feedparser.parse('http://blog.launchpad.net/category/notifications/feed')
+    latest_entry = d['entries'][0]
+    notice_html = latest_entry['content'][0]['value']
+
+    date_format = ' %H.%M UTC %d of %B %Y'
+
+    m = re.search("Starts:.*>(.*)<", notice_html)
+    if m:
+        raw_text = m.group(1)
+        text = re.sub(r'(\d+)(?:st|nd|rd|th) ', r'\1 ', raw_text)
+        expected_start = datetime.strptime(text, date_format)
+
+    m = re.search('Expected.*back.*by.*>(.*)<', notice_html)
+    if m:
+        raw_text = m.group(1)
+        text = re.sub(r'(\d+)(?:st|nd|rd|th) ', r'\1 ', raw_text)
+        expected_end = datetime.strptime(text, date_format)
+
+    return (expected_start, expected_end)
+
+
+(outage_start, outage_end) = expected_outage()
+
+# Are we in the middle of an expected outage?
+if datetime.now() > outage_start and datetime.now() < outage_end:
+    print 'OFFLINE EXPECTED'
+    sys.exit(3)
+
+# Will we be offline shortly?
+pending_offline_time = timedelta(hours=2)
+if datetime.now() + pending_offline_time > outage_start:
+    print 'PENDING OFFLINE'
+    sys.exit(2)
+
+# Can we at least reach launchpad's api service in minimal read-only mode?
+try:
+    lp = Launchpad.login_anonymously(consumer, service_root) # Need >= 1.5.1
+except:
+    print 'OFFLINE UNKNOWN'
+    sys.exit(9)
+
+# See if we can access read-write too
+try:
+    lp = Launchpad.login_with(consumer, service_root)
+    print 'UP READWRITE'
+except:
+    print 'UP READONLY'
+    sys.exit(1)
+
+sys.exit(0)

=== added file 'scripts/ls-assigned-bugs'
--- scripts/ls-assigned-bugs	1970-01-01 00:00:00 +0000
+++ scripts/ls-assigned-bugs	2011-02-10 18:57:44 +0000
@@ -0,0 +1,16 @@
+#!/usr/bin/python
+
+from lpltk import LaunchpadService
+
+lp = LaunchpadService(config={'read_only':True})
+d = lp.load_project("ubuntu")
+
+for bugtask in d.searchTasks(assignee=lp.launchpad.me):
+    print bugtask.title
+    print "  Reported by: ",bugtask.owner.display_name
+    print "  Importance:  ",bugtask.importance
+    print "  Status:      ",bugtask.status
+    print "  Assigned on: ",bugtask.date_assigned
+    if bugtask.milestone:
+        print "  Milestone:   ",bugtask.milestone.name
+    print

=== added file 'scripts/ls-series'
--- scripts/ls-series	1970-01-01 00:00:00 +0000
+++ scripts/ls-series	2011-02-10 18:57:44 +0000
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+from lpltk import LaunchpadService
+
+lp   = LaunchpadService(config={'read_only':True})
+d    = lp.load_project("ubuntu")
+
+next_milestone = None
+for series in d.series:
+    print "%-10s %-20s %-25s" % (series.name,
+                                 series.status,
+                                 series.date_created)
+    if series.status == "Active Development" or series.status == "Pre-release Freeze":
+        for milestone in series.active_milestones:
+            print "%10s %-20s %-25s" % ("-->", milestone.name, milestone.date_targeted)
+            if milestone.date_targeted and not next_milestone:
+                next_milestone = milestone
+            elif next_milestone and milestone.date_targeted < next_milestone.date_targeted:
+                next_milestone = milestone
+
+print
+print "The next milestone is ", next_milestone.name

=== added file 'scripts/test'
--- scripts/test	1970-01-01 00:00:00 +0000
+++ scripts/test	2011-02-10 18:57:44 +0000
@@ -0,0 +1,74 @@
+#!/usr/bin/python
+
+# TODO: Cleanup import statements
+import os
+import sys
+import httplib2
+import socket
+import launchpadlib
+from launchpadlib.launchpad import Launchpad
+from lpltk import LaunchpadService
+from lpltk.debug import *
+read_only = True
+
+class LaunchpadService:
+    """
+    TODO:
+      * Document class
+      * Document LPDEBUG environment option
+    """
+
+    def __init__(self, consumer='lpltk', service_root='production', read_only=False):
+        """
+        If launchpad cannot be accessed, will throw an exception (TODO).
+        @param consumer: TODO
+        @param service_root: TODO
+        @param read_only: TODO
+        """
+        self.consumer = consumer
+        self.service_root = service_root
+        self.read_only = read_only
+
+        ''' Debugging '''
+        if "LPDEBUG" in os.environ:
+            httplib2.debuglevel = os.getenv("LPDEBUG", None)
+            sys.stdout = DebugStdOut()
+
+        dbg("Launchpadlib Version: %s" %(launchpadlib.__version__))
+        dbg("Login With:  %s %s" %(self.consumer, self.service_root))
+        dbg("Read Only:  %s" %(self.read_only))
+
+        if not self._get_creds():
+            err("Error:  Could not retrieve credentials from launchpad")
+
+    def _get_creds(self):
+        if self.read_only:
+            # TODO:  Only supported on 1.5.4 or newer
+            self.launchpad = Launchpad.login_anonymously(self.consumer, self.service_root)
+        else:
+            self.launchpad = Launchpad.login_with(self.consumer, self.service_root)
+        return True
+
+# Need >= 1.5.1
+if read_only:
+    lp = LaunchpadService(read_only=True, service_root="edge")
+    print lp.launchpad.bugs[1].title
+
+else:
+    lp = LaunchpadService(read_only=False)
+    print 'Hello, %s!' % lp.launchpad.me.display_name
+
+    
+
+#lp = LaunchpadService()
+#d = lp.load_project("ubuntu")
+
+#for bugtask in d.searchTasks(assignee=lp.launchpad.me):
+#    print bugtask.title
+#    print "  Reported by: ",bugtask.owner.display_name
+#    print "  Importance:  ",bugtask.importance
+#    print "  Status:      ",bugtask.status
+#    print "  Assigned on: ",bugtask.date_assigned
+#    if bugtask.milestone:
+#        print "  Milestone:   ",bugtask.milestone.name
+#    print

=== added file 'setup.py'
--- setup.py	1970-01-01 00:00:00 +0000
+++ setup.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+
+# Copyright (C) Canonical, Ltd.  Licensed under the GPL
+
+from distutils.core import setup
+import os
+import re
+
+# look/set what version we have
+changelog = "debian/changelog"
+if os.path.exists(changelog):
+    head=open(changelog).readline()
+    match = re.compile(".*\((.*)\).*").match(head)
+    if match:
+        version = match.group(1)
+
+setup(name     = 'python-launchpadlib-toolkit',
+      version  = version,
+      packages = ['lpltk'],
+      scripts  = [
+        'scripts/current-ubuntu-supported-releases',
+        'scripts/current-ubuntu-development-codename',
+        'scripts/current-ubuntu-release-codename',
+        'scripts/launchpad-service-status',
+        'scripts/ls-assigned-bugs',
+        'scripts/find-similar-bugs',
+        'scripts/close-fix-committed-bugs',
+        ],
+)

=== renamed file 'setup.py' => 'setup.py.moved'
=== added directory 'tests'
=== added file 'tests/test-attachments.py'
--- tests/test-attachments.py	1970-01-01 00:00:00 +0000
+++ tests/test-attachments.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,176 @@
+#!/usr/bin/python
+
+import sys, os.path
+sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), "..")))
+
+import unittest
+from lpltk.LaunchpadService import LaunchpadService
+from lpltk.attachments import *
+from lpltk.person import *
+
+class TestTags(unittest.TestCase):
+
+    # setUp
+    #
+    def setUp(self):
+        self.configuration = {}
+        self.configuration['launchpad_services_root'] = 'edge'
+        self.configuration['read_only']               = True
+
+    # tearDown
+    #
+    def tearDown(self):
+        pass
+
+    # test__init__
+    #
+    def test__init__(self):
+        # Attachments object creation
+        #
+        print
+        try:
+            ls  = LaunchpadService(self.configuration)
+            bug = ls.get_bug(107232)
+            attachments = bug.attachments
+
+            print "Class:   %s" %(type(attachments))
+            print "Atts:    %d" %(len(attachments))
+            for attachment in attachments:
+                print "  Type:  %s" %(type(attachment))
+                print "  Title: %s" %(attachment.title)
+                print "  Kind:  %s" %(attachment.kind)
+                print
+
+        finally:
+            bug = None
+            ls  = None
+
+    def test_attachment_owner(self):
+        print
+        try:
+            ls  = LaunchpadService(self.configuration)
+            bug = ls.get_bug(107232)
+            attachments = bug.attachments
+
+            for attachment in attachments:
+                assert(attachment.owner)
+                print "  Owner: %s" %(attachment.owner.lpperson)
+                print "  First: %s" %(attachment.owner.first_name)
+                print "  Msg:   %s chars" %(len(attachment.message.content))
+                print "  Age:   %s days" %(attachment.age)
+                print
+
+        finally:
+            bug = None
+            ls  = None
+
+    def test_attachment_contents(self):
+        print
+        try:
+            ls  = LaunchpadService(self.configuration)
+            bug = ls.get_bug(107232)
+            attachments = bug.attachments
+
+            for attachment in attachments:
+                print "  filename:     %s" %(attachment.filename)
+                print "  content-type: %s" %(attachment.content_type)
+                print "  content:      %s chars" %(len(attachment.content))
+                print "  patch?        %s" %(attachment.is_patch())
+                print "  archive?      %s" %(attachment.is_archive())
+                print
+
+        finally:
+            bug = None
+            ls  = None
+
+    def test_containment(self):
+        print
+        try:
+            ls  = LaunchpadService(self.configuration)
+            bug = ls.get_bug(107232)
+            attachments = bug.attachments
+
+            # Test containment
+            attachment = attachments[0]
+            if not attachment in attachments:
+                raise AssertionError
+            else:
+                print "Located attachment in collection"
+
+        finally:
+            bug = None
+            ls  = None
+
+    def test_requirements(self):
+        print
+        try:
+            ls  = LaunchpadService(self.configuration)
+            bug = ls.get_bug(107232)
+            attachments = bug.attachments
+
+            missing = attachments.check_required_files(['*.tar.gz', 'alsa.*', 'faslkjasdfnfds*asdfdsaa'])
+            if len(missing)>1:
+                print "Unexpectedly missing files %s" %(missing)
+                raise AssertionError
+
+            print "Required files present and accounted for, except: %s" %(missing)
+
+        finally:
+            bug = None
+            ls  = None
+
+    def test_owner_filtered_attachments(self):
+        print
+        try:
+            ls  = LaunchpadService(self.configuration)
+            bug = ls.get_bug(107232)
+            lark = Person(bug, ls.launchpad.people['florent-g'])
+            attachments = bug.attachments
+
+            # Test len()
+            print "  %d attachments before filtering" %(len(attachments))
+            attachments.add_filter(filter_owned_by_person, [lark])
+            print "  %d attachments after filtering" %(len(attachments))
+            print
+
+            # Test iteration
+            for attachment in attachments:
+                print "  Type:  %s" %(type(attachment))
+                print "  Title: %s" %(attachment.title)
+                print "  Owner:  %s" %(attachment.owner.full_name)
+                print
+
+        finally:
+            bug = None
+            ls  = None
+
+    def test_filename_filtered_attachments(self):
+        print
+        try:
+            ls  = LaunchpadService(self.configuration)
+            bug = ls.get_bug(570228)
+            attachments = bug.attachments
+
+            glob_patterns = ["*Xorg*Log*", "*Dmesg.txt"]
+
+            print "  %d attachments before filtering" %(len(attachments))
+            attachments.add_filter(filter_filename_matches_globs, glob_patterns)
+            print "  %d attachments after filtering on filenames" %(len(attachments))
+
+            age = 0
+            for attachment in attachments:
+                age = attachment.age
+
+            attachments.add_filter(filter_age_between, [age-1, age+1])
+            print "  %d attachments after filtering on age" %(len(attachments))
+            print
+
+        finally:
+            bug = None
+            ls  = None
+
+
+if __name__ == '__main__':
+    unittest.main()
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'tests/test-bug.py'
--- tests/test-bug.py	1970-01-01 00:00:00 +0000
+++ tests/test-bug.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,104 @@
+#!/usr/bin/python
+
+import os
+import sys, os.path
+sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), "..")))
+
+import unittest
+from lpltk                import LaunchpadService
+
+class TestBug(unittest.TestCase):
+
+    # setUp
+    #
+    def setUp(self):
+        self.configuration = {}
+        self.configuration['launchpad_services_root'] = 'staging'
+
+    # test__init__
+    #
+    def test__init__(self):
+        # Basic instance creation. 
+        #
+        try:
+            ls  = LaunchpadService(self.configuration)
+            bug = ls.get_bug(3)
+        except:
+            self.assertTrue(False)
+        finally:
+            bug = None
+            ls  = None
+
+    # test_get_title
+    #
+    def test_get_title(self):
+        try:
+            ls    = LaunchpadService(self.configuration)
+            bug   = ls.get_bug(3)
+            title = bug.title
+            self.assertEqual(title, 'Custom information for each translation team')
+        finally:
+            bug = None
+            ls  = None
+
+    # test_set_title
+    #
+    def test_set_title(self):
+        try:
+            ls    = LaunchpadService(self.configuration)
+            bug   = ls.get_bug(3)
+            original_title = bug.title
+            bug.title = "Testing Bug.title property"
+            self.assertEqual(bug.title, 'Testing Bug.title property')
+            bug.title = original_title
+            self.assertEqual(bug.title, original_title)
+        finally:
+            bug = None
+            ls  = None
+
+    # test_get_description
+    #
+    def test_get_description(self):
+        try:
+            ls    = LaunchpadService(self.configuration)
+            bug   = ls.get_bug(3)
+            description = bug.description
+            if "It would be nice if we could easily add *MUST READ* type of links" not in description:
+                self.assertTrue(False)
+        finally:
+            bug = None
+            ls  = None
+
+    # test_set_description
+    #
+    def test_set_description(self):
+        try:
+            ls    = LaunchpadService(self.configuration)
+            bug   = ls.get_bug(3)
+            original_description = bug.description
+            bug.description = "Testing Bug.title property"
+            self.assertEqual(bug.description, 'Testing Bug.title property')
+            bug.description = original_description
+            self.assertEqual(bug.description, original_description)
+        finally:
+            bug = None
+            ls  = None
+
+    # test_owner_full_name
+    #
+    def test_owner_full_name(self):
+        ls    = LaunchpadService(self.configuration)
+        bug   = ls.get_bug(3)
+        self.assertEqual("Jordi Mallach", bug.owner.full_name)
+
+    # test_owner_first_name
+    #
+    def test_owner_first_name(self):
+        ls    = LaunchpadService(self.configuration)
+        bug   = ls.get_bug(3)
+        self.assertEqual("Jordi", bug.owner.first_name)
+
+if __name__ == '__main__':
+    unittest.main()
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'tests/test-launchpad-service.py'
--- tests/test-launchpad-service.py	1970-01-01 00:00:00 +0000
+++ tests/test-launchpad-service.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,123 @@
+#!/usr/bin/python
+
+import os
+import sys, os.path
+sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), "..")))
+
+import unittest
+from lpltk                import LaunchpadService
+
+class TestLaunchpadService(unittest.TestCase):
+    # setUp
+    #
+    def setUp(self):
+        pass
+
+    # test__init__
+    #
+    def test__init__(self):
+        # Basic instance creation. 
+        #
+        try:
+            ls = LaunchpadService()
+            ls = None
+        except:
+            self.assertTrue(False)
+
+        # Verify default configuration parameters are set correctly.
+        #
+        try:
+            ls = LaunchpadService()
+            self.assertEqual(ls.config['launchpad_client_name'], 'lpltk')
+            self.assertEqual(ls.config['launchpad_services_root'], 'production')
+            self.assertEqual(ls.config['project_name'], '')
+            self.assertEqual(ls.config['read_only'], False)
+            self.assertEqual(ls.config['launchpad_cachedir'], os.path.join(os.path.expanduser('~'), '.cache', ls.config['launchpad_client_name']))
+            ls = None
+        except:
+            self.assertTrue(False)
+
+        # Verify that the default configuration parameters will be overridden by
+        # the passed in config dictionary.
+        #
+        try:
+            cfg = {}
+            cfg['launchpad_client_name']   = 'bilbo'
+            cfg['launchpad_services_root'] = 'edge'
+            cfg['project_name']            = 'linux'
+            cfg['read_only']               = True
+            cfg['launchpad_cachedir']      = 'deadEnd'
+            ls = LaunchpadService(cfg)
+            for k in cfg:
+                self.assertEqual(ls.config[k], cfg[k])
+            ls = None
+        except:
+            self.assertTrue(False)
+
+        # Verify that we actually connected to Launchpad by getting back the title
+        # or bug #1
+        #
+        try:
+            ls = LaunchpadService()
+            self.assertEqual(ls.launchpad.bugs[1].title, 'Microsoft has a majority market share')
+            ls = None
+        except:
+            self.assertTrue(False)
+
+        # Verify that I can connect to Launchpad in "read_only" mode.
+        #
+        try:
+            cfg = {}
+            cfg['read_only']               = True
+            ls = LaunchpadService(cfg)
+            self.assertEqual(ls.launchpad.bugs[1].title, 'Microsoft has a majority market share')
+            ls = None
+        except:
+            self.assertTrue(False)
+
+    # test_get_launchpad_bug
+    #
+    def test_get_launchpad_bug(self):
+        try:
+            ls = LaunchpadService()
+            b = ls.get_launchpad_bug(1)
+            self.assertEqual(b.title, 'Microsoft has a majority market share')
+            ls = None
+        except:
+            self.assertTrue(False)
+
+    # test_load_project
+    #
+    def test_load_project(self):
+        # Verify that a specific projct can be loaded
+        #
+        try:
+            ls = LaunchpadService()
+            p = ls.load_project('ubuntu')
+            self.assertEqual(p.display_name, 'Ubuntu')
+            self.assertEqual(p.owner.display_name, 'Ubuntu Drivers')
+            ls = None
+        except:
+            self.assertTrue(False)
+
+    # test_reset
+    #
+    def test_reset(self):
+        try:
+            ls = LaunchpadService()
+            ls.reset()
+            b = ls.get_launchpad_bug(1)
+            self.assertEqual(b.title, 'Microsoft has a majority market share')
+            ls = None
+        except:
+            self.assertTrue(False)
+
+    # test_new_bug
+    #
+    def test_new_bug(self):
+        pass
+
+if __name__ == '__main__':
+    unittest.main()
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'tests/test-tags.py'
--- tests/test-tags.py	1970-01-01 00:00:00 +0000
+++ tests/test-tags.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,160 @@
+#!/usr/bin/python
+
+import os
+import sys, os.path
+sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), "..")))
+
+import unittest
+from lpltk.LaunchpadService import LaunchpadService
+from lpltk.utils            import o2str
+
+class TestTags(unittest.TestCase):
+
+    # setUp
+    #
+    def setUp(self):
+        self.configuration = {}
+        self.configuration['launchpad_services_root'] = 'staging'
+
+    # tearDown
+    #
+    def tearDown(self):
+        ls    = LaunchpadService(self.configuration)
+        bug   = ls.get_bug(3)
+        tags = []
+        for tag in bug.tags:
+            tags.append(tag)
+
+        for tag in tags:
+            bug.tags.remove(o2str(tag))
+
+        bug.tags.append('feature')
+        
+    # test__init__
+    #
+    def test__init__(self):
+        # Tags object creation
+        #
+        try:
+            ls  = LaunchpadService(self.configuration)
+            bug = ls.get_bug(3)
+            tags = bug.tags
+        finally:
+            bug = None
+            ls  = None
+
+    # test__contains__
+    #
+    def test__contains__(self):
+        try:
+            ls    = LaunchpadService(self.configuration)
+            bug   = ls.get_bug(3)
+            self.assertTrue('feature' in bug.tags)
+            self.assertTrue('foo' not in bug.tags)
+        finally:
+            bug = None
+            ls  = None
+
+    # test__setitem__
+    #
+    def test__setitem__(self):
+        try:
+            ls    = LaunchpadService(self.configuration)
+            bug   = ls.get_bug(3)
+            bug.tags[0] = 'setitem'
+            self.assertTrue('setitem' == bug.tags[0])
+            bug.tags[0] = 'feature'
+            self.assertTrue('feature' == bug.tags[0])
+        finally:
+            bug = None
+            ls  = None
+
+    # test__getitem__
+    #
+    def test__getitem__(self):
+        try:
+            ls    = LaunchpadService(self.configuration)
+            bug   = ls.get_bug(3)
+            self.assertTrue('feature' == bug.tags[0])
+        finally:
+            bug = None
+            ls  = None
+
+    # test__iter__
+    #
+    def test__iter__(self):
+        try:
+            ls    = LaunchpadService(self.configuration)
+            bug   = ls.get_bug(3)
+
+            ct = 0
+            for tag in bug.tags:
+                ct += 1
+                self.assertTrue('feature' == bug.tags[0])
+            self.assertTrue(ct == 1)
+
+        finally:
+            bug = None
+            ls  = None
+
+    # test_len
+    #
+    def test_len(self):
+        try:
+            ls    = LaunchpadService(self.configuration)
+            bug   = ls.get_bug(3)
+            self.assertTrue(len(bug.tags) == 1)
+        finally:
+            bug = None
+            ls  = None
+
+    # test_append
+    #
+    def test_append(self):
+        try:
+            ls    = LaunchpadService(self.configuration)
+            bug   = ls.get_bug(3)
+            bug.tags.append('append')
+            self.assertTrue(len(bug.tags) == 2)
+            self.assertTrue('append' in bug.tags)
+            self.assertTrue('append' == bug.tags[0])
+        finally:
+            bug = None
+            ls  = None
+
+    # test_extend
+    #
+    def test_extend(self):
+        try:
+            ls    = LaunchpadService(self.configuration)
+            bug   = ls.get_bug(3)
+            tags_ct = len(bug.tags) # We don't know which order the tests will be run
+            bug.tags.extend(['extend', 'extend2'])
+            self.assertTrue(len(bug.tags) == (tags_ct + 2))
+            self.assertTrue('extend' in bug.tags)
+            self.assertTrue('extend2' in bug.tags)
+        finally:
+            bug = None
+            ls  = None
+
+    # test_remove
+    #
+    def test_remove(self):
+        try:
+            ls    = LaunchpadService(self.configuration)
+            bug   = ls.get_bug(3)
+            tags_ct = len(bug.tags) # We don't know which order the tests will be run
+            bug.tags.extend(['remove1', 'remove2'])
+            self.assertTrue(len(bug.tags) == (tags_ct + 2))
+            self.assertTrue('remove1' in bug.tags)
+            self.assertTrue('remove2' in bug.tags)
+            bug.tags.remove('remove1')
+            bug.tags.remove('remove2')
+        finally:
+            bug = None
+            ls  = None
+
+if __name__ == '__main__':
+    unittest.main()
+
+# vi:set ts=4 sw=4 expandtab:

=== added file 'tests/test-template.py'
--- tests/test-template.py	1970-01-01 00:00:00 +0000
+++ tests/test-template.py	2011-02-10 18:57:44 +0000
@@ -0,0 +1,38 @@
+#!/usr/bin/python
+
+import sys, os.path
+sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), "..")))
+
+import unittest
+from lpltk.LaunchpadService import LaunchpadService
+
+class TestTags(unittest.TestCase):
+
+    # setUp
+    #
+    def setUp(self):
+        self.configuration = {}
+        self.configuration['launchpad_services_root'] = 'staging'
+
+    # tearDown
+    #
+    def tearDown(self):
+        pass
+        
+    # test__init__
+    #
+    def test__init__(self):
+        # Tags object creation
+        #
+        try:
+            ls  = LaunchpadService(self.configuration)
+            bug = ls.get_bug(3)
+        finally:
+            bug = None
+            ls  = None
+
+
+if __name__ == '__main__':
+    unittest.main()
+
+# vi:set ts=4 sw=4 expandtab:


Follow ups