Commits

catapela  committed 2bf84fc

Function for testing the installation added (dynamicLink.CKINST).

  • Participants
  • Parent commits 227a50d

Comments (0)

Files changed (5)

     *Installation with pip (recommended)*
 
         *Pip will download and install the package and take care of all the dependences.
-        If you havn't pip on your system then install setuptools first after that run "easy_install pip".*
+        If you havn't pip on your system then install setuptools first after that run "easy_install pip".
+        After that you can use pip in your terminal window.*
 
-        * Use the stable release (recommended)
-
-            Type in your terminal::
+        * Use the stable release (recommended)::
 
                 pip install django-dynamic-link
 
-        * Or the development version
-
-            Than type in your terminal::
+        * Or the development version::
 
                 pip install -e hg+https://bitbucket.org/catapela/django-dynamic-link/#egg=django-dynamic-link
 
         * Or use setup.py
 
             1. Unpack your package.
-            2. Open a terminal and change to the folder which contains the setup.py and type:
+            2. Open a terminal and change to the folder which contains the setup.py and type
 
             ::
 
     ... then type::
     
         >>> import dynamicLink
+        >>> dynamicLink.CKINST()
         >>> dynamicLink.VERSION
         >>> help(dynamicLink)
         >>> exit()
     
     * Add "dynamicLink" to you installed apps in the settings file.
     * Make sure that:
+
         1.   'django.middleware.locale.LocaleMiddleware', is in your MIDDLEWARE_CLASSES.
         2.   Your Admin is enabled ('django.contrib.admin', is in your INSTALLED_APPS).
         3.   'django.contrib.auth.context_processors.auth', (also for admin) is in TEMPLATE_CONTEXT_PROCESSORS.
         4.   'django.core.context_processors.request', is in TEMPLATE_CONTEXT_PROCESSORS.
+
     * Add the following to your urls.py:
+
         1.   from dynamicLink import presettings
         2.   (r'^\w+/%s/' % presettings.DYNAMIC_LINK_URL_BASE_COMPONENT, include('dynamicLink.urls')),
-    * Finally run:
-
-    ::
+        
+    * Finally run::
     
         python manage.py syncdb
         python manage.py runserver
 
     Use the global settings.py in your projects root to overwrite the applications presettings with the following variables.
 
-    * DYNAMIC_LINK_MEDIA
+    DYNAMIC_LINK_MEDIA
+
         - Default: settings.MEDIA_ROOT
         - A path to a directory. From this point you can walk down the subdirectories to choose your files to serve.
-    * DYNAMIC_LINK_URL_BASE_COMPONENT
+
+    DYNAMIC_LINK_URL_BASE_COMPONENT
+    
         - Default: 'serve'
         - A string that modifies your url serve path.
         - Example: www.example.com/DYNAMIC_LINK_URL_BASE_COMPONENT/link/3839hd8HKl3/example.zip.
     1. First you need the example project folder which is shipped within the package. See the "other Installation methodes" section above to find out where to download it.
     2. After you got the desired package install it (see install section).
     3. Next you have to extract the example folder within the package to any location you want.
-    4. Open a terminal and change directory into the previous extracted example folder:
-    
+    4. Open a terminal and change directory into the previous extracted example folder
+
     ::
 
         cd /path/to/example
 
-    5. After that run:
-    
+    5. After that run
+
     ::
 
         python manage.py syncdb

File dynamicLink/__init__.py

 import version
 import os
+import django
+import sys
 
 __version__ = VERSION = version.VERSION
 
     __docformat__ = 'reStructuredText'
 except IOError:
     __doc__ = 'For full documentation review the README file in your package or go to: http://pypi.python.org/pypi/django-dynamic-link/'
