Changeset 174

Show
Ignore:
Timestamp:
08/21/08 16:51:42 (3 months ago)
Author:
rgrp
Message:

[thread][s]: fix up thread layout template to set payload js vars to null if no values defined by python code + get thread search working together with an extra test.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/microfacts/controllers/thread.py

    r169 r174  
    2424 
    2525    def search(self, id=''): 
    26         # TODO 
    27         # request_data = dict(**request.params)  
    28         # mode = RegisterSearch('/thread', request_data).execute() 
    29         mode = RegisterSearch('/thread').execute() 
     26        request_data = dict(request.params)  
     27        mode = RegisterSearch('/thread', request_data).execute() 
    3028        if mode.response_code == 200: 
    3129            c.threads = mode.entities 
  • trunk/microfacts/templates/thread/layout.html

    r169 r174  
    3838      ${select('aside')} 
    3939      ${select('*[local-name()!="aside"]|text()')} 
    40   <script type="text/javascript" charset="utf-8"> 
    41       var payloadThread = ${c.thread_as_json}; 
    42       var payloadThreadFactlets = ${c.thread_factlets_json}; 
    43   </script> 
     40 
     41      <script type="text/javascript" charset="utf-8"> 
     42          var payloadThread = ${c.thread_as_json}<py:if test="not c.thread_as_json">null</py:if>; 
     43          var payloadThreadFactlets = ${c.thread_factlets_json}<py:if test="not c.thread_factlets_as_json">null</py:if>; 
     44 
     45      </script> 
    4446 
    4547    </body> 
  • trunk/microfacts/tests/functional/test_thread.py

    r163 r174  
    3636        assert 'There are ' + str(len(threads)) + ' threads' in response 
    3737        assert 'browse the thread list' in response 
     38        assert 'var payloadThread = null;' in response 
    3839 
    3940    def test_list(self): 
     
    5051        assert 'Battles in the Napoleonic Wars' not in response 
    5152        assert 'Battles in the Napoleonic Wars 2' not in response 
     53 
     54    def test_search_2(self): 
     55        path = url_for(controller='thread', action='search', q='title: 2') 
     56        response = self.app.get(path) 
     57        print response 
     58        assert 'Battles in the Napoleonic Wars 2' in response 
     59        assert 'Battles in the Napoleonic Wars</a>' not in response 
    5260 
    5361    def test_read(self):