You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

__init__.py 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import os
  2. # Use 'final' as the 4th element to indicate
  3. # a full release
  4. VERSION = (0, 4, 0, 'alpha', 0)
  5. def get_short_version():
  6. return '%s.%s' % (VERSION[0], VERSION[1])
  7. def get_version():
  8. version = '%s.%s' % (VERSION[0], VERSION[1])
  9. if VERSION[2]:
  10. # Append 3rd digit if > 0
  11. version = '%s.%s' % (version, VERSION[2])
  12. if VERSION[3:] == ('alpha', 0):
  13. version = '%s pre-alpha' % version
  14. elif VERSION[3] != 'final':
  15. version = '%s %s %s' % (version, VERSION[3], VERSION[4])
  16. return version
  17. # Cheeky setting that allows each template to be accessible by two paths.
  18. # Eg: the template 'oscar/templates/oscar/base.html' can be accessed via both
  19. # 'base.html' and 'oscar/base.html'. This allows Oscar's templates to be
  20. # extended by templates with the same filename
  21. OSCAR_MAIN_TEMPLATE_DIR = os.path.join(
  22. os.path.dirname(os.path.abspath(__file__)), 'templates/oscar')
  23. OSCAR_CORE_APPS = [
  24. 'oscar',
  25. 'oscar.apps.analytics',
  26. 'oscar.apps.order',
  27. 'oscar.apps.checkout',
  28. 'oscar.apps.shipping',
  29. 'oscar.apps.catalogue',
  30. 'oscar.apps.catalogue.reviews',
  31. 'oscar.apps.basket',
  32. 'oscar.apps.payment',
  33. 'oscar.apps.offer',
  34. 'oscar.apps.address',
  35. 'oscar.apps.partner',
  36. 'oscar.apps.customer',
  37. 'oscar.apps.promotions',
  38. 'oscar.apps.search',
  39. 'oscar.apps.voucher',
  40. 'oscar.apps.dashboard',
  41. 'oscar.apps.dashboard.reports',
  42. 'oscar.apps.dashboard.users',
  43. 'oscar.apps.dashboard.orders',
  44. 'oscar.apps.dashboard.promotions',
  45. 'oscar.apps.dashboard.catalogue',
  46. 'oscar.apps.dashboard.offers',
  47. 'oscar.apps.dashboard.ranges',
  48. 'oscar.apps.dashboard.vouchers',
  49. 'oscar.apps.dashboard.communications',
  50. # 3rd-party apps that oscar depends on
  51. 'haystack',
  52. 'treebeard',
  53. 'sorl.thumbnail',
  54. ]
  55. def get_core_apps(overrides=None):
  56. """
  57. Return a list of oscar's apps amended with any passed overrides
  58. """
  59. if not overrides:
  60. return OSCAR_CORE_APPS
  61. def get_app_label(app_label, overrides):
  62. pattern = app_label.replace('oscar.apps.', '')
  63. for override in overrides:
  64. if override.endswith(pattern):
  65. if 'dashboard' in override and 'dashboard' not in pattern:
  66. continue
  67. return override
  68. return app_label
  69. apps = []
  70. for app_label in OSCAR_CORE_APPS:
  71. apps.append(get_app_label(app_label, overrides))
  72. return apps