-    __docformat__ = 'txt'
+    __docformat__ = 'txt'
+
+def CKINST():
+    print('I try to find errors for you!')
+    djv = django.VERSION
+    greatest_dlv = version.RELEASE_DJANGO[0]
+    smalest_dlv = version.RELEASE_DJANGO[0]
+
+    # find greatest and smallest possible django version for dynamic link
+    for dlv in version.RELEASE_DJANGO:
+        if greatest_dlv < dlv:
+            greatest_dlv = dlv
+        if smalest_dlv > dlv:
+            smalest_dlv = dlv
+
+    # check dynaic link dependences
+    if djv < smalest_dlv:
+        print('Django %s is not supported. Please install a more recent django version.' % dlv)
+    elif djv > greatest_dlv:
+        print('This Version on dynamicLink (try: dynamicLink.VERSION) needs an older Django release (try: dynamicLink.RELEASE_DJANGO).')
+    elif sys.version_info < version.PYTHON:
+        print('dynamicLink depends on python %s or higher.' % version.PYTHON)
+    else:
+        print("No errors. All seems fine!")
+

File dynamicLink/version.py

 # -*- coding:utf-8 -*-
 # This Python file uses the following encoding: utf-8
 
-VERSION = (0,5,4,1)
+import django
+import sys
+
+VERSION = (0,5,4,2)
+RELEASE_DJANGO = ((1,2),(1,3))
+PYTHON = (2,4)
 APPLICATION_NAME = "Dynamic Link"
 VERSION_str = str(VERSION).strip('()').replace(',','.').replace(' ','')
 VERSION_INFO = """
 
 TODO:
     - write more unittests
-""" % (VERSION_str,)
+""" % (VERSION_str,)
 <p><em>Installation with pip (recommended)</em></p>
 <blockquote>
 <p><em>Pip will download and install the package and take care of all the dependences.
-If you havn't pip on your system than install setuptools first than run &quot;easy_install pip&quot;.</em></p>
+If you havn't pip on your system then install setuptools first after that run &quot;easy_install pip&quot;.</em></p>
 <ul>
-<li><p class="first">Use the stable release (recommended)</p>
-<blockquote>
-<p>Type in your terminal:</p>
+<li><p class="first">Use the stable release (recommended). For that type in your terminal:</p>
 <pre class="literal-block">
 pip install django-dynamic-link
 </pre>
-</blockquote>
 </li>
-<li><p class="first">Or the development version</p>
-<blockquote>
-<p>Than type in your terminal:</p>
+<li><p class="first">Or the development version:</p>
 <pre class="literal-block">
 pip install -e hg+https://bitbucket.org/catapela/django-dynamic-link/#egg=django-dynamic-link
 </pre>
-</blockquote>
 </li>
 <li><p class="first">With pip you can also uninstall:</p>
 <pre class="literal-block">
 </li>
 </ul>
 </blockquote>
-<p><em>Oter Installation methodes</em></p>
+<p><em>other Installation methodes</em></p>
 <blockquote>
 First of all download the package from pypi (stable) or bitbucket (development). Find a download location <a class="reference external" href="http://pypi.python.org/pypi/django-dynamic-link/#downloads">here</a>.</blockquote>
 </blockquote>
 <blockquote>
 <ol class="arabic simple">
 <li>Unpack your package.</li>
-<li>Open a terminal and change to the folder which contains the setup.py and type:</li>
+<li>Open a terminal and change to the folder which contains the setup.py and type</li>
 </ol>
 <pre class="literal-block">
 python setup.py install
 <pre class="literal-block">
 &gt;&gt;&gt; import dynamicLink
 &gt;&gt;&gt; dynamicLink.VERSION
+&gt;&gt;&gt; help(dynamicLink)
 &gt;&gt;&gt; exit()
 </pre>
 </blockquote>
 <ul>
 <li><p class="first">Add &quot;dynamicLink&quot; to you installed apps in the settings file.</p>
 </li>
-<li><dl class="first docutils">
-<dt>Make sure that:</dt>
-<dd><ol class="first last arabic simple">
+<li><p class="first">Make sure that:</p>
+<blockquote>
+<ol class="arabic simple">
 <li>'django.middleware.locale.LocaleMiddleware', is in your MIDDLEWARE_CLASSES.</li>
 <li>Your Admin is enabled ('django.contrib.admin', is in your INSTALLED_APPS).</li>
 <li>'django.contrib.auth.context_processors.auth', (also for admin) is in TEMPLATE_CONTEXT_PROCESSORS.</li>
 <li>'django.core.context_processors.request', is in TEMPLATE_CONTEXT_PROCESSORS.</li>
 </ol>
-</dd>
-</dl>
+</blockquote>
 </li>
-<li><dl class="first docutils">
-<dt>Add the following to your urls.py:</dt>
-<dd><ol class="first last arabic simple">
+<li><p class="first">Add the following to your urls.py:</p>
+<blockquote>
+<ol class="arabic simple">
 <li>from dynamicLink import presettings</li>
 <li>(r'^w+/%s/' % presettings.DYNAMIC_LINK_URL_BASE_COMPONENT, include('dynamicLink.urls')),</li>
 </ol>
-</dd>
-</dl>
+</blockquote>
 </li>
 <li><p class="first">Finally run:</p>
-</li>
-</ul>
 <pre class="literal-block">
 python manage.py syncdb
 python manage.py runserver
 </pre>
+</li>
+</ul>
 </blockquote>
 <p><strong>Make it custom</strong></p>
 <blockquote>
 <p>Use the global settings.py in your projects root to overwrite the applications presettings with the following variables.</p>
-<ul>
-<li><dl class="first docutils">
-<dt>DYNAMIC_LINK_MEDIA</dt>
-<dd><ul class="first last simple">
+<p>DYNAMIC_LINK_MEDIA</p>
+<blockquote>
+<ul class="simple">
 <li>Default: settings.MEDIA_ROOT</li>
 <li>A path to a directory. From this point you can walk down the subdirectories to choose your files to serve.</li>
 </ul>
-</dd>
-</dl>
-</li>
-<li><dl class="first docutils">
-<dt>DYNAMIC_LINK_URL_BASE_COMPONENT</dt>
-<dd><ul class="first last simple">
+</blockquote>
+<p>DYNAMIC_LINK_URL_BASE_COMPONENT</p>
+<blockquote>
+<ul class="simple">
 <li>Default: 'serve'</li>
 <li>A string that modifies your url serve path.</li>
 <li>Example: www.example.com/DYNAMIC_LINK_URL_BASE_COMPONENT/link/3839hd8HKl3/example.zip.</li>
 </ul>
-</dd>
-</dl>
-</li>
-</ul>
+</blockquote>
 </blockquote>
 </div>
 <div class="section" id="usage">
 <p>djang-dynamic-links ships with an example proect.</p>
 <blockquote>
 <ol class="arabic simple">
-<li>First you need the example project folder which is shipped within the package. See the &quot;oter Installation methodes&quot; section above to find out where to download it.</li>
+<li>First you need the example project folder which is shipped within the package. See the &quot;other Installation methodes&quot; section above to find out where to download it.</li>
 <li>After you got the desired package install it (see install section).</li>
 <li>Next you have to extract the example folder within the package to any location you want.</li>
-<li>Open a terminal and change directory into the previous extracted example folder:</li>
+<li>Open a terminal and change directory into the previous extracted example folder</li>
 </ol>
 <pre class="literal-block">
 cd /path/to/example
 </pre>
 <ol class="arabic simple" start="5">
-<li>After that run:</li>
+<li>After that run</li>
 </ol>
 <pre class="literal-block">
 python manage.py syncdb
 from setuptools import setup, find_packages
 from dynamicLink import version
 import os
-import sys
+#import sys
 import shutil
 
 
     # set requierment only if django not avallible.
     REQUIRES.append('django')
 
-if sys.version_info < (2, 4):
-    REQUIRES.append('python >= 2.4')
+#if sys.version_info < (2, 4):
+#    REQUIRES.append('python >= 2.4')
 
 
 setup(name='django-dynamic-link',
               'Framework :: Django',
               'License :: OSI Approved :: BSD License',
               'Operating System :: OS Independent',
-              'Programming Language :: Python',
+              'Programming Language :: Python :: 2.4',
               'Environment :: Console',
               'Natural Language :: English',
               'Natural Language :: German',
               'Intended Audience :: Developers',
-              'Intended Audience :: Information Technology',
               'Topic :: Internet',
-              'Topic :: Utilities',
               ],
         install_requires = REQUIRES,
         zip_safe=False,