2007年11月10日 星期六 23:35
ͬһ¸öÒ³ÃæÌá½»¹ýºó£¬ÔÙ´ÎˢлáÔÙ´ÎÏòÊý¾Ý¿â²åÈëÊý¾ÝÈçºÎ±ÜÃâ ÁíÒ»¸öÎÊÌâÊÇ£º ÎÒÔÚdjangoÖÐÖ´ÐÐos.mkdir(settings.STATIC_PATH + '/photos/' + request.session ['username']) usernameÊÇÖÐÎĵĴ´½¨µÄĿ¼ȴÊÇÂÒÂ룬ÈçºÎ±ÜÃâÂÒÂëÎÊÌâ°¡ -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20071110/46833265/attachment.html
2007年11月11日 星期日 04:36
使用return HttpResponseRedirect('url')的方式进行重定向,可以避免重复提交的问题。 不过这是重定向,你无法向request里设置东西。 除非你增加重复提交的判断标记(在进入提交页面的时候设置一个标准,提交的时候清除标记),不然这个问题必然存在。 使用urllib.quote对中文进行编码。 重复提交的问题应当是普遍 在 07-11-10,朽木klutz<chumpklutz在gmail.com> 写道: > 同一个页面提交过后,再次刷新会再次向数据库插入数据如何避免 > > > 另一个问题是: > 我在django中执行os.mkdir(settings.STATIC_PATH + '/photos/' + > request.session['username']) > username是中文的创建的目录却是乱码,如何避免乱码问题啊 > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to > python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to > python-chinese-request在lists.python.cn > Detail Info: > http://python.cn/mailman/listinfo/python-chinese > -- Blog http://vicalloy.spaces.live.com/ My googlepage http://vicalloy.googlepages.com/ OldPhoto http://www.lzpian.com/
2007年11月11日 星期日 09:23
On 11/10/07, 朽木klutz <chumpklutz在gmail.com> wrote: > 同一个页面提交过后,再次刷新会再次向数据库插入数据如何避免 > > > 另一个问题是: > 我在django中执行os.mkdir(settings.STATIC_PATH + '/photos/' + > request.session['username']) > username是中文的创建的目录却是乱码,如何避免乱码问题啊 一种是在后台进行处理 ,比如几秒钟之内不能重复。另一种是通过ajax的方式,在提交后,将提交按钮禁止掉,这样用户就点击不了了,不过对于通过程序提交的无法处理。如果两者结合可能更完美。简单情况下禁止按钮就行了。 -- I like python! UliPad <>: http://code.google.com/p/ulipad/ meide < >: http://code.google.com/p/meide/ My Blog: http://www.donews.net/limodou
2007年11月11日 星期日 11:10
ûÁôÒâ¹ý¡£ djangoÀïûÓÐtoken»úÖÆÂ𣿠On 11/11/07, limodou <limodou在gmail.com> wrote: > > On 11/10/07, Ðàľklutz <chumpklutz在gmail.com> wrote: > > ͬһ¸öÒ³ÃæÌá½»¹ýºó£¬ÔÙ´ÎˢлáÔÙ´ÎÏòÊý¾Ý¿â²åÈëÊý¾ÝÈçºÎ±ÜÃâ > > > > > > ÁíÒ»¸öÎÊÌâÊÇ£º > > ÎÒÔÚdjangoÖÐÖ´ÐÐos.mkdir(settings.STATIC_PATH + '/photos/' + > > request.session['username']) > > usernameÊÇÖÐÎĵĴ´½¨µÄĿ¼ȴÊÇÂÒÂ룬ÈçºÎ±ÜÃâÂÒÂëÎÊÌâ°¡ > > Ò»ÖÖÊÇÔÚºǫ́½øÐд¦Àí > £¬±ÈÈ缸ÃëÖÓÖ®ÄÚ²»ÄÜÖظ´¡£ÁíÒ»ÖÖÊÇͨ¹ýajaxµÄ·½Ê½£¬ÔÚÌá½»ºó£¬½«Ìá½»°´Å¥½ûÖ¹µô£¬ÕâÑùÓû§¾Íµã»÷²»ÁËÁË£¬²»¹ý¶ÔÓÚͨ¹ý³ÌÐòÌá½»µÄÎÞ·¨´¦Àí¡£Èç¹ûÁ½Õß½áºÏ¿ÉÄܸüÍêÃÀ¡£¼òµ¥Çé¿öϽûÖ¹°´Å¥¾ÍÐÐÁË¡£ > > -- > I like python! > UliPad <>: http://code.google.com/p/ulipad/ > meide <>: http://code.google.com/p/meide/ > My Blog: http://www.donews.net/limodou > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20071111/d07130d2/attachment.html
2007年11月11日 星期日 11:55
limidou£º²»ÊÇͨ¹ýÌá½»°´Å¥Ìá½»µÄ¶øÊÇË¢ÐÂÒ³Ãæ¾Í»áÓÐÕâÑùµÄÎÊÌ⣬Õâ¸öÎÊÌâŪµÄÎÒºÜÉúÓôÃÆ ÔÚ07-11-11£¬@@ <askfor在gmail.com> дµÀ£º > > ûÁôÒâ¹ý¡£ > djangoÀïûÓÐtoken»úÖÆÂ𣿠> > > On 11/11/07, limodou <limodou在gmail.com> wrote: > > > > On 11/10/07, Ðàľklutz <chumpklutz在gmail.com> wrote: > > > ͬһ¸öÒ³ÃæÌá½»¹ýºó£¬ÔÙ´ÎˢлáÔÙ´ÎÏòÊý¾Ý¿â²åÈëÊý¾ÝÈçºÎ±ÜÃâ > > > > > > > > > ÁíÒ»¸öÎÊÌâÊÇ£º > > > ÎÒÔÚdjangoÖÐÖ´ÐÐos.mkdir(settings.STATIC_PATH + '/photos/' + > > > request.session['username']) > > > usernameÊÇÖÐÎĵĴ´½¨µÄĿ¼ȴÊÇÂÒÂ룬ÈçºÎ±ÜÃâÂÒÂëÎÊÌâ°¡ > > > > Ò»ÖÖÊÇÔÚºǫ́½øÐд¦Àí > > £¬±ÈÈ缸ÃëÖÓÖ®ÄÚ²»ÄÜÖظ´¡£ÁíÒ»ÖÖÊÇͨ¹ýajaxµÄ·½Ê½£¬ÔÚÌá½»ºó£¬½«Ìá½»°´Å¥½ûÖ¹µô£¬ÕâÑùÓû§¾Íµã»÷²»ÁËÁË£¬²»¹ý¶ÔÓÚͨ¹ý³ÌÐòÌá½»µÄÎÞ·¨´¦Àí¡£Èç¹ûÁ½Õß½áºÏ¿ÉÄܸüÍêÃÀ¡£¼òµ¥Çé¿öϽûÖ¹°´Å¥¾ÍÐÐÁË¡£ > > > > > > -- > > I like python! > > UliPad <>: http://code.google.com/p/ulipad/ > > meide <>: http://code.google.com/p/meide/ > > My Blog: http://www.donews.net/limodou > > _______________________________________________ > > python-chinese > > Post: send python-chinese在lists.python.cn > > Subscribe: send subscribe to python-chinese-request在lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20071111/3b65ccbb/attachment.htm
2007年11月11日 星期日 12:07
On 11/11/07, 朽木klutz <chumpklutz在gmail.com> wrote: > limidou:不是通过提交按钮提交的而是刷新页面就会有这样的问题,这个问题弄的我很生郁闷 > 刷新没有办法,只能在后台控制了。要么就是看如何使本地缓冲的失效,这样让刷新不起作用,不过怎么做我还不清楚,可能是需要增加一些http的控制头。 -- I like python! UliPad <>: http://code.google.com/p/ulipad/ meide < >: http://code.google.com/p/meide/ My Blog: http://www.donews.net/limodou
2007年11月11日 星期日 12:23
ÕâÖÖÒ»°ã¶¼Í¨¹ýtoken»úÖƽâ¾ö¡£ http://www.djangoproject.com/documentation/csrf/ Õâ¸öÓ¦¸Ã¾Í¿ÉÒÔÁË¡£ On 11/11/07, Ðàľklutz <chumpklutz在gmail.com> wrote: > > limidou£º²»ÊÇͨ¹ýÌá½»°´Å¥Ìá½»µÄ¶øÊÇË¢ÐÂÒ³Ãæ¾Í»áÓÐÕâÑùµÄÎÊÌ⣬Õâ¸öÎÊÌâŪµÄÎÒºÜÉúÓôÃÆ > > ÔÚ07-11-11£¬@@ <askfor在gmail.com> дµÀ£º > > > > ûÁôÒâ¹ý¡£ > > djangoÀïûÓÐtoken»úÖÆÂ𣿠> > > > > > On 11/11/07, limodou <limodou在gmail.com> wrote: > > > > > > On 11/10/07, Ðàľklutz < chumpklutz在gmail.com> wrote: > > > > ͬһ¸öÒ³ÃæÌá½»¹ýºó£¬ÔÙ´ÎˢлáÔÙ´ÎÏòÊý¾Ý¿â²åÈëÊý¾ÝÈçºÎ±ÜÃâ > > > > > > > > > > > > ÁíÒ»¸öÎÊÌâÊÇ£º > > > > ÎÒÔÚdjangoÖÐÖ´ÐÐos.mkdir(settings.STATIC_PATH + '/photos/' + > > > > request.session['username']) > > > > usernameÊÇÖÐÎĵĴ´½¨µÄĿ¼ȴÊÇÂÒÂ룬ÈçºÎ±ÜÃâÂÒÂëÎÊÌâ°¡ > > > > > > Ò»ÖÖÊÇÔÚºǫ́½øÐд¦Àí > > > £¬±ÈÈ缸ÃëÖÓÖ®ÄÚ²»ÄÜÖظ´¡£ÁíÒ»ÖÖÊÇͨ¹ýajaxµÄ·½Ê½£¬ÔÚÌá½»ºó£¬½«Ìá½»°´Å¥½ûÖ¹µô£¬ÕâÑùÓû§¾Íµã»÷²»ÁËÁË£¬²»¹ý¶ÔÓÚͨ¹ý³ÌÐòÌá½»µÄÎÞ·¨´¦Àí¡£Èç¹ûÁ½Õß½áºÏ¿ÉÄܸüÍêÃÀ¡£¼òµ¥Çé¿öϽûÖ¹°´Å¥¾ÍÐÐÁË¡£ > > > > > > > > > -- > > > I like python! > > > UliPad <>: http://code.google.com/p/ulipad/ > > > meide <>: http://code.google.com/p/meide/ > > > My Blog: http://www.donews.net/limodou > > > _______________________________________________ > > > python-chinese > > > Post: send python-chinese在lists.python.cn > > > Subscribe: send subscribe to python-chinese-request在lists.python.cn > > > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese在lists.python.cn > > Subscribe: send subscribe to python-chinese-request在lists.python.cn > > Unsubscribe: send unsubscribe to > > python-chinese-request在lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20071111/a5a38819/attachment.html
2007年11月11日 星期日 12:28
¿´ÁËÏÂcsrfµÄ´úÂ룬¿ÉÄÜ»¹µÃÐÞ¸ÄËüÉú³ÉtokenµÄ·½Ê½²ÅÐС£ÏÖÔÚÊÇΪÁË´¦Àí¿çÕ¾¹¥»÷µÄ¡£ On 11/11/07, @@ <askfor在gmail.com> wrote: > > ÕâÖÖÒ»°ã¶¼Í¨¹ýtoken»úÖƽâ¾ö¡£ > > http://www.djangoproject.com/documentation/csrf/ > Õâ¸öÓ¦¸Ã¾Í¿ÉÒÔÁË¡£ > > > On 11/11/07, Ðàľklutz <chumpklutz在gmail.com> wrote: > > > limidou£º²»ÊÇͨ¹ýÌá½»°´Å¥Ìá½»µÄ¶øÊÇË¢ÐÂÒ³Ãæ¾Í»áÓÐÕâÑùµÄÎÊÌ⣬Õâ¸öÎÊÌâŪµÄÎÒºÜÉúÓôÃÆ > > > > ÔÚ07-11-11£¬@@ <askfor在gmail.com> дµÀ£º > > > > > > ûÁôÒâ¹ý¡£ > > > djangoÀïûÓÐtoken»úÖÆÂ𣿠> > > > > > > > > On 11/11/07, limodou <limodou在gmail.com> wrote: > > > > > > > > On 11/10/07, Ðàľklutz < chumpklutz在gmail.com> wrote: > > > > > ͬһ¸öÒ³ÃæÌá½»¹ýºó£¬ÔÙ´ÎˢлáÔÙ´ÎÏòÊý¾Ý¿â²åÈëÊý¾ÝÈçºÎ±ÜÃâ > > > > > > > > > > > > > > > ÁíÒ»¸öÎÊÌâÊÇ£º > > > > > ÎÒÔÚdjangoÖÐÖ´ÐÐos.mkdir(settings.STATIC_PATH + '/photos/' + > > > > > request.session['username']) > > > > > usernameÊÇÖÐÎĵĴ´½¨µÄĿ¼ȴÊÇÂÒÂ룬ÈçºÎ±ÜÃâÂÒÂëÎÊÌâ°¡ > > > > > > > > Ò»ÖÖÊÇÔÚºǫ́½øÐд¦Àí > > > > £¬±ÈÈ缸ÃëÖÓÖ®ÄÚ²»ÄÜÖظ´¡£ÁíÒ»ÖÖÊÇͨ¹ýajaxµÄ·½Ê½£¬ÔÚÌá½»ºó£¬½«Ìá½»°´Å¥½ûÖ¹µô£¬ÕâÑùÓû§¾Íµã»÷²»ÁËÁË£¬²»¹ý¶ÔÓÚͨ¹ý³ÌÐòÌá½»µÄÎÞ·¨´¦Àí¡£Èç¹ûÁ½Õß½áºÏ¿ÉÄܸüÍêÃÀ¡£¼òµ¥Çé¿öϽûÖ¹°´Å¥¾ÍÐÐÁË¡£ > > > > > > > > > > > > -- > > > > I like python! > > > > UliPad <>: http://code.google.com/p/ulipad/ > > > > meide <>: http://code.google.com/p/meide/ > > > > My Blog: http://www.donews.net/limodou > > > > _______________________________________________ > > > > python-chinese > > > > Post: send python-chinese在lists.python.cn > > > > Subscribe: send subscribe to python-chinese-request在lists.python.cn > > > > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > _______________________________________________ > > > python-chinese > > > Post: send python-chinese在lists.python.cn > > > Subscribe: send subscribe to python-chinese-request在lists.python.cn > > > Unsubscribe: send unsubscribe to > > > python-chinese-request在lists.python.cn > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese在lists.python.cn > > Subscribe: send subscribe to python-chinese-request在lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20071111/c3c885cc/attachment-0001.htm
2007年11月11日 星期日 12:46
´ó¸Å·½·¨£º process_response ʱ»áµ÷ÓÃ_make_token ÕâÀï×îºÃ°Ñ»ñÈ¡tokenµÄ·½Ê½ºÍµ±Ç°Ê±¼ä£¨ºÁÃ룩¹ØÁªÆðÀ´£¬²»¹ØÁªÒ²Ã»¹Øϵ¡£ »ñÈ¡µ½tokenºó·ÅÔÚsessionÖС£ process_request ÖÐcsrf_token = _make_token(session_id) ¸Ä³É_get_token£¬ _get_token·½·¨Ö±½ÓÈ¥sessionÖÐÈ¡tokenÖµ£¬È¡Íêºó°ÑsessionÖеÄtokenÖóɿա£ ¾ÍÄÜ¿ØÖÆÁË¡£ On 11/11/07, @@ <askfor在gmail.com> wrote: > > ¿´ÁËÏÂcsrfµÄ´úÂ룬¿ÉÄÜ»¹µÃÐÞ¸ÄËüÉú³ÉtokenµÄ·½Ê½²ÅÐС£ÏÖÔÚÊÇΪÁË´¦Àí¿çÕ¾¹¥»÷µÄ¡£ > > > > On 11/11/07, @@ <askfor在gmail.com> wrote: > > > > ÕâÖÖÒ»°ã¶¼Í¨¹ýtoken»úÖƽâ¾ö¡£ > > > > http://www.djangoproject.com/documentation/csrf/ > > Õâ¸öÓ¦¸Ã¾Í¿ÉÒÔÁË¡£ > > > > > > On 11/11/07, Ðàľklutz < chumpklutz在gmail.com> wrote: > > > > > limidou£º²»ÊÇͨ¹ýÌá½»°´Å¥Ìá½»µÄ¶øÊÇË¢ÐÂÒ³Ãæ¾Í»áÓÐÕâÑùµÄÎÊÌ⣬Õâ¸öÎÊÌâŪµÄÎÒºÜÉúÓôÃÆ > > > > > > ÔÚ07-11-11£¬@@ <askfor在gmail.com> дµÀ£º > > > > > > > > ûÁôÒâ¹ý¡£ > > > > djangoÀïûÓÐtoken»úÖÆÂ𣿠> > > > > > > > > > > > On 11/11/07, limodou <limodou在gmail.com> wrote: > > > > > > > > > > On 11/10/07, Ðàľklutz < chumpklutz在gmail.com> wrote: > > > > > > ͬһ¸öÒ³ÃæÌá½»¹ýºó£¬ÔÙ´ÎˢлáÔÙ´ÎÏòÊý¾Ý¿â²åÈëÊý¾ÝÈçºÎ±ÜÃâ > > > > > > > > > > > > > > > > > > ÁíÒ»¸öÎÊÌâÊÇ£º > > > > > > ÎÒÔÚdjangoÖÐÖ´ÐÐos.mkdir(settings.STATIC_PATH + '/photos/' + > > > > > > request.session['username']) > > > > > > usernameÊÇÖÐÎĵĴ´½¨µÄĿ¼ȴÊÇÂÒÂ룬ÈçºÎ±ÜÃâÂÒÂëÎÊÌâ°¡ > > > > > > > > > > Ò»ÖÖÊÇÔÚºǫ́½øÐд¦Àí > > > > > £¬±ÈÈ缸ÃëÖÓÖ®ÄÚ²»ÄÜÖظ´¡£ÁíÒ»ÖÖÊÇͨ¹ýajaxµÄ·½Ê½£¬ÔÚÌá½»ºó£¬½«Ìá½»°´Å¥½ûÖ¹µô£¬ÕâÑùÓû§¾Íµã»÷²»ÁËÁË£¬²»¹ý¶ÔÓÚͨ¹ý³ÌÐòÌá½»µÄÎÞ·¨´¦Àí¡£Èç¹ûÁ½Õß½áºÏ¿ÉÄܸüÍêÃÀ¡£¼òµ¥Çé¿öϽûÖ¹°´Å¥¾ÍÐÐÁË¡£ > > > > > > > > > > > > > > > -- > > > > > I like python! > > > > > UliPad <>: http://code.google.com/p/ulipad/ > > > > > meide <>: http://code.google.com/p/meide/ > > > > > My Blog: http://www.donews.net/limodou > > > > > _______________________________________________ > > > > > python-chinese > > > > > Post: send python-chinese在lists.python.cn > > > > > Subscribe: send subscribe to > > > > > python-chinese-request在lists.python.cn > > > > > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > > > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > > > _______________________________________________ > > > > python-chinese > > > > Post: send python-chinese在lists.python.cn > > > > Subscribe: send subscribe to python-chinese-request在lists.python.cn > > > > Unsubscribe: send unsubscribe to > > > > python-chinese-request在lists.python.cn > > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > _______________________________________________ > > > python-chinese > > > Post: send python-chinese在lists.python.cn > > > Subscribe: send subscribe to python-chinese-request在lists.python.cn > > > Unsubscribe: send unsubscribe to > > > python-chinese-request在lists.python.cn > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > > -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20071111/2f1d606a/attachment.html
Zeuux © 2025
京ICP备05028076号