← Back to team overview

openlp-core team mailing list archive

[Bug 1410693] Re: Code duplication in check_latest_version

 

Changed to wishlist as this isnt really a bug

** Changed in: openlp
   Importance: Medium => Wishlist

-- 
You received this bug notification because you are a member of OpenLP
Core, which is subscribed to OpenLP.
https://bugs.launchpad.net/bugs/1410693

Title:
  Code duplication in check_latest_version

Status in OpenLP:
  Confirmed

Bug description:
  check_latest_version in core.utils.__init__.py duplicates code to
  download and retry on failure of the version check file. This code is
  similar to the code in get_webpage. We could reduce duplication by
  using get_webpage

  Duplicate code:

          retries = 0
          while True:
              try:
                  remote_version = str(urllib.request.urlopen(req, None,
                                                              timeout=CONNECTION_TIMEOUT).read().decode()).strip()
              except ConnectionException:
                  if retries > CONNECTION_RETRIES:
                      log.exception('Failed to download the latest OpenLP version file')
                  else:
                      retries += 1
                      time.sleep(0.1)
                      continue
              break

To manage notifications about this bug go to:
https://bugs.launchpad.net/openlp/+bug/1410693/+subscriptions


References