Permalink
Browse files

cil-ec1c1539: Now creates the correct URLs where necessary

  • Loading branch information...
1 parent fdcfad7 commit fe240eab747adb6b68511e7d2eb7cf18992d48e7 @chilts chilts committed Feb 25, 2010
Showing with 15 additions and 13 deletions.
  1. +3 −2 issues/i_ec1c1539.cil
  2. +3 −3 lollysite.py
  3. +1 −2 queue.py
  4. +8 −6 util.py
View
@@ -1,9 +1,10 @@
Summary: Fix queue.py for www.%s (Naked Domain)
-Status: New
+Status: Finished
CreatedBy: Andrew Chilton <andychilton@gmail.com>
AssignedTo: Andrew Chilton <andychilton@gmail.com>
+Label: Milestone-v0.05
Inserted: 2010-02-15T10:54:09
-Updated: 2010-02-15T10:54:09
+Updated: 2010-02-25T08:53:52
Need to use the create URL function (and if there isn't one, create one) which
checks the 'Sub Domain' and creates the proper URL depending on whether that is
View
@@ -256,9 +256,9 @@ def post(self):
# send a mail to the admin
admin_email = util.config_value('Admin Email')
if mail.is_email_valid(admin_email):
- url_post = 'http://www.' + util.config_value('Naked Domain') + node.section.path + node.name + '.html'
- url_mod = 'http://www.' + util.config_value('Naked Domain') + '/admin/comment/?key=' + str(comment.key()) + ';status='
- url_del = 'http://www.' + util.config_value('Naked Domain') + '/admin/comment/del.html?key='+ str(comment.key())
+ url_post = util.construct_url() + node.section.path + node.name + '.html'
+ url_mod = util.construct_url() + '/admin/comment/?key=' + str(comment.key()) + ';status='
+ url_del = util.construct_url() + '/admin/comment/del.html?key='+ str(comment.key())
body = 'From: ' + name + ' <' + email + '>\n'
body = body + 'Site: ' + website + '\n\n'
View
@@ -142,8 +142,7 @@ def post(self):
if not mail.is_email_valid(admin_email):
return
- # url_edit = 'http://www.' + util.config_value('Naked Domain') + '/admin/node/'
- url_edit = 'http://www.%s/admin/node/' % util.config_value('Naked Domain')
+ url_edit = util.construct_url() + '/admin/node/'
body = 'Section %s has two nodes named %s ' % (section.path, name)
mail.send_mail(admin_email, admin_email, 'Duplicate node name in section ' + section.path, body)
View
14 util.py
@@ -144,14 +144,16 @@ def construct_redirect(path):
if path is None or path == '':
path = '/'
- redirect = 'http://'
- if config_value('Sub Domain') is not None:
- redirect = redirect + config_value('Sub Domain') + '.'
- redirect = redirect + config_value('Naked Domain')
- redirect = redirect + urllib.quote(path)
- logging.info('Redirect = ' + redirect);
+ redirect = construct_redirect() + urllib.quote(path)
return redirect
+def construct_url():
+ url = 'http://'
+ if config_value('Sub Domain') is not None:
+ url = url + config_value('Sub Domain') + '.'
+ url = url + config_value('Naked Domain')
+ return url
+
def str_to_datetime(str):
""" takes strings of the form yyyy-mm-dd hh:mm:ss and returns a datetime """
a = [ int(x) for x in re.split(r'[ \-:]', str) ]

0 comments on commit fe240ea

Please sign in to comment.