Commits

Stefan Scherfke  committed dfbd1c0

Raised version to 1.0 and did some code formatting.

  • Participants
  • Parent commits 6aaa0ba
  • Tags v1.0

Comments (0)

Files changed (6)

 Changelog for django-lastfm
 ===========================
 
+v1.0 – 2010-09-13:
+------------------
+
+- Raised to v1.0 since everything has worked fine for a long time.
+
+
+v0.1.3 – 2010-03-11:
+--------------------
+
+- [CHANGE] Repackaging
+
+
 v0.1.2 – 2010-01-12:
 --------------------
 

File docs/conf.py

 # built documents.
 #
 # The short X.Y version.
-version = '0.1'
+version = '1.0'
 # The full version, including alpha/beta/rc tags.
-release = '0.1'
+release = '1.0'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.

File lastfm/templatetags/lastfm_widget.py

         width: 54px;
         min-height: 39px;
     }
+
 """
 
 
 
 
 class LastfmWidgetNode(template.Node):
-    """This class will create a context object named ``var_name``. It will 
-    contain the ``title`` and the ``content`` of the widget."""
+    """
+    This class will create a context object named ``var_name``. It will contain 
+    the ``title`` and the ``content`` of the widget.
+    
+    """
     def __init__(self, var_name):
         self.var_name = var_name
         

File lastfm/tests.py

 # encoding: utf-8
+
 """
 Tests for the last.fm app.
+
 """
 
+
 from django.test import TestCase
 import mock
 
         self.token = mock.Mock(spec=['split_contents'])
         
     def test_get_sidebar_widgets(self):
-        """Test if ``lastfm_widget.get_lastfm_widget()`` returns a node with
-        the correct variable name."""
+        """
+        Test if ``lastfm_widget.get_lastfm_widget()`` returns a node with the
+        correct variable name.
+        
+        """
         tag = 'get_lastfm_widget'
         var_name = 'widgets'
         self.token.split_contents.return_value = (tag, 'as', var_name)
     @mock.patch('django.template.loader.get_template')
     @mock.patch('django.template.Context')
     def test_lastfm_widget_node(self, get_template, Context):
-        """Test if the template node contains the correct template variables."""
+        """
+        Test if the template node contains the correct template variables.
+        
+        """
         class ContextMock(dict):
             autoescape = object()
         context = ContextMock()

File lastfm/views.py

 In addition to the view itself this module also defines some helper classes that
 are responsible for handling the different types of charts (e.g. top tracks or
 top artists).
+
 """
 
 import urllib
 LASTFM_IMG_SIZE = getattr(settings, 'LASTFM_IMG_SIZE', 'large')
 
 
+# TODO: move caching to url-conf
 @cache_page(60 * 5)
 def lastfm_data(request):
-    """This view retrievs the data from Last.fm and returns a JSON encoded list.
+    """
+    This view retrievs the data from Last.fm and returns a JSON encoded list.
     The template tag’s AJAX code will retrive this list and generate the chart
     from it.
     
     an item has no ``image`` key (which is the case for e.g. the weekly top
     artist). It gets the desired image size (small, medium, large, …) and the
     item. It might do another API call and extract a custom image URL for that
-    item."""
+    item.
+    
+    """
     chart_types = {
         'recent_tracks': RecentTracks,
         'weekly_top_artists': WeeklyTopArtists,
                 'default_artist_large.png'
 
     def get_img_url(self, img_size, item):
-        """A chart item of this class does not contain any images, so we need to 
-        do another API call to get an image for artist in ``item``."""
+        """
+        A chart item of this class does not contain any images, so we need to do
+        another API call to get an image for artist in ``item``.
+        
+        """
         params = urllib.urlencode({
             'method': 'artist.getimages',
             'artist': item['name'],
     
     
 class TopArtists(object):
-    """This class handles the API call ``user.getTopArtists``. The period must 
-    be defined in the site’s settings module."""
+    """
+    This class handles the API call ``user.getTopArtists``. The period must be 
+    defined in the site’s settings module.
+    
+    """
     params = {
         'method': 'user.getTopArtists',
         'user': LASTFM_USER,
 from distutils.core import setup
 
 
+class UltraMagicString(object):
+    # Catch-22:
+    # - if I return Unicode, python setup.py --long-description as well
+    #   as python setup.py upload fail with a UnicodeEncodeError
+    # - if I return UTF-8 string, python setup.py sdist register
+    #   fails with an UnicodeDecodeError
+
+    def __init__(self, value):
+        self.value = value
+
+    def __str__(self):
+        return self.value
+
+    def __unicode__(self):
+        return self.value.decode('UTF-8')
+
+    def __add__(self, other):
+        return UltraMagicString(self.value + str(other))
+
+    def split(self, *args, **kw):
+        return self.value.split(*args, **kw)
+
+
 setup(
     name='django-lastfm',
-    version='0.1.3',
+    version='1.0',
     author='Stefan Scherfke',
     author_email='stefan at sofa-rockers.org',
     description='Access Last.fm from your Django site.',
-    long_description=open('README.txt').read(),
+    long_description=UltraMagicString(open('README.txt').read()),
     url='http://stefan.sofa-rockers.org/django-lastfm/',
     download_url='http://bitbucket.org/scherfke/django-lastfm/downloads/',
     license='BSD',
         'lastfm': ['templates/lastfm_widget/*'],
     },
     classifiers=[
-        'Development Status :: 4 - Beta',
+        'Development Status :: 5 - Production/Stable',
         'Environment :: Web Environment',
         'Framework :: Django',
         'Intended Audience :: Developers',