Changeset 4
- Timestamp:
- 11/06/07 18:53:41 (4 years ago)
- Location:
- trunk/src/server
- Files:
-
- 3 modified
-
bittorrent.py (modified) (2 diffs)
-
templates/index.html (modified) (1 diff)
-
views.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/server/bittorrent.py
r3 r4 40 40 return len(self.daemon.get_status_all()) 41 41 def setUploadLimit(self, limit): 42 " "42 "Set la valeur d'upload max" 43 43 self.daemon.set_uplimit(limit) 44 44 self.upload_limit = self.daemon.get_uplimit() 45 45 def setDownloadLimit(self, limit): 46 " "46 "Set la valeur de download max" 47 47 self.daemon.set_downlimit(limit) 48 48 self.download_limit = self.daemon.get_downlimit() … … 110 110 except: 111 111 pass 112 113 -
trunk/src/server/templates/index.html
r3 r4 23 23 </tr> 24 24 </thead> 25 <tfoot> 26 <tr> 27 <th></th> 28 <th></th> 29 <th></th> 30 <th></th> 31 <th></th> 32 <th> 33 <form method="post" action=""> 34 {{ select_download }} 35 <input type="submit" value="ok" /> 36 </form> 37 </th> 38 <th> 39 <form method="post" action=""> 40 {{ select_upload }} 41 <input type="submit" value="ok" /> 42 </form> 43 </th> 44 <th></th> 45 <th></th> 46 </tr> 47 </tfoot> 25 <tfoot> 26 <tr> 27 <th></th> 28 <th></th> 29 <th></th> 30 <th></th> 31 <th></th> 32 <th> 33 {{ download_speed }} 34 <form method="post" action=""> 35 {{ select_download }} 36 <input type="submit" value="ok" /> 37 </form> 38 </th> 39 <th> 40 {{ upload_speed }} 41 <form method="post" action=""> 42 {{ select_upload }} 43 <input type="submit" value="ok" /> 44 </form> 45 </th> 46 <th></th> 47 <th></th> 48 </tr> 49 </tfoot> 48 50 <tbody> 49 51 {% for torrent in torrents %} -
trunk/src/server/views.py
r3 r4 4 4 from django.http import HttpResponse, Http404 5 5 from bittorrent import Bittorrent 6 7 PREFIX_TEMPLATES = "dev" 6 8 7 9 def error_page(titre = "Erreur générale", … … 46 48 # Mise en forme humaine 47 49 torrents = bittorrent.liste() 50 uploadRate = 0 51 downloadRate = 0 48 52 for torrent in torrents: 53 uploadRate += torrent['upload_speed'] 54 downloadRate += torrent['download_speed'] 49 55 torrent['taille'] = bytes2human(torrent['taille']) 50 56 torrent['total_envoi'] = bytes2human(torrent['total_envoi']) … … 54 60 'nb_torrent': len(torrents), 55 61 'torrents' : torrents, 62 'upload_speed' : bytes2human(uploadRate) + "s", 63 'download_speed' : bytes2human(downloadRate) + "s", 56 64 'download_limit' : bittorrent.download_limit, 57 65 'upload_limit' : bittorrent.upload_limit, … … 63 71 bittorrent.upload_limit), 64 72 }) 65 template = loader.get_template( "index.html")73 template = loader.get_template(PREFIX_TEMPLATES + "/index.html") 66 74 return HttpResponse(template.render(c)) 67 75 … … 95 103 else: 96 104 state = "NOPOST" 97 c = Context({ 98 'etat' : state, 99 'form' : form.as_p(), 100 }) 101 template = loader.get_template("add.html") 105 c = Context({'etat' : state, 106 'form' : form.as_p(), 107 }) 108 template = loader.get_template(PREFIX_TEMPLATES + "/add.html") 102 109 return HttpResponse(template.render(c)) 103 110 … … 126 133 else: 127 134 form = MoveTorrentForm() 128 template = loader.get_template("move.html") 129 c = Context({ 130 'destination' : destination, 131 'resultat' : resultat, 132 'torrent' : info, 133 'form' : form.as_p(), 134 }) 135 template = loader.get_template(PREFIX_TEMPLATES + "/move.html") 136 c = Context({'destination' : destination, 137 'resultat' : resultat, 138 'torrent' : info, 139 'form' : form.as_p(), 140 }) 135 141 return HttpResponse(template.render(c)) 136 142 … … 159 165 else: 160 166 confirmation = True 161 162 167 else: 163 168 return HttpResponse("Erreur inconnue ....") 164 template = loader.get_template("delete.html") 165 c = Context({ 166 'confirmation' : confirmation, 167 'idtorrent' : idtorrent, 168 'torrent' : info, 169 }) 169 template = loader.get_template(PREFIX_TEMPLATES + "/delete.html") 170 c = Context({'confirmation' : confirmation, 171 'idtorrent' : idtorrent, 172 'torrent' : info, 173 }) 170 174 171 175 return HttpResponse(template.render(c))
