def UpdatePackageInfo(self, pkginfo):
    """Updates an existing PackageInfo entity."""
    unattended_install = self.request.get('unattended_install', None)
    if unattended_install is not None:
      unattended_install = unattended_install == 'on'

    unattended_uninstall = self.request.get('unattended_uninstall', None)
    if unattended_uninstall is not None:
      unattended_uninstall = unattended_uninstall == 'on'

    # Parse any force_install_after_date str into a datetime object.
    force_install_after_date_str = self.request.get(
        'force_install_after_date', None)
    force_install_after_date_time_str = self.request.get(
        'force_install_after_date_time', None)
    if force_install_after_date_str or force_install_after_date_time_str:
      date_string = '%s %s' % (
          force_install_after_date_str, force_install_after_date_time_str)
      try:
        force_install_after_date = datetime.datetime.strptime(
            date_string, '%Y-%m-%d %H:%M')
      except __HOLE__:
        self.error(400)
        self.Render(
            'error.html',
            {'message': 'invalid force_install date and/or time format'})
    else:
      # This will remove force_install_after_date from the plist, as it was
      # unset in the UI.
      force_install_after_date = ''

    kwargs = {
        'unattended_install': unattended_install,
        'unattended_uninstall': unattended_uninstall,
        # get_all() returns an empty array if set, and has no default value opt.
        'catalogs': self.request.get_all('catalogs'),
        'manifests': self.request.get_all('manifests'),
        'install_types': self.request.get_all('install_types'),
        'manifest_mod_access': self.request.get_all('manifest_mod_access'),
        # get() returns an empty string if not set, so default to None.
        'name': self.request.get('name', None),
        'description': self.request.get('description', None),
        'display_name': self.request.get('display_name', None),
        'version': self.request.get('version', None),
        'minimum_os_version': self.request.get('minimum_os_version', None),
        'maximum_os_version': self.request.get('maximum_os_version', None),
        'force_install_after_date': force_install_after_date,
        'category': self.request.get('category', None),
        'developer': self.request.get('developer', None),
    }
    try:
      pkginfo.Update(**kwargs)
      if settings.EMAIL_ON_EVERY_CHANGE:
        self.NotifyAdminsOfPackageChange(pkginfo, **kwargs)
    except models.PackageInfoLockError:
      self.error(302)
      self.Render(
          'error.html',
          {'message': 'PackageInfo was locked; refresh and try again'})
    except models.PackageInfoUpdateError as e:
      self.error(403)
      self.Render(
          'error.html', {'message': 'PackageInfoUpdateError: %s' % str(e)})
    else:
      filename = pkginfo.filename
      self.redirect(
          '/admin/packages?msg=%s saved.&activepkg=%s#package-%s' % (
              filename, filename, filename))
dataset/ETHPy150Open google/simian/src/simian/mac/admin/package.py/Package.UpdatePackageInfo