4
__version__ = (0, 3, 7)
7
def _get_git_revision(path):
8
revision_file = os.path.join(path, 'refs', 'heads', 'master')
9
if not os.path.exists(revision_file):
11
fh = open(revision_file, 'r')
20
:returns: Revision number of this branch/checkout, if available. None if
21
no revision number can be determined.
23
package_dir = os.path.dirname(__file__)
24
checkout_dir = os.path.normpath(os.path.join(package_dir, '..'))
25
path = os.path.join(checkout_dir, '.git')
26
if os.path.exists(path):
27
return _get_git_revision(path)
30
__build__ = get_revision()
33
def lazy_object(location):
34
def inner(*args, **kwargs):
35
parts = location.rsplit('.', 1)
36
warnings.warn('`djangoratings.%s` is deprecated. Please use `%s` instead.' % (
37
parts[1], location), DeprecationWarning)
39
imp = __import__(parts[0], globals(), locals(), [parts[1]], -1)
41
imp = __import__(parts[0], globals(), locals(), [parts[1]])
42
func = getattr(imp, parts[1])
44
return func(*args, **kwargs)
48
RatingField = lazy_object('djangoratings.fields.RatingField')
49
AnonymousRatingField = lazy_object('djangoratings.fields.AnonymousRatingField')
50
Rating = lazy_object('djangoratings.fields.Rating')