login


实现了个新鲜事功能 开放测试

Friday, Jan.. 2. 2009 –  Category: GAE 开发  –  4 Comments
Tags: Google App Engine 

实现了新鲜事功能 ,基于Django的signals
目前新加文章以及评论 都会记录为新鲜事 以后可以很方便的扩展到其他的Model类上 只要继承我得SignalsBaseModel类就好了. 先开放公测:-) 测试地址

http://ihere.appspot.com/labs/
http://ihere.appspot.com/event/

class SignalsBaseModel(BaseModel):
    def save(self,created=False):       
        signals.pre_save.send(sender=self.__class__, instance=self)
        super(SignalsBaseModel,self).save()
        try:
            if not self.lastModifiedDate:
                created=True           
        except AttributeError:
            created=False
#        created=self.is_saved()
        signals.post_save.send(sender=self.__class__, instance=self,created=created)       

    def delete(self):
        signals.pre_delete.send(sender=self.__class__, instance=self)
        super(SignalsBaseModel,self).delete()
        signals.post_delete.send(sender=self.__class__, instance=self)
具体实现参照http://ihere.appspot.com/post/2323

    Share in Google Reader     Share in Twitter..     Share in Friendfeed     Leave a Reply

4 Response to “实现了个新鲜事功能 开放测试”

  1. Robert Says:

    Cool! 测试一下!

  2. evertobe Says:

    呵呵 回踩你的blog了~ 是呀signals对于减少app间的耦合  app间的通讯都有深远的意义~

    pinax是个好东西 , 其实主要是看看他项目的组织, 以及别人写Django App的方式... 看它的代码学到很多..

  3. areyoulookon Says:

    测试~

  4. 架构 Says:

    不错

Leave a Reply


Logo

About Me

  • A Computer Geek in Beijing, China. Focus on Web2.0 Technology: Google App Engine, Python, Django, Software Architecture, Agile, JAVA, J2EE, JavaScript, etc.

    Coding for fun, Coding with passion :-) It's my life!

Most Popular Posts

Tags