Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Feb 9th, 2010 | Syntax: Python | Size: 1.33 KB | Hits: 38 | Expires: Never
Copy text to clipboard
  1. diff --git a/pyforge/pyforge/ext/search/search_main.py b/pyforge/pyforge/ext/search/search_main.py
  2. index 44be60a..767e4b8 100644
  3. --- a/pyforge/pyforge/ext/search/search_main.py
  4. +++ b/pyforge/pyforge/ext/search/search_main.py
  5.  -49,11 +49,13 @@ class SearchApp(Application):
  6.          g.solr.add([ s for a,s in artifacts])
  7.          # Add backreferences
  8.          for a, s in artifacts:
  9. +            c.app = c.project.app_instance(a.app_config_id)
  10.              aref = a.dump_ref()
  11.              references = list(search.find_shortlinks(s['text']))
  12.              a.references = [ r.artifact_reference for r in references ]
  13.              for r in references:
  14.                  M.ArtifactReference(r.artifact_reference).to_artifact().backreferences[s['id']] =aref
  15. +        M.session.artifact_orm_session.close()
  16.  
  17.      @classmethod
  18.      @react('artifacts_removed')
  19.  -68,8 +70,10 @@ class SearchApp(Application):
  20.          g.solr.add([ s for a,s in artifacts])
  21.          # Add backreferences
  22.          for a, s in artifacts:
  23. +            c.app = c.project.app_instance(a.app_config_id)
  24.              for r in search.find_shortlinks(s['text']):
  25.                  del M.ArtifactReference(r.artifact_reference).to_artifact().backreferences[s['id']]
  26. +        M.session.artifact_orm_session.close()
  27.  
  28.      @classmethod
  29.      @audit('search.check_commit')