Skip to content

Commit

Permalink
Adds https url in settings and uses it when import images in content
Browse files Browse the repository at this point in the history
  • Loading branch information
ChantyTaguan authored and GerardPaligot committed Aug 12, 2016
1 parent c5a5f12 commit 5e5bd2a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
6 changes: 6 additions & 0 deletions update.md
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,11 @@ Tags
1. Lancer la commande `python manage.py clean_tags >> mep_v20.log`
1. Jeter un oeil aux logs pour s'assurer que tout s'est bien passé.

Issue 3620
----------

Dans le `settings_prod.py` : ajouter `ZDS_APP['site']['secure_url'] = 'https://zestedesavoir.com'`

---

**Notes auxquelles penser lors de l'édition de ce fichier (à laisser en bas) :**
Expand All @@ -651,3 +656,4 @@ Le déploiement doit être autonome. Ce qui implique que :
1. La mise à jour de dépendances est automatique et systématique,
2. La personne qui déploie ne doit pas réfléchir (parce que c'est source d'erreur),
3. La personne qui déploie ne doit pas avoir connaissance de ce qui est déployé (techniquement et fonctionnellement).

1 change: 1 addition & 0 deletions zds/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@
'slogan': u"Zeste de Savoir, la connaissance pour tous et sans pépins",
'abbr': u"zds",
'url': u"http://127.0.0.1:8000",
'secure_url': u"https://127.0.0.1:8000",
'dns': u"zestedesavoir.com",
'email_contact': u"zestedesavoir@gmail.com",
'email_noreply': u"noreply@zestedesavoir.com",
Expand Down
6 changes: 6 additions & 0 deletions zds/settings_test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@
'LOCATION': '/tmp/django_cache',
}
}

ZDS_APP = {
'site': {
'secure_url': u"http://127.0.0.1:8000"
}
}
4 changes: 2 additions & 2 deletions zds/tutorialv2/tests/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1696,7 +1696,7 @@ def test_import_image_with_archive(self):
# check links:
text = versioned.children[0].get_text()
for img in Image.objects.filter(gallery=new_article.gallery).all():
self.assertTrue('![]({})'.format(settings.ZDS_APP['site']['url'] + img.physical.url) in text)
self.assertTrue('![]({})'.format(settings.ZDS_APP['site']['secure_url'] + img.physical.url) in text)

# import into first article (that will only change the images)
result = self.client.post(
Expand All @@ -1723,7 +1723,7 @@ def test_import_image_with_archive(self):
# check links:
text = versioned.children[0].get_text()
for img in Image.objects.filter(gallery=new_version.gallery).all():
self.assertTrue('![]({})'.format(settings.ZDS_APP['site']['url'] + img.physical.url) in text)
self.assertTrue('![]({})'.format(settings.ZDS_APP['site']['secure_url'] + img.physical.url) in text)

# clean up
os.remove(draft_zip_path)
Expand Down
2 changes: 1 addition & 1 deletion zds/tutorialv2/views/views_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ def use_images_from_archive(request, zip_file, versioned_content, gallery):
pic.pubdate = datetime.now()
pic.save()

translation_dic[image_path] = settings.ZDS_APP['site']['url'] + pic.physical.url
translation_dic[image_path] = settings.ZDS_APP['site']['secure_url'] + pic.physical.url

# finally, remove image
if os.path.exists(temp_image_path):
Expand Down

0 comments on commit 5e5bd2a

Please sign in to comment.