Changeset 1907 for trunk/BlogPost.py


Ignore:
Timestamp:
07/30/07 14:21:50 (12 years ago)
Author:
jukka
Message:

Closed #1476, spent 20h. I'm allowing editing and deleting resource discussions like any other forum posts: if the discussion is deleted, new one will be created next time someone tries discussion. The default discussion post bodytext is i18n:translated, but once someone changes it, it won't try to translate it anymore.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BlogPost.py

    r1833 r1907  
    5151        ), 
    5252    ), 
     53    BooleanField( 
     54        name="is_discussion", 
     55        default=False, 
     56        widget=ComputedWidget( 
     57            visible={'edit':'invisible', 'view':'invisible'} 
     58            ), 
     59        ), 
    5360)) 
    5461schema = schema.copy() 
     
    223230        return lt.split_at_p_or_br(self.getBlog(),min_len=50, max_len=200); 
    224231 
     232    def getDiscussedResource(self): 
     233        """ if this is related to some resource, get the resource """ 
     234        reftool= getToolByName(self, 'reference_catalog') 
     235        obj_uid = self.UID() 
     236        found = [] 
     237        ref_query = { 'sourceUID': obj_uid, 'type': 'is_discussion_about' } 
     238        refresults = reftool(ref_query) 
     239        for q in refresults: 
     240            refobject = reftool.lookupObject(q.UID) 
     241            target = refobject.getTargetObject() 
     242            if target:  
     243                return target 
     244        return None  
     245 
    225246 
    226247registerType(BlogPost, PROJECTNAME) 
Note: See TracChangeset for help on using the changeset viewer.