def ico_url(id): pic_id = ico96.get(id) if pic_id: return fs_url_jpg("96", pic_id)
def pic211_url(id): pic_id = ico96.get(id) if pic_id: return fs_url_jpg("211", pic_id)
def __getattr__(self, name): if name.startswith('src'): size = name[3:] if size.isdigit(): return fs_url_jpg(size, self.id)
def pic_url(id, size="721"): f = ico.get(id) if f: return fs_url_jpg(size, f)
def feed_tuple_by_db(id): m = Po.mc_get(id) if not m: feed_rm(id) cid = m.cid rid = m.rid has_question = cid in (CID_WORD, CID_ANSWER) if rid and has_question: question = m.target name = question.name elif cid == CID_REC: name = m.name_htm elif cid != CID_WORD: name = m.name else: name = None #if cid == CID_QUESTION: # reply_count = answer_count(id) #else: reply_count = m.reply_count if cid == CID_PHOTO: rid = fs_url_jpg(721, rid) elif cid == CID_AUDIO: rid = fs_url_audio(id, '') elif cid == CID_VIDEO: rid = video_link_autoplay(rid, id) elif cid == CID_EVENT: event = Event.mc_get(id) feed_rm(id) rid = fs_url_jpg(162, event.pic_id) else: rid = rid result = [ m.user_id, cid, rid, m.zsite_id, reply_count, m.create_time, name, #vote_count(id) ] txt = m.txt if cid != CID_WORD: txt, has_more = cnenoverflow(txt, 100) if not has_more: txt = m.htm result.extend((txt, has_more)) else: txt = txt_withlink(txt) result.extend((txt, False)) if cid == CID_EVENT: result.append(place_name(event.pid)) result.append(event.address) result.extend(begin_end_by_minute(event.begin_time, event.end_time)) elif rid and has_question: user = question.user result.extend((question.id, user.name, user.link)) return result
def pic211_url(id): pic_id = ico96.get(id) if pic_id: return fs_url_jpg('211', pic_id)
def ico_url(id): pic_id = ico96.get(id) if pic_id: return fs_url_jpg('96', pic_id)
def pic_url(id, size='721'): f = ico.get(id) if f: return fs_url_jpg(size, f)
def feed_tuple_by_db(id): m = Po.mc_get(id) if not m: feed_rm(id) cid = m.cid rid = m.rid has_question = cid in (CID_WORD, CID_ANSWER) if rid and has_question: question = m.target name = question.name elif cid == CID_REC: name = m.name_htm elif cid != CID_WORD: name = m.name else: name = None #if cid == CID_QUESTION: # reply_count = answer_count(id) #else: reply_count = m.reply_count if cid == CID_PHOTO: rid = fs_url_jpg(721, rid) elif cid == CID_AUDIO: rid = fs_url_audio(id, '') elif cid == CID_VIDEO: rid = video_link_autoplay(rid, id) elif cid == CID_EVENT: event = Event.mc_get(id) feed_rm(id) rid = fs_url_jpg(162, event.pic_id) else: rid = rid result = [ m.user_id, cid, rid, m.zsite_id, reply_count, m.create_time, name, #vote_count(id) ] txt = m.txt if cid != CID_WORD: txt, has_more = cnenoverflow(txt, 100) if not has_more: txt = m.htm result.extend((txt, has_more)) else: txt = txt_withlink(txt) result.extend((txt, False)) if cid == CID_EVENT: result.append(place_name(event.pid)) result.append(event.address) result.extend( begin_end_by_minute(event.begin_time, event.end_time) ) elif rid and has_question: user = question.user result.extend( (question.id, user.name, user.link) ) return result