take care some files are modifier because of the local environnement.
authorabki <amirouche.boubekki@gmail.com>
Wed, 1 Jul 2009 22:12:39 +0000 (2 00:12 +0200)
committerabki <amirouche.boubekki@gmail.com>
Wed, 1 Jul 2009 22:12:39 +0000 (2 00:12 +0200)
new file:   .gitignore
modified:   commands/mylayman.cfg
modified:   commands/parse.py
modified:   commands/whoosh_manager.py
modified:   models.py
css for mobile/hanheld (don't work actually : use a subdomain
new file:   static/css/handheld.css
modified:   static/css/layout.css
modified:   static/css/nav.css
new file:   templates/500.html
modified:   templates/ebuildfind/base.html
modified:   templates/ebuildfind/search.html
modified:   views.py

12 files changed:
.gitignore [new file with mode: 0644]
commands/mylayman.cfg
commands/parse.py
commands/whoosh_manager.py
models.py
static/css/handheld.css [new file with mode: 0644]
static/css/layout.css
static/css/nav.css
templates/500.html [new file with mode: 0644]
templates/ebuildfind/base.html
templates/ebuildfind/search.html
views.py

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..9d0a4eb
--- /dev/null
@@ -0,0 +1,4 @@
+*~
+*pyc
+.*\#*
+\#*
\ No newline at end of file
index d0ddbfa..75709d8 100644 (file)
@@ -3,24 +3,24 @@
 #-----------------------------------------------------------
 # Defines the directory where overlays should be installed
 
-storage   : /home/timemachine/www/ebuildfnd/ebuildfind/commands/var/
+storage   : /home/amir/Desktop/ebuildfind-project/ebuilds/ebuildfind/commands/var/overlays
 
 #-----------------------------------------------------------
 # Remote overlay lists will be stored here
 # layman will append _md5(url).xml to each filename
 
-cache     : %(storage)s/cache
+cache     : %(storage)s/../cache
 
 #-----------------------------------------------------------
 # The list of locally installed overlays
 
-local_list: /home/timemachine/www/ebuildfnd/ebuildfind/commands/overlays.xml
+local_list: %(storage)s/../overlays.xml
 
 #-----------------------------------------------------------
 # Path to the make.conf file that should be modified by 
 # layman
 
-make_conf : %(storage)s/make.conf
+make_conf : %(storage)s/../make.conf
 
 #-----------------------------------------------------------
 # URLs of the remote lists of overlays (one per line) or 
@@ -31,7 +31,7 @@ make_conf : %(storage)s/make.conf
 #            http://mydomain.org/my-layman-list.xml
 #            file:///usr/portage/local/layman/my-list.xml
 
-overlays  : file:///home/timemachine/www/ebuildfnd/ebuildfind/commands/overlays.txt
+overlays  : file://%(storage)s/../../overlays.txt
 
 #-----------------------------------------------------------
 # Proxy support
index 8fff38a..3b346a5 100644 (file)
@@ -4,24 +4,20 @@ import os, re
 
 from django.conf import settings
 
-os.environ['DJANGO_SETTINGS_MODULE'] = 'ebuildfnd.settings'
+os.environ['DJANGO_SETTINGS_MODULE'] = 'ebuilds.settings'
 
 from layman.debug import Message
-from manage_layman import LaymanManager
 
-from ebuildfnd.ebuildfind.models import Ebuild, Overlay
+from ebuilds.ebuildfind.models import Ebuild, Overlay
 
 from whoosh_manager import WhooshEbuildManager
+from manage_layman import LaymanManager
 
-OVERLAYS_BASE = "/home/timemachine/www/ebuildfnd/ebuildfind/commands/var/"
-OUT = Message("parser")
+OVERLAYS_BASE = settings.ROOT_PATH + "ebuilds/" + "ebuildfind/commands/var/overlays/"
 
 class EbuildParser:
     def __init__(self, overlay, category, app, file_path):
         path, filename = os.path.split(os.path.realpath(file_path))
-
-        #OUT.warn("%s\n%s\n%s\n%s" % (overlay, category, app, file_path))
-        #OUT.warn("****************************************************")
         
         name_version, ext = os.path.splitext(filename)
         n = len(app)
@@ -78,7 +74,6 @@ def ParseEbuilds():
         path_overlay = os.path.join(OVERLAYS_BASE, overlay)
 
         if exclude_directory(path_overlay, overlay):
-            print overlay
             overlay_name = overlay
             overlay = Overlay.objects.get(name=overlay)
             
@@ -97,7 +92,6 @@ def ParseEbuilds():
                             for ebuild in ebuilds:
                                 if ebuild.endswith(".ebuild"):
                                     if exclude_directory(path_overlay_category_app, ebuild):
-                                        #OUT.warn(ebuild)
                                         
                                         path_ebuild = os.path.join(path_overlay_category_app, ebuild)                                 
                                     
@@ -114,18 +108,10 @@ def ParseEbuilds():
                                         ebuild.iuse = unicode(e.iuse)
                                         ebuild.homepage = unicode(e.homepage)
                                         ebuild.overlay = overlay
-                                        #ebuild.save()
+                                        ebuild.save()
 
-                                        
                                         whoosh.Update(ebuild)
-                                        
-                                        i +=1
-    print i
     
-def SyncOverlays():
-    h = LaymanManager()
-    h.AddAll()
-
 def ParseOverlays():
     h = LaymanManager()
     overlays = h.List()
@@ -142,7 +128,6 @@ def ParseOverlays():
             o.save()
                     
 def main():
-    #SyncOverlays()
     ParseOverlays()
     ParseEbuilds()
     
index e4acb95..b713390 100644 (file)
@@ -11,7 +11,7 @@ from django.conf import settings
 
 os.environ['DJANGO_SETTINGS_MODULE'] = 'ebuilds.settings'
 
-INDEX_BASE = settings.ROOT_PATH + "/ebuildfind/commands/var/index"
+INDEX_BASE = settings.ROOT_PATH + "ebuilds" + "/ebuildfind/commands/var/index"
 
 class WhooshEbuildManager:
     def __init__(self, reset=False):
@@ -48,8 +48,9 @@ class WhooshEbuildManager:
         
         content = ' '.join(content)
 
-        writer.add_document(permalink=ebuild.permalink(),
+        writer.add_document(permalink=unicode(ebuild.id),
                             content=content)
+        print ">", ebuild.overlay.name, ">>> ", ebuild.name
         writer.commit()
 
     def Search(self, query):
index 7e062d6..2e6741e 100644 (file)
--- a/models.py
+++ b/models.py
@@ -1,10 +1,12 @@
 from django.db import models
 
+
+
 class Overlay(models.Model):
     name = models.CharField(max_length=255)
     description = models.TextField()
     link = models.URLField()
-
+        
     def __repr__(self):
         return self.name
 
@@ -16,14 +18,14 @@ class Ebuild(models.Model):
     category = models.CharField(max_length=255)
     version = models.CharField(max_length=255)
     description = models.TextField()
-    keywords = models.CharField(max_length=255)
-    license = models.CharField(max_length=255)
-    iuse = models.CharField(max_length=255)
+    keywords = models.TextField(max_length=255)
+    license = models.TextField(max_length=255)
+    iuse = models.TextField(max_length=255)
     homepage = models.URLField()
     overlay = models.ForeignKey(Overlay)
-
-    def permalink(self):
+    
+    def path(self):
         return "/%s/%s/%s/%s" % (self.overlay.name, self.category, self.name, self.version)
 
     def get_absolute_url(self):
-       return "/search/?q=%s" % self.name
\ No newline at end of file
+       return "/search/?q=%s" % self.name
diff --git a/static/css/handheld.css b/static/css/handheld.css
new file mode 100644 (file)
index 0000000..1f42243
--- /dev/null
@@ -0,0 +1,5 @@
+* {
+   position: static !important;
+   float: none !important;
+   background: none !important;
+}
\ No newline at end of file
index 61def42..f1c901d 100755 (executable)
@@ -13,6 +13,7 @@ body {
 h7 { font-size: 11px; font-weight: normal;}\r
 \r
 .post { overflow : hidden; }\r
+\r
 /* anchors\r
 ----------------------------------------------- */\r
 \r
@@ -49,38 +50,39 @@ h7 { font-size: 11px; font-weight: normal;}
     text-align: center;\r
 }\r
 \r
-/* boxes\r
------------------------------------------------ */\r
-\r
-/* paragraphs, quotes and lists\r
------------------------------------------------ */\r
-\r
-/* menus\r
------------------------------------------------ */\r
-\r
-/* submenus\r
------------------------------------------------ */\r
-\r
-/* section menus\r
+/* results\r
 ----------------------------------------------- */\r
+.ebuild {\r
+    background-color: #DDDDFF;\r
+    margin: 0px;\r
+    padding: 10px;\r
+    margin-bottom: 10px;\r
+}\r
 \r
-/* table\r
------------------------------------------------ */\r
+ul, li {\r
+    list-style-type: none;\r
+    margin: 0px;\r
+    padding: 0px;\r
 \r
-/* forms\r
------------------------------------------------ */\r
+}\r
 \r
-/* articles\r
------------------------------------------------ */\r
+.ebuild:hover {\r
+    background-color: #7A5ADA;\r
+    color: black;\r
+}\r
 \r
-/* site information\r
------------------------------------------------ */\r
+.ebuild {\r
+    font-size: 1.2em;\r
+}\r
 \r
-/* AJAX sliding shelf\r
------------------------------------------------ */\r
+.ebuild .description {\r
+    font-size: 1.5em;\r
+}\r
 \r
-/* Accordian\r
------------------------------------------------ */\r
+.ebuild .homepage {\r
+    float: right;\r
+}\r
 \r
-/* Mootools Kwicks\r
------------------------------------------------ */\r
+.ebuild .path {\r
+    float: left;\r
+}
\ No newline at end of file
index 7cb8440..53bff8d 100755 (executable)
@@ -165,7 +165,3 @@ ul.nav li.secondary:hover a:hover {
        background:#555;\r
 }\r
 ul.nav li.secondary:hover a:active {background:#444;}\r
-\r
-#results li:hover {\r
-    font-weight: bold;\r
-}
\ No newline at end of file
diff --git a/templates/500.html b/templates/500.html
new file mode 100644 (file)
index 0000000..2bf3dd1
--- /dev/null
@@ -0,0 +1 @@
+Sory Fattal Error
index a332a1d..4ef4227 100644 (file)
@@ -7,9 +7,10 @@
     <link rel="stylesheet" type="text/css" href="/static/css/text.css" media="screen" />
     <link rel="stylesheet" type="text/css" href="/static/css/grid.css" media="screen" />
     <link rel="stylesheet" type="text/css" href="/static/css/layout.css" media="screen" />
-    <link rel="stylesheet" type="text/css" href="/static/css/nav.css" media="screen" />
     <!--[if IE 6]><link rel="stylesheet" type="text/css" href="css/ie6.css" media="screen" /><![endif]-->
-    <!--[if IE 7]><link rel="stylesheet" type="text/css" href="css/ie.css" media="screen" /><![endif]-->
+    <!--[if IE 7]><link rel="stylesheet" type="text/css"
+    href="css/ie.css" media="screen" /><![endif]-->
+    <link rel="stylesheet" href="/static/css/handheld.css" type="text/css" media="handheld" />
     <meta name="verify-v1" content="Eoz2Hmql/IvlB4zKL5iMhKkJw5oPotgC7Qik72ZkLmI=" >
   </head>
   <body>
index ced17d8..9ecf917 100644 (file)
 {% endif %}
 
 <ul>
-  {% for result in results %}
-  <li>{{result}}</li>
+  {% for ebuild in results %}
+  <li>
+    <div class="ebuild">
+      <ul>
+       <li class="path">{{ebuild.path}}</li>
+       <li class="homepage"><a href="{{ebuild.homepage}}">homepage</a></li>
+       <div class="clear"></div>
+       {% if ebuild.keywords %}
+       <li class="keywords">{{ebuild.keywords}}</li>
+       {% endif %}
+       {% if ebuild.iuse %}
+       <li class="iuse">{{ebuild.iuse}}</li>
+       {% endif %}
+       <li class="license">{{ebuild.license}}</li>
+       <li class="description">{{ebuild.description}}</li>
+      </ul>
+    </div>
+  </li>
   {% endfor %}
 </ul>
 
index cc17e83..aabd229 100644 (file)
--- a/views.py
+++ b/views.py
@@ -1,14 +1,10 @@
-
-
-
-
-
 from commands.whoosh_manager import WhooshEbuildManager
 from django.shortcuts import render_to_response
 from planet import Parser
 
-whoosh = WhooshEbuildManager()
+from models import Ebuild, Overlay
 
+whoosh = WhooshEbuildManager()
 
 def index(request):
     GPlanet = Parser("http://planet.gentoo.org/atom.xml")
@@ -25,6 +21,11 @@ def index(request):
     return render_to_response("ebuildfind/index.html", response)
 
 
+overlay = {}
+
+def add_overlay(name, description):
+    overlay["name"] = description
+
 def search(request):    
     response = {"error":"Query should be at least 3 caracters long"}
     query = ""
@@ -43,6 +44,7 @@ def search(request):
         response["results"] = list()
         
         for result in results:
-            response["results"].append(result["permalink"])
+            ebuild = Ebuild.objects.get(id=result["permalink"])
+            response["results"].append(ebuild)
             
     return render_to_response("ebuildfind/search.html", response)