[web2py] Re: help: how can I select from list:string

2011-06-19 Thread hywang
thank you :-) On 6月19日, 下午12时20分, Anthony wrote: > db(db.testtable.name.contains('kate')).select() > > Seehttp://web2py.com/book/default/chapter/06#Many-to-Many,-list:,-and-contains > . > > Anthony > > > > > > > > On Sunday, June 19, 2011

[web2py] help: how can I select from list:string

2011-06-18 Thread hywang
db.define_table("testtable", Field("name", "list:string") ) table contents are as following: idname 1 ["jim", "kate"] --- 2 ["tim", "kate"] ---

[web2py] Re: error occurs when use executesql

2011-02-16 Thread hywang
I think it is pymysql's problem because it dosen't escape query correctly, so, an syntax error is throwed. MySQLdb can escape query well, as a result , when I update web2py to new version, this error occurs. On 2月15日, 下午6时09分, Johann Spies wrote: > On 15 February 2011 08:49,

[web2py] Re: error occurs when use executesql

2011-02-14 Thread hywang
Please help to run it :-) # File Name: default.py def index(): db.define_table("pymysql",Field("content","text"),migrate=True) content = """'http://img1.t.sinajs.cn/t3/style/css/common/ layer.css'""" #content = """this sentence is no problem at all""" db.executesql("INSERT INTO py

[web2py] Re: error occurs when use executesql

2011-02-14 Thread hywang
I install two different version web2pys , one is 1.91.6 and the other is 1.87.3 1.87.3 works well while 1.91.6 throws the error On 2月14日, 下午5时53分, "Martin.Mulone" wrote: > are you sure is not syntax error? > > db.executesql("insert into hytest (conent)values(%s)",content) > > "conent"

[web2py] error occurs when use executesql

2011-02-14 Thread hywang
# database is mysql # web2py version: 1.91.6, which uses pymysql as mysql driver # my codes is something like this # import gluon.tools content = gluon.tools.fetch("http://t.sina.com.cn/reg.php? inviteCode=104174") db.executesql("i

[web2py] Re: what will happen if mysql server close all connection every 5 minutes?

2011-01-13 Thread hywang
I found it won't auto reconnect at this situation: from dal import DAL from dal import Field import time db = DAL("mysql://root:password@127.0.0.1/mydb") db.define_table("table1", Field("name"), migrate = False ) db.table1.insert(name="jim") db.commit() # Close the connection from mys

[web2py] what will happen if mysql server close all connection every 5 minutes?

2011-01-13 Thread hywang
Connections may be lost during query, and DAL will not reconnect to server , isn't it ? thank you !

[web2py] Re: problem about session

2010-09-29 Thread hywang
it works well. thank you. On 9月29日, 下午9时42分, mdipierro wrote: > If not request.function=='user': session.forget() > > will prevent saving sessions for all controller functions but the > 'user' one which handles login. > > On Sep 29, 1:56 am, hywang wrote:

[web2py] Re: problem about session

2010-09-29 Thread hywang
Brower > > On 09/29/2010 09:56 AM, hywang wrote: > > > when some one visits my site , a new session file will be created. > > Then there is a risk : if somebody connects to my site with lots of > > robots again and again, hundreds of session files will be gene

[web2py] Re: problem about session

2010-09-29 Thread hywang
at 2:17 PM, Jason Brower wrote: > > I think there is a way to save the sessions to a database. It's in the > > book if I am not mistaken. > > BR, > > Jason Brower > > > On 09/29/2010 09:56 AM, hywang wrote: > > >> when some one visits my site ,

[web2py] problem about session

2010-09-28 Thread hywang
when some one visits my site , a new session file will be created. Then there is a risk : if somebody connects to my site with lots of robots again and again, hundreds of session files will be generated in seconds, deleting session files periodically has no use at all . "session.forget()" prevents

[web2py] how can control auth expiration when put session in to memcache

2010-09-26 Thread hywang
I set auth.settings.expiration=3600*24*7 everything is ok when I put session into disk But , when I put session to memcached, it expired after several minutes. How can I solve this ? thank you .

[web2py] Re: A bug in SQLHTML.py

