Commits

Josh VanderLinden committed 74b13de Merge

Updating the tag autocompletion CSS; minor adjustments to the way link title lookup happens

Comments (0)

Files changed (5)

+*.pyc
 * ``DISQUS_FORUM_SHORTNAME``: The name of your Disqus site.  This is what's
   used to link comments to your site.
 
+Less frequently changed settings:
+
+* ``ARTICLES_TEASER_LIMIT``: The number of words to display in the teaser.
+  Defaults to ``75``.
+* ``ARTICLES_AUTO_TAG``: Whether or not to automatically tag articles. Defaults
+  to ``True``.
+* ``ARTICLES_DEFAULT_DB``: Database in which to store articles. Defaults to
+  ``default``.
+* ``ARTICLES_LOOKUP_LINK_TITLE``: Whether to fetch the title of remote links or
+  use the local name of the link. Defaults to ``True``.
+
 Also, make sure that you have the following context processors in your
 ``TEMPLATE_CONTEXT_PROCESSORS`` tuple:
 

articles/forms.py

 
     class Media:
         css = {
-            'all': ('css/jquery.autocomplete.css',),
+            'all': ('/css/jquery.autocomplete.css',),
         }
         js = (
-            'js/jquery-1.4.1.min.js',
-            'js/jquery.bgiframe.min.js',
-            'js/jquery.autocomplete.pack.js',
-            'js/tag_autocomplete.js',
+            '/js/jquery-1.4.1.min.js',
+            '/js/jquery.bgiframe.min.js',
+            '/js/jquery.autocomplete.pack.js',
+            '/js/tag_autocomplete.js',
         )
 

articles/models.py

 WORD_LIMIT = getattr(settings, 'ARTICLES_TEASER_LIMIT', 75)
 AUTO_TAG = getattr(settings, 'ARTICLES_AUTO_TAG', True)
 DEFAULT_DB = getattr(settings, 'ARTICLES_DEFAULT_DB', 'default')
+LOOKUP_LINK_TITLE = getattr(settings, 'ARTICLES_LOOKUP_LINK_TITLE', True)
 
 MARKUP_HTML = 'h'
 MARKUP_MARKDOWN = 'm'
 
             # look in the cache for the link target's title
             if not cache.get(key):
-                try:
-                    # open the URL
-                    c = urllib.urlopen(url)
-                    html = c.read()
-                    c.close()
+                title = link.group(2)
 
-                    # try to determine the title of the target
-                    title = TITLE_RE.search(html)
-                    if title: title = title.group(1)
-                    else: title = link.group(2)
-                except:
-                    # if anything goes wrong (ie IOError), use the link's text
-                    title = link.group(2)
+                if LOOKUP_LINK_TITLE:
+                    try:
+                        # open the URL
+                        c = urllib.urlopen(url)
+                        html = c.read()
+                        c.close()
+
+                        # try to determine the title of the target
+                        title = TITLE_RE.search(html)
+                        if title: title = title.group(1)
+                    except:
+                        # if anything goes wrong (ie IOError), use the link's text
+                        pass
 
                 # cache the page title for a week
                 cache.set(key, title, 604800)

articles/static/css/jquery.autocomplete.css

 	padding: 2px 5px;
 	cursor: default;
 	display: block;
-	/* 
-	if width will be 100% horizontal scrollbar will apear 
+	/*
+	if width will be 100% horizontal scrollbar will apear
 	when scroll mode will be used
 	*/
 	/*width: 100%;*/
 	font: menu;
 	font-size: 12px;
-	/* 
-	it is very important, if line-height not setted or setted 
+	/*
+	it is very important, if line-height not setted or setted
 	in relative units scroll will be broken in firefox
 	*/
 	line-height: 16px;
 }
 
 .ac_loading {
-	background: white url('indicator.gif') right center no-repeat;
+	background: white url('../img/indicator.gif') right center no-repeat;
 }
 
 .ac_odd {
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.