[web2py] Re: postgres error

2013-03-22 Thread yashar
thank you, very helpful. On Thursday, March 21, 2013 11:57:40 PM UTC+3:30, Niphlod wrote: just to clear out doubts. a field 'reference sometable' gets: - a foreign key to the id of sometable - a validator that by default builds up on the format argument of sometable you CAN'T have

[web2py] Re: record representation format that refer to another table and that table is refer to another table

2013-03-22 Thread 黄祥
thank you so much for your hint, anthony, but when i test it both of it return an error, any idea about this? IS_IN_DB(db(db.room.status=='Available'), db.room.id, label=lambda r: '%s %s' % (r.room.branch.address, r.room.room_no)) Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13.

[web2py] Re: Pythonanywhere down today?

2013-03-22 Thread 黄祥
i still can access it both of web2py.com and my own -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options,

Re: [web2py] Re: Pythonanywhere down today?

2013-03-22 Thread Roberto De Ioris
i still can access it both of web2py.com and my own All fine from both Italy and Germany -- Roberto De Ioris http://unbit.it -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from

Re: [web2py] Re: REF: Upload of Files

2013-03-22 Thread Teddy Nyambe
Ok great and thanks for all your help, the file is being saved and all works as expected!!! code that works below: def index(): form = SQLFORM.factory(Field(first_name),Field(quotes_file, upload, uploadfolder=os.path.join(request.folder, 'uploads'))) test = '' first_name = '' if

[web2py] Is there some code reader like source insight for python?

2013-03-22 Thread RunSky ruan
I want to read the douce code of web2py ,but three are no good code reader. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to

[web2py] How to get selective update rows from SQLFROM.grid

2013-03-22 Thread Sarbjit singh
Hello All, I am a newbie to web2py and developing my test app. I want to present all the entries in a db using SQLFORM.grid with the option to edit/delete rows based on user name. e.g. My models are like: Person table with entries name, userid, address, phone number. Controller looks like

[web2py] Re: Backup Restore problems

2013-03-22 Thread dederocks
Sure. As long as what can and cannot be expected from the functions is clear, I'm happy with your way! Le jeudi 21 mars 2013 16:44:17 UTC+1, Niphlod a écrit : my point exactly it's a matter on how it's perceived as a one-solution-for-all-exporting-problem vs a rapid way to load

[web2py] Re: Is there some code reader like source insight for python?

2013-03-22 Thread Niphlod
ehm ? what ? On Friday, March 22, 2013 9:06:51 AM UTC+1, RunSky ruan wrote: I want to read the douce code of web2py ,but three are no good code reader. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and

[web2py] Re: Access data in PUT request for @request.restful()

2013-03-22 Thread Daniel Gonzalez
Thanks Massimo, I realize now that those variables are also in **vars (request.restful interfacehttp://www.web2pyslices.com/slice/show/1533/restful-api-with-web2py ) I wonder how conflicts between query parameters and body parameters are resolved. BR, Daniel On Friday, March 22, 2013 6:02:32

Re: [web2py] Re: Is there some code reader like source insight for python?

2013-03-22 Thread Philip Kilner
Hi, On 22/03/13 09:29, Niphlod wrote: ehm ? what ? I was intrigued, so had a Google... The OP seems to want something like this: - http://www.sourceinsight.com/ ...which seems to be inspired by this: - http://cscope.sourceforge.net/ ...which in turn led me to this: -

[web2py] TextField validation

2013-03-22 Thread waqasiqbal . knysys
Hi EveryOne, i want to ask about the textvalidation in web2py, i have a form with few mandatory fields when user submit the form without fillling these fields, an error or alert generated right below every field but when user start typing it still remains untill you submit the form, I want to

[web2py] Re: Pythonanywhere down today?

2013-03-22 Thread Giles Thomas
On Friday, March 22, 2013 4:33:48 AM UTC, Cliff Kachinske wrote: The Python anywhere web site was down earlier today. There was a brief outage at 13:40 UTC on 21 March while we upgraded the system -- is that the downtime you meant? We're not aware of any other outages, but if you saw

[web2py] Re: Doing validation using sqlform grid onupdate or ondelete callbacks

2013-03-22 Thread Jean-Baptiste Fuzier
Thanks, This solution is working fine for the edit part. You gave me a better understanding of the form validation mechanism, thanks. However I think I'm gonna go with luismurciano's approach which seems closer to what I am looking for... Thanks again for your help! Le jeudi 21 mars 2013

[web2py] Re: Doing validation using sqlform grid onupdate or ondelete callbacks

2013-03-22 Thread Jean-Baptiste Fuzier
Thanks, awesome answer ! I think I'm gonna go with the table callback method, I kind of feel safer when doing security checks closer to the DB (maybe I'm wrong...) - For the second solution (Authorization), as I am using a sqlform.grid, I need to provide a query and not rows. So I tried

[web2py] How to exclude some fields from a form for a database record?

2013-03-22 Thread David Ripplinger
I recently found out how to add an additional field to the auth_user table, but then I found that the registration page for a new user has a spot in the form to input a value for the extra field. In many cases, this is desired, but I want this particular field to not appear in the registration

[web2py] send json string to a json service

2013-03-22 Thread frasse
Hi I try to send a json string to a json service but I am geting invalid request all the time. The echo service is works with normal string. do you have any idea Thanks /F @service.json def echo(data): echo test return data My client things = [hi,ho] url =

[web2py] Re: record representation format that refer to another table and that table is refer to another table

2013-03-22 Thread Anthony
Sorry, wasn't thinking -- the validator is selecting a record from the room table, not the booking table, so you'll need a slightly different function for that: IS_IN_DB(..., label=lambda r: '%s %s' % (r.branch.address, r.room_no)) or if want to use a single function (not tested): def

[web2py] Retrieve existing cache values

2013-03-22 Thread villas
1. How can I view a currently cached value, without any possibility of changing it? 2. Say I have this code: def getvalue(): try: return function_that_may_not_complete() except: return None cache.ram('MyValue', lambda: getvalue(), time_expire=60*60*24) If

[web2py] Re: Retrieve existing cache values

2013-03-22 Thread Niphlod
this is one of the design patterns of the cache in web2py that makes a little more cumbersome than others cache interface to understand ... assuming you're using cache.ram, when you do cache.ram(key, value, 60) for the first time what you're really doing is store value, tag it with key and 60

[web2py] Re: Retrieve existing cache values

2013-03-22 Thread Anthony
Maybe this would work: cache.ram('MyValue', lambda: getvalue() or cache.ram('MyValue', lambda: None,time_expire =None), time_expire=60*60*24) Calling cache.ram() with time_expire=None always retrieves the currently stored value, so you can assign that if getvalue() returns

[web2py] Re: WebFaction

2013-03-22 Thread __pyslan__ - Ayslan Jenken
Eu havia conseguido fazer o admin funcionar, e quando acessei a página da aplicação deu um erro: Traceback (most recent call last): File /home/igrejarama/webapps/rama/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File

[web2py] Re: Retrieve existing cache values

2013-03-22 Thread villas
Niphlod and Anthony, Thanks so much for your comments which have assisted me both to understand and get it working. It seems that I missed the following paragraph in the book: time_expire = None Forces retrieval of the cached value, regardless of the time elapsed since it was saved (if

Re: [web2py] need help with typeahead widget

2013-03-22 Thread Richard Vézina
With the SELECT, better initialisation and no more roundtrip to get the value representation : def autocomplete_typeahead_widget(field, value, referenced_table, represent_field, id_field, controller, **kwargs): table_name = field._tablename field_name = field.name field_requires =

[web2py] Re: send json string to a json service

2013-03-22 Thread Niphlod
you're trying to send a (likely) unparseable string as arg instead of a var. i.e. http://whatever/app/services/call/json/echo/possibly_bogus_characters_not_allowed_in_a_uri first of all make sure that your services.py holds the def call(): session.forget() return service() function

[web2py] Re: How to exclude some fields from a form for a database record?

2013-03-22 Thread Alan Etkin
Do I just need to write a custom form and a custom handler for the post, or is there an easy way to do this? You could set the the readable and writable attributes to False only if the scaffolding registration action is called: if request.function == user and register in request.args:

[web2py] Re: How to get selective update rows from SQLFROM.grid

2013-03-22 Thread Alan Etkin
It returns all the rows which are visible in view. My requirement is that I want to make edit/delete button visible only for the user's whose userid is same as some predefined value SOMEUSER, for other userid's edit/delete button should be disabled/not visible. Can some one please tell me on

[web2py] Re: How to exclude some fields from a form for a database record?

2013-03-22 Thread David Ripplinger
I found a cleaner solution after some digging. In db.py, after creating the auth object, include the line: auth.settings.register_fields = ['id', 'first_name', 'last_name', 'email', 'password'] or if when you created the auth object you passed in username=True, include the line:

[web2py] Problem with legacy db and primarykey

2013-03-22 Thread Raul Monares
I have a MSSQL database with a 4 column primary key: dbcomercial.define_table('libros', Field('bloque',writable=False), Field('grupo',writable=False), Field('sector',writable=False),

[web2py] Re: Retrieve existing cache values

2013-03-22 Thread Derek
So help me out here... I have this code: def saveAddress(): #session.forget(response) houses = None useCached = True if request.post_vars.address: useCached = False newhouse = db.house.insert(address=request.post_vars.address,person

Re: [web2py] Problem with legacy db and primarykey

2013-03-22 Thread Richard Vézina
I don't know legacy primary key web2py feature, but it is strange if your premarykey fields are writable=false how could it be possible to fill those records since they will not be accessible in your form? At the end of the section about legacy table in the book :

Re: [web2py] how keepvalues if the page reload by the form don't even get submit?

2013-03-22 Thread Derek
Why don't you just have a webpage, have the display of current values on top, a single form below for adding items, and submit as you go? On Thursday, March 21, 2013 9:14:05 AM UTC-7, Richard wrote: Hello, I have a bizzard case where I need to set the number of input (more number of rows

[web2py] Re: Retrieve existing cache values

2013-03-22 Thread Niphlod
adding session.forget() just means that you don't need to use session variables in that controller. it has nothing to do with cache Anyway, time_expire=0 means store this item in cache using this key On Friday, March 22, 2013 7:42:58 PM UTC+1, Derek wrote: So help me out here... I have

[web2py] Re: send json string to a json service

2013-03-22 Thread frasse
Thanks . it is working now. Den fredagen den 22:e mars 2013 kl. 13:00:04 UTC+1 skrev frasse: Hi I try to send a json string to a json service but I am geting invalid request all the time. The echo service is works with normal string. do you have any idea Thanks /F @service.json

[web2py] Re: How to exclude some fields from a form for a database record?

2013-03-22 Thread Alan Etkin
A good one. And for you initial requirement which was taking a particular field out of the form (not choosing the whole set of fields that the registration form should show), this is more compact, specially if you are populating the scaffolding auth_user table with custom fields:

[web2py] Help on a web2py query

2013-03-22 Thread Tito Garrido
Folks, How could I implement: SELECT * FROM (SELECT * FROM capitulo WHERE data = CURDATE() ORDER BY data) WHERE encerrada = false GROUP BY c.cod_anothertable Regards, Tito -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- --- You

[web2py] Re: Help on a web2py query

2013-03-22 Thread Niphlod
written as it is, in a view :P we need models, test data and the resultset you want returned, plase ^_^ On Friday, March 22, 2013 11:00:12 PM UTC+1, Tito Garrido wrote: Folks, How could I implement: SELECT * FROM (SELECT * FROM capitulo WHERE data = CURDATE() ORDER BY data) WHERE

Re: [web2py] Re: Help on a web2py query

2013-03-22 Thread Tito Garrido
db.define_table('novela', Field('nome', requires=IS_NOT_EMPTY()), Field('emissora', 'reference emissora', requires = IS_IN_DB(db, db.emissora.id,'%(nome)s')), Field('encerrada', 'boolean', default=False), Field('slug', requires=IS_SLUG()), Field('logo', 'upload',

[web2py] simple loop question

2013-03-22 Thread Alex Glaros
I'm trying to write a simple loop in default.py. What's wrong with this below? Thanks, Alex Glaros def new2(): y=5 while y 0: response.write='Phowdy/P' y=y-1 pass -- --- You received this message because you are subscribed to the Google Groups web2py-users

[web2py] 4 minutes ago

2013-03-22 Thread Ricardo Cárdenas
My google-fu has not helped me come up with an answer... Django has a set of template filters they call humanize which will add a nice touch to data. (Java also has a lib called PrettyTime.) For example it will convert Fri Mar 22, 20:23 into 4 minutes ago, or Fri Mar 21 into yesterday. Is

[web2py] Re: 4 minutes ago

2013-03-22 Thread LightDot
Sure, described here: http://web2py.com/books/default/chapter/29/14#Pretty-dates Regards, Ales On Saturday, March 23, 2013 2:27:32 AM UTC+1, Ricardo Cárdenas wrote: My google-fu has not helped me come up with an answer... Django has a set of template filters they call humanize which will

[web2py] Re: 4 minutes ago

2013-03-22 Thread Ricardo Cárdenas
Got it - thanks. On Friday, March 22, 2013 8:27:32 PM UTC-5, Ricardo Cárdenas wrote: My google-fu has not helped me come up with an answer... Django has a set of template filters they call humanize which will add a nice touch to data. (Java also has a lib called PrettyTime.) For example it

Re: [web2py] how keepvalues if the page reload by the form don't even get submit?

2013-03-22 Thread Richard Vézina
I thougth about something like that, keep adding row and submit row with ajax... Richard On Fri, Mar 22, 2013 at 3:32 PM, Derek sp1d...@gmail.com wrote: Why don't you just have a webpage, have the display of current values on top, a single form below for adding items, and submit as you go?

[web2py] Re: simple loop question

2013-03-22 Thread Anthony
response.write() is a method, not an attribute (even if it were an attribute, you would be overwriting it repeatedly, not appending to it). Anthony On Friday, March 22, 2013 6:51:01 PM UTC-4, Alex Glaros wrote: I'm trying to write a simple loop in default.py. What's wrong with this below?

[web2py] How can I store upload original filename using smartgrid?

2013-03-22 Thread James Burke
I'm having trouble working this one out. I've tried using the example in the book with no success. Model: db.define_table('file', Field('client', 'reference client'), Field('file', type='upload', autodelete=True), Field('filename', 'string'), format='%(file)s') Controller: def

[web2py] Re: record representation format that refer to another table and that table is refer to another table

2013-03-22 Thread 黄祥
very nice, it's work well, thank you so much for your hints, anthony. just want to share the code that you've guide. def format_room(record): return '%s-%s' % (record.branch.address, record.room_no) def format_booking(record): return '%s-%s %s-%s-%s' % (record.scheduled_start,

[web2py] Re: record representation format that refer to another table and that table is refer to another table

2013-03-22 Thread 黄祥
just curious, is it possible to add the format function in the table room? *e.g. 1. no error but the result is not expected* db.define_table('room', Field('room_no'), Field('category', 'list:string'), Field('status', 'list:string'), Field('branch', 'reference branch'),