2010-08-13 Thread hywang
"|" was used to join values, so it can be written as values = re.compile('[^|]+').findall(str(value)) On 8月13日, 下午6时31分, hywang wrote: > line 268: values = re.compile('[\w\-:]+').findall(str(value)) > > if value contains some Chinease charactors , it fail

[web2py] A bug in SQLHTML.py

2010-08-13 Thread hywang
line 268: values = re.compile('[\w\-:]+').findall(str(value)) if value contains some Chinease charactors , it failed to parse it. eg: value = "|eng|汉字|" values = re.compile('[\w\-:]+').findall(str(value)) print values #the result is ['eng'], but not ['eng','汉字']

[web2py] Re: help:how can I get all functions and their __doc__ of a controller ?

2010-08-12 Thread hywang
> pickle. > > Massimo > > On Aug 12, 3:19 am, hywang wrote: > > > there is a controller: > > def controller_1(): > > """ > > this is its __doc__ string > > """ > > return {} > > > # How can ge

[web2py] help:how can I get all functions and their __doc__ of a controller ?

2010-08-12 Thread hywang
there is a controller: def controller_1(): """ this is its __doc__ string """ return {} # How can get ["controller_1", "this is its __doc__ string"] def controller_2(): """ this is its __doc__ string """ return {} # How can get ["controller_2", "this is its __do

[web2py] Re: Radio buttons and check boxes orientation

2010-06-16 Thread hywang
CheckboxesWidget can arrange check boxes horizontally. you can specify the colum number by 'cols' Try this: db.define_table('test', Field('children')) db.test.children.requires = IS_IN_SET(['boy1','girl1','boy2','girl2','boy3','girl3','boy4','girl4']) def horizontal_checkbox(f,v):

[web2py] error occurs when select all fields from a legacy datatable without id field

2010-06-03 Thread hywang
there is a legacy datatable named 'test' +---+--+--+-+-+---+ | Field | Type | Null | Key | Default | Extra | +---+--+--+-+-+---+ | jtk | varchar(255) | YES | | NULL| | | age | int(11) | YES |

[web2py] Re: Do you use web2py in your company?

2010-05-14 Thread hywang
I am developing a lightweight CMS framework using web2py. Maybe I will make it surpport multilanguages, but recently I am too busy. If you register, you will find that you can't do nothing, because you has no enough privilege. http://www.hibitty.com/ thanks.

[web2py] error occurs when use upload field + is_image()

2010-04-27 Thread hywang
web2py Ver 1.77.3 db.define_table('test_pic', Field('picture', 'upload') ) def hello(): form = SQLFORM(db.test_pic) if form.accepts(request.vars, session): response.flash = 'ok' return dict(form=form) it works well. when add validator IS_IMAGE db.define_table('test_pic'

[web2py] how can customize auth.table_user, I want to add avatar

2010-04-27 Thread hywang
avatar is commonly used when user registers. But auth.table_user dosen't has this field. Maybe I can add a Field('avatar', 'upload') to auth.table_user. I did do it, but failed: an error occured. ERROR:Rocket.Errors.Thread-7:Traceback (most recent call last): File "E:\web2py\gluon\rocket.py", l

[web2py] uploadwidget bug

2010-04-27 Thread hywang
db.define_table('test_pic', Field('picture', 'upload') ) def reupload_pic(): form = SQLFORM(db.test_pic, 1, upload=URL(r=request, f='download')) if form.accepts(request.vars, session): response.flash = 'ok' return dict(form=form) I specify parameter 'upload' to show subm

[web2py] error occurs when add upload field to auth.table_user

2010-04-26 Thread hywang
platform: python2.5 winxp web2py(1.77.3) from source auth.settings.table_user = db.define_table( auth.settings.table_user_name, Field('first_name', length=128, default='',writable=False, readable=False), Field('last_name', length=128, default=''), Field('email', length=512, default

[web2py] Re: fatal bug in 1.77.3

2010-04-26 Thread hywang
rubs returned > > >> objects. This was a while ago and may have changed since then. > > > >> Rocket could die a little more gracefully, but I'd rather keep the code > > >> lean rather than checking every response for validity. As a test, there > >

[web2py] Re: fatal bug in 1.77.3

2010-04-26 Thread hywang
may be it is an ooold bug, Discussion about it can be found here: http://groups.google.com/group/web2py/browse_thread/thread/bdfb9bb617488d5/641e843715eb8b11?lnk=gst&q=raise+TypeError%2C+%22not+indexable%22#641e843715eb8b11 On 4月26日, 下午3时44分, hywang wrote: > no better result if i create

[web2py] Re: fatal bug in 1.77.3

2010-04-26 Thread hywang
> On Apr 25, 10:53 pm, hywang wrote: > > > I run web2py from source on centos 5.3. > > When upload a file, an error occurs. > > -db.py--- > > db.define_table('easy_test', > > Field('picture', 'upload') > >

[web2py] Re: fatal bug in 1.77.3

2010-04-25 Thread hywang
i has no view . when i test newest version in google hg server, web2py works well, but if I add IS_IMAGE() validator, some error occured again. ver1.6x works well On 4月26日, 下午2时01分, mdipierro wrote: > Do you have a view with a custom form? > > On Apr 25, 10:53 pm, hywang wrote: &g

[web2py] Re: fatal bug in 1.77.3

2010-04-25 Thread hywang
error also occurs when run web2py from source on window platform. no better result when use ie8 On 4月26日, 下午12时09分, mdipierro wrote: > which Python version? Which browser? > > massimo > > On Apr 25, 10:53 pm, hywang wrote: > > > I run web2py from source on centos 5.3. &g

[web2py] Re: fatal bug in 1.77.3

2010-04-25 Thread hywang
python2.5 browser is ff3.62 On 4月26日, 下午12时09分, mdipierro wrote: > which Python version? Which browser? > > massimo > > On Apr 25, 10:53 pm, hywang wrote: > > > I run web2py from source on centos 5.3. > > When upload a file, an error occurs. > > -

[web2py] fatal bug in 1.77.3

2010-04-25 Thread hywang
I run web2py from source on centos 5.3. When upload a file, an error occurs. -db.py--- db.define_table('easy_test', Field('picture', 'upload') ) -controller file--- def hello(): form = SQLFORM(db.easy_test) if form.accepts(request.vars, session):

[web2py] Re: problems with send mail

2010-04-08 Thread hywang
from gluon.tool import Mail should be from gluon.tools import Mail On 4月8日, 下午9时38分, kike wrote: > I have a problem with the function Mail, when I used it the send me > the following error: > > Traceback (most recent call last): > File "/home/kike/web2py/gluon/restricted.py", line 173, in >

[web2py] when send email containing Chinease characters with tools.Mail, Mojibake appears

2010-04-08 Thread hywang
To view the email correctly when receive it, I have to specify charset to "utf-8" to avoid Mojibake. And the default charset that tools.Mail uses is charset=us-ascii. For your convenience, you can test it with these two word "测试" -- You received this message because you are subscribed to the

[web2py] when send email including Chinease with tools.Mail, Mojibake appears

2010-04-08 Thread hywang
To view the email correctly, I have to specify charset to "utf-8" to avoid Mojibake. And the default charset that tools.Mail uses is charset=us-ascii. For your convenience, you can test it with these two word "测试" -- You received this message because you are subscribed to the Google Groups "w

[web2py] how can I import a model ?

2010-04-03 Thread hywang
There are 2 applications: a-app and b-app. I want to import a model in a-app into b-app, is there a easy and safe way to do it ? thank you ! -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroup

[web2py] Re: Something is wrong when IS_IN_SET contains Chinease characters

2010-03-29 Thread hywang
lue, self.error_message) if self.multiple: return ('|%s|' % '|'.join(values), None) return (value, None) On 3月30日, 上午11时12分, hywang wrote: > thanks for your kindly help. > > On 3月30日, 上午1时47分, Yarko Tymciurak > wrote: > > > On M

[web2py] Re: Something is wrong when IS_IN_SET contains Chinease characters

2010-03-29 Thread hywang
; I hope this helps begin to show the beginning of the way: All your > strings in your app need to be converted to unicode (one way or > another), and your locale set (normally provided from the browser, in > the request). > > - Yarko > > > > > On Mar 29, 10:04 am, Yarko T

[web2py] Re: Something is wrong when IS_IN_SET contains Chinease characters

2010-03-29 Thread hywang
There is something wrong with validators.py in line 289 values = re.compile("[\w\-:]+").findall(str(value)) if I change it with values = value everything is ok Maybe it's a bug On 3月29日, 下午9时33分, hywang wrote: > ---model file is like this -

[web2py] Something is wrong when IS_IN_SET contains Chinease characters

2010-03-29 Thread hywang
---model file is like this - db.define_table('options_contain_chinease', Field('student_name', requires = IS_IN_SET(["Jim","小长","老李"], multiple=True)), ) db.options_contain_chinease.student_name.widget = CheckboxesWidget.widget --controller file is like this ---

[web2py] Something is wrong when IS_IN_SET contains Chinease characters

2010-03-29 Thread hywang
---model file is like this - db.define_table('options_contain_chinease', Field('student_name', requires = IS_IN_SET(["Jim","小长","老李"])), ) db.options_contain_chinease.student_name.widget = CheckboxesWidget.widget --controller file is like this -

[web2py] Re: Some thing wrong when IS_IN_SET contains Chinease characters

2010-03-29 Thread hywang
Sorry, db.table_contain_chinease.student_name.widget = CheckboxesWidget.widget should be : db.options_contain_chinease.student_name.widget = CheckboxesWidget.widget -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send e

[web2py] Some thing wrong when IS_IN_SET contains Chinease characters

2010-03-29 Thread hywang
model file like this --- db.define_table('options_contain_chinease', Field('student_name', requires = IS_IN_SET(["小王","小长","老李"])), ) db.table_contain_chinease.student_name.widget = CheckboxesWidget.widget -controller file like this - def test_chinease(): form = SQ

[web2py] Re: Populate field based no other fields

2010-02-05 Thread hywang
something like this def _compute(): return request.vars.in_time + request.vars.duration## db.define_table('mytable', Field('in_time','datetime'), Field('duration', 'integer'), Field('end_time','datetime', compute = _compute)) On Feb 5, 6:51 pm, Adi wrote: > Hi, > > I have a table with 3 fie

[web2py] Re: help, how to validate a form in this situation?

2010-02-05 Thread hywang
thanks , works well On Feb 5, 6:11 pm, tiago almeida wrote: > I asked about this a while ago > here<http://groups.google.co.uk/group/web2py/browse_thread/thread/e9781e20...> > . > Hope it helps. > > On Fri, Feb 5, 2010 at 8:46 AM, hywang wrote: > > there

[web2py] help, how to validate a form in this situation?

2010-02-05 Thread hywang
there is a table db.define_table('class_student', Field('class_name'), Field('student_name')) class_name + student_name should be unique in this table. How can validate the submitted data when user update or insert a record ? Thanks :-) -- You received this message because you are subscribed t

[web2py:33390] Re: suggection to sqlform

2009-10-21 Thread hywang
uot;, "specified css for column second", "specified css for column third"], \ 'field_name_3': ["specified css for column first", "specified css for column second", "specified css for column third"], \ 'field_name_4': ["specifie

[web2py:32841] suggection to sqlform

2009-10-13 Thread hywang
when sqlform is rendered as a table, the label of a field is wrapped by "td" (line 626 in sqlhtml.py), in fact, it is much more convenient for web designer if it is wrapped by 'th'. so, i suggest changing line 626 in sqlhtml.py into tr = self.trows[fieldname] = TR(TH(label), inp, comment, _id=row

[web2py:27356] some bugs

2009-07-24 Thread hywang
1) tools.py(svn version 1140), line 1405, "if not self.basic() and not not self.is_logged_in():" There are 2 not 2) contrib\login_methods\basic_auth.py(svn version 1140), line 2, "import urlib2", should be "import urllib2" 3) contrib\login_methods\basic_auth.py(svn version 1140), line 20, "u

[web2py:27029] IS_IN_DB() generates too many options !

2009-07-21 Thread hywang
when use IS_IN_DB(), it generates too many options, of course we can use requires = [IS_IN_DB()] to make it like a textbox rather than selectbox, however, it is not converious for user to select an item. Can we solve it using auto-complete like google suggestion ? --~--~-~--~~---

[web2py:25409] how can i write a PIL image object to response

2009-07-01 Thread hywang
django do it like this: from django.utils.httpwrappers import HttpResponse from PIL import Image def image(request): image = Image.new("RGB", (800, 600)) response = HttpResponse(mimetype="image/png") image.save(response, "PNG") return response in web2py, I did it with a file, fi