old_contents: # -*- coding: utf-8 -*-
  
  # This file is part of OpenHatch.
  # Copyright (C) 2011 Asheesh Laroia
  #
  # This program is free software: you can redistribute it and/or modify
  # it under the terms of the GNU Affero 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 Affero General Public License for more details.
  #
  # You should have received a copy of the GNU Affero General Public License
  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
  
  ### This file exists to wrap some dependencies for other parts of the code.
  ###
  ### In general, core parts of the OpenHatch site are forbidden from importing
  ### some hard-to-install modules, like lxml. Those files import from here
  ### instead so that if the import fails, the site doesn't crash.
  ###
  ### This is so that new contributors can run the OpenHatch site without
  ### installing these hard-to-install dependencies.
  
  # Used within this file
  import os
  import logging
  
  # Wrap lxml and the modules that are part of it
  class nothing(object):
          pass
  
  try:
      import lxml
      import lxml.etree
      import lxml.html
  except:
      lxml = nothing()
      lxml.etree = None
      lxml.html = None
  
  if lxml.html is None:
      logging.warning("Some parts of the OpenHatch site may fail because the lxml"
                      " library is not installed. Look in README.mkd for"
                      " information about lxml.")
  
  # Provide a helper to check if svnadmin is available. If not,
  # we can skip running code (and tests) that require it.
  
  def svnadmin_available():
      # FIXME: This should move to a variable controlled
      # by settings.py.
      SVNADMIN_PATH = '/usr/bin/svnadmin'
      return os.path.exists(SVNADMIN_PATH)
  
  ### Here we try to import "Image", from the Python Imaging Library.
  ### If we fail, Image is None.
  Image = None
  try:
      import Image
  except:
      try:
          from PIL import Image
      except ImportError:
          ### Okay, for a good time, let's hack sys.modules.
          ### This permits Django to think ImageFields might
          ### possibly work.
          import sys
          sys.modules['Image'] = sys.modules['sys']
  
  # Wrap launchpadbugs. We wrap it because it imports libxml2,
  # which qualifies as hard-to-install.
  
  try:
      import launchpadbugs
      import launchpadbugs.connector
      import launchpadbugs.basebuglistfilter
      import launchpadbugs.text_bug
      import launchpadbugs.lphelper
  except ImportError: # usually because python-libxml2 is missing
      launchpadbugs = None
      logging.warning("launchpadbugs did not import. Install python-libxml2.")
  
new_contents: # -*- coding: utf-8 -*-
  
  # This file is part of OpenHatch.
  # Copyright (C) 2011 Asheesh Laroia
  #
  # This program is free software: you can redistribute it and/or modify
  # it under the terms of the GNU Affero 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 Affero General Public License for more details.
  #
  # You should have received a copy of the GNU Affero General Public License
  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
  
  ### This file exists to wrap some dependencies for other parts of the code.
  ###
  ### In general, core parts of the OpenHatch site are forbidden from importing
  ### some hard-to-install modules, like lxml. Those files import from here
  ### instead so that if the import fails, the site doesn't crash.
  ###
  ### This is so that new contributors can run the OpenHatch site without
  ### installing these hard-to-install dependencies.
  
  # Used within this file
  import os
  import logging
  
  # Wrap lxml and the modules that are part of it
  class nothing(object):
          pass
  
  try:
      import lxml
      import lxml.etree
      import lxml.html
  except:
      lxml = nothing()
      lxml.etree = None
      lxml.html = None
  
  if lxml.html is None:
      logging.warning("Some parts of the OpenHatch site may fail because the lxml"
                      " library is not installed. Look in README.mkd for"
                      " information about lxml.")
  
  # Provide a helper to check if svnadmin is available. If not,
  # we can skip running code (and tests) that require it.
  
  def svnadmin_available():
      # FIXME: This should move to a variable controlled
      # by settings.py.
      SVNADMIN_PATH = '/usr/bin/svnadmin'
      return os.path.exists(SVNADMIN_PATH)
  
  ### Here we try to import "Image", from the Python Imaging Library.
  ### If we fail, Image is None.
  Image = None
  try:
      import Image
  except:
      try:
          from PIL import Image
      except ImportError:
          ### Okay, for a good time, let's hack sys.modules.
          ### This permits Django to think ImageFields might
          ### possibly work.
          import sys
          sys.modules['Image'] = sys.modules['sys']
  
  # Wrap launchpadbugs. We wrap it because it imports libxml2,
  # which qualifies as hard-to-install.
  
  try:
      import launchpadbugs
      import launchpadbugs.connector
      import launchpadbugs.basebuglistfilter
      import launchpadbugs.text_bug
      import launchpadbugs.lphelper
  except ImportError: # usually because python-libxml2 is missing
      launchpadbugs = nothing()
      launchpadbugs.connector = None
      launchpadbugs.basebuglistfilter = None
      launchpadbugs.text_bug = None
      launchpadbugs.lphelper = None
      logging.warning("launchpadbugs did not import. Install python-libxml2.")
  
subject: Create all the launchpadbugs.* objects