Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Les fixtures automatiques sont cassés sur les forums #2774

Closed
firm1 opened this issue Jun 1, 2015 · 9 comments
Closed

Les fixtures automatiques sont cassés sur les forums #2774

firm1 opened this issue Jun 1, 2015 · 9 comments
Assignees
Labels
C-Back Concerne le back-end Django S-BUG Corrige un problème
Milestone

Comments

@firm1
Copy link
Contributor

firm1 commented Jun 1, 2015

Scénario :

  • Je pars d'une install propre
  • Je lance la commande : python manage.py load_fixtures size=low racine=user
  • Je me connecte avec admin/admin
  • Je clique sur un topic généré qui n'a aucune réponse

=> Erreur 500

Stacktrace :

AttributeError at /forums/sujet/58/corrupti-laudantium-omnis-nihil-harum-necessitatibus-repudiandae/

'NoneType' object has no attribute 'pk'

Request Method:     GET
Request URL:    http://example.com/forums/sujet/58/corrupti-laudantium-omnis-nihil-harum-necessitatibus-repudiandae/
Django Version:     1.7.7
Exception Type:     AttributeError
Exception Value:    

'NoneType' object has no attribute 'pk'

Exception Location:     /home/ubuntu/workspace/zds/forum/views.py in get_context_data, line 124
Python Executable:  /home/ubuntu/workspace/devenv/bin/python
Python Version:     2.7.6
@firm1 firm1 added S-BUG Corrige un problème C-Back Concerne le back-end Django labels Jun 1, 2015
@Eskimon
Copy link
Contributor

Eskimon commented Jun 1, 2015

Tu aurais pas un peu plus etendu comme stackrtrace ? Histoire de voir sur quelle ligne ca se gaufre

@firm1
Copy link
Contributor Author

firm1 commented Jun 1, 2015

Environment:


Request Method: GET
Request URL: http://example.com/forums/sujet/58/corrupti-laudantium-omnis-nihil-harum-necessitatibus-repudiandae/

Django Version: 1.7.7
Python Version: 2.7.6
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.sitemaps',
 'django.contrib.humanize',
 'easy_thumbnails',
 'easy_thumbnails.optimize',
 'crispy_forms',
 'haystack',
 'munin',
 'social.apps.django_app.default',
 'rest_framework',
 'rest_framework_swagger',
 'corsheaders',
 'oauth2_provider',
 'zds.utils',
 'zds.pages',
 'zds.gallery',
 'zds.mp',
 'zds.article',
 'zds.forum',
 'zds.tutorial',
 'zds.member',
 'zds.featured',
 'django.contrib.admin',
 'debug_toolbar')
Installed Middleware:
(u'debug_toolbar.middleware.DebugToolbarMiddleware',
 'corsheaders.middleware.CorsMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'zds.utils.ThreadLocals',
 'zds.middlewares.SetLastVisitMiddleware.SetLastVisitMiddleware',
 'zds.middlewares.profile.ProfileMiddleware')


Traceback:
File "/home/ubuntu/workspace/devenv/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  111.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/ubuntu/workspace/devenv/local/lib/python2.7/site-packages/django/views/generic/base.py" in view
  69.             return self.dispatch(request, *args, **kwargs)
File "/home/ubuntu/workspace/devenv/local/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
  87.         return handler(request, *args, **kwargs)
File "/home/ubuntu/workspace/zds/forum/views.py" in get
  115.         return super(TopicPostsListView, self).get(request, *args, **kwargs)
File "/home/ubuntu/workspace/devenv/local/lib/python2.7/site-packages/django/views/generic/list.py" in get
  160.         context = self.get_context_data()
File "/home/ubuntu/workspace/zds/forum/views.py" in get_context_data
  124.             'last_post_pk': self.object.last_message.pk,

Exception Type: AttributeError at /forums/sujet/58/corrupti-laudantium-omnis-nihil-harum-necessitatibus-repudiandae/
Exception Value: 'NoneType' object has no attribute 'pk'

@Eskimon
Copy link
Contributor

Eskimon commented Jun 1, 2015

Merfi :)

@Eskimon
Copy link
Contributor

Eskimon commented Jun 1, 2015

Je pense que ca tombe pile dans mes corrections ici : https://github.com/zestedesavoir/zds-site/pull/2712/files#diff-d9e47ece3e055339353c712faa8ad7edR290

Si tu merges ma branche de landscape tu devrais voir que ca corrige le souci non ?

@Eskimon
Copy link
Contributor

Eskimon commented Jun 3, 2015

Maintenant que ma PR est mergée tu pourrais refaire le meme test (et me dire que tout va bien :D ) ?

@firm1
Copy link
Contributor Author

firm1 commented Jun 3, 2015

Toujours cassay

@Eskimon
Copy link
Contributor

Eskimon commented Jun 3, 2015

En meme temps, quand j'interroge ma bdd a la main je vois que les topics vides ne possede meme pas 1 message... du coup plutot normal que ca merde

Du coup ce sont les fixtures qui sont pas au point, en effet, la creation d'un topic ne cree pas le premier post qui va avec (https://github.com/zestedesavoir/zds-site/blob/dev/zds/utils/management/commands/load_fixtures.py#L195)

@GerardPaligot
Copy link
Member

De toutes façon, les fixtures de manière générales sont cassées. Je sais plus si c'est les articles ou les tutoriels mais tu te manges des erreurs quand tu essayes d'y accéder.

@pierre-24
Copy link
Member

Fixé, merci @Eskimon :)

@pierre-24 pierre-24 added this to the Version de développement milestone Jun 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Back Concerne le back-end Django S-BUG Corrige un problème
Projects
None yet
Development

No branches or pull requests

4 participants