-
Notifications
You must be signed in to change notification settings - Fork 4
Recherche babac #36
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
Open
normcyr
wants to merge
17
commits into
simark:master
Choose a base branch
from
normcyr:recherche_babac
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Recherche babac #36
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
bc0dcb8
ajout fonction recherche prix sur site Babac
normcyr 2220eec
gestion des caractères illégaux dans la recherche
normcyr 86edda1
ajuster ordre des commandes pour configuration Babac
normcyr e4077dd
utiliser le module PyPi recherche_babac2 pour obtenir les prix du fou…
normcyr 7730d79
spécifier version de recherche_babac2 à utiliser
normcyr ae2a121
get rid of the default secret_key
normcyr d072c43
gestion des résultats vides pour recherche babac2
normcyr 5bb3602
utiliser version 0.1.0 de recherche_babac2
normcyr 20a389d
gestion des résultats vides
normcyr 24fabac
gestion d'absence de résultats
normcyr 4d3434f
ajout lien vers produit sur site de Babac
normcyr 7da7883
gérer les erreurs de caractères spéciaux et réponses vides
normcyr 79cc663
wrap texte trop long
normcyr 6164547
Merge branch 'recherche_babac' of github.com:normcyr/biciklo into rec…
normcyr 78ad34a
nouvelle version pour recherche_babac2
normcyr d461955
Nettoyage du code
normcyr 92d8ac1
Ajout de la fonction de recherche sur Cycle Babac
normcyr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,3 +29,8 @@ pip-log.txt | |
| # sass | ||
| static/css | ||
| sass/.sass-cache | ||
|
|
||
| # virtualenv | ||
| biciklo-env/ | ||
|
|
||
| config.yml | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #!/usr/bin/env python3 | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| from pathlib import Path | ||
| import yaml | ||
|
|
||
|
|
||
| def lire_config(): | ||
|
|
||
| fichier_config = Path.home() / '.config' / 'biciklo' / 'config.yml' | ||
|
|
||
| if fichier_config.is_file(): | ||
|
|
||
| with fichier_config.open(mode='r') as fichier: | ||
| info_config = yaml.safe_load(fichier) | ||
|
|
||
| utilisateur_babac = info_config['Cycle Babac']['nom utilisateur'] | ||
| motdepasse_babac = info_config['Cycle Babac']['mot de passe'] | ||
|
|
||
|
|
||
| else: | ||
| with fichier_config.open(mode='w') as fichier: | ||
| yaml.dump({'Cycle Babac': {'nom utilisateur': 'BoblEponge', 'mot de passe': 'BasdeBikini'}}, fichier) | ||
|
|
||
| utilisateur_babac = None | ||
| motdepasse_babac = None | ||
|
|
||
| return utilisateur_babac, motdepasse_babac |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| {% extends "layout.html" %} | ||
|
|
||
| {% block head_extra %} | ||
| <style> | ||
| p.error_message { | ||
| color: red; | ||
| font-weight: bold; | ||
| } | ||
| </style> | ||
| {% endblock %} | ||
|
|
||
| {% block content %} | ||
| <h1>Recherche Babac</h1> | ||
|
|
||
| <form action="" method="post"> | ||
| {{ form.csrf }} | ||
| <div class="input text"> | ||
| {{ form.search_text.label }} {{ form.search_text }}</div> | ||
| <div class="input submit"> | ||
| <input type="submit" value="Submit"></div> | ||
| </form> | ||
|
|
||
| {% with messages = get_flashed_messages() %} | ||
| {% if messages %} | ||
| {% for message in messages %} | ||
| <p class="error_message">{{ message }}</p> | ||
| {% endfor %} | ||
| {% endif %} | ||
| {% endwith %} | ||
|
|
||
| <div> | ||
| {% if search_text %} | ||
| {% if list_products|length >= 1 %} | ||
| <p>{{ list_products|length }} résultats trouvés pour <strong>{{ search_text }}</strong> sur Cycle Babac.</p> | ||
| <p>Vous pouvez cliquer sur le numéro de produit pour accéder à la page du produit sur le site de Cycle Babac.</p> | ||
| <table id="resultats" class="dataTable" style="display: table;"> | ||
| <thead> | ||
| <tr> | ||
| <th data-column="numerobabac" class="sorting" role="columnheader" tabindex="0" aria-controls="pieces" rowspan="1" colspan="1" style="width: 0px;" aria-label="# babac: activate to sort column ascending"># Babac</th> | ||
| <th data-column="nom" class="sorting" role="columnheader" tabindex="0" aria-controls="pieces" rowspan="1" colspan="1" style="width: 0px;" aria-label="Nom: activate to sort column ascending">Nom</th> | ||
| <th data-column="prix" data-transform="NombreVersPrix" class="sorting" role="columnheader" tabindex="0" aria-controls="pieces" rowspan="1" colspan="1" style="width: 0px;" aria-label="Prix: activate to sort column ascending">Prix</th> | ||
| <th data-column="piece-en-stock" class="sorting" role="columnheader" tabindex="0" aria-controls="pieces" rowspan="1" colspan="1" style="width: 0px;" aria-label="En stock: activate to sort column ascending">En stock?</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| {% for product in list_products %} | ||
| <tr class="odd", style="text-align: center;"> | ||
| <td style="font-weight: bold;"><a href={{ product['page url']}} target="_blank">{{ product['sku'] }}</a></td> | ||
| <td>{{ product['name'] }}</td> | ||
| <td>{{ product['price'] }} $</td> | ||
| <td>{{ product['stock'] }}</td> | ||
| </tr> | ||
| {% endfor %} | ||
| </tbody> | ||
| </table> | ||
| {% else %} | ||
| <p class="error_message">Aucun produit trouvé.</p> | ||
| {% endif %} | ||
| {% endif %} | ||
| </div> | ||
| {% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # copier ce fichier vers $HOME/.config/biciklo/ | ||
| # modifier le nom d'utilisateur et le mot de passe | ||
| Cycle Babac: | ||
| nom utilisateur: BoblEponge | ||
| mot de passe: BasdeBikini |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.