[web2py] Database fieldname convention

2011-03-07 Thread StUStD
I experience inserting and updating problems (only explicit SQL statements in de dbadmin work, forms don't) with fieldnames like B1x, B1y, B2x, B2y, etc, only to find out that fieldnames with numbers don't work... Is this default behaviour, convention, or caused by a bug? Thanks.

[web2py] Re: Database fieldname convention

2011-03-07 Thread StUStD
I found out, the problem is not in the numeric part of the names, rather, names containing uppercase letters cause the problem. Again, is it convention that database field names should be lowercase? On Mar 7, 9:46 am, StUStD wrote: > I experience inserting and updating problems (only explicit SQL

[web2py] Update_record and validator conflict.

2011-03-07 Thread annet
In db.py I defined the following table: db.define_table('company', Field('name',length=54,default='',notnull=True), Field('CoC_number',length=8), Field('subdossiernumber',length=4,default=''), ... Field(...), migrate=False) db.company.CoC_number.requires=IS_NOT_IN_DB(d

[web2py] Re: IS_NOT_IN_DB () Bypass the capital letters during validation

2011-03-07 Thread Bernd Rothert
Hi Yannick, On 6 Mrz., 20:07, Yannick wrote: > Hello mate, > > A value is saved in the DB as lower case and we put this validation > "IS_NOT_IN_DB()". If for that field the user enter a Capital letter of > the same value saved the application will validate the entry. > > This is not really good.

[web2py] redirection to /default/user/profile

2011-03-07 Thread pk
hi together, i have a problem with a redirection. i will not redirected to this link! in my view i have this: logout my main-controller: @auth.requires_login() def index(): return dict(message="main/index") default-controller: def index(): if auth.is_logged_in(): redirect(URL(r=r

[web2py] Re: Database fieldname convention

2011-03-07 Thread villas
I think it depends on the DB. If you always make your fields lower case in web2py, there is a much better chance they will always work consistently across all DBs. Perhaps not so much a convention, but more 'good practice'. On Mar 7, 9:15 am, StUStD wrote: > I found out, the problem is not in

[web2py] Re: redirection to /default/user/profile

2011-03-07 Thread pk
i need very badly help... thanks On 7 Mrz., 11:59, pk wrote: > hi together, > > i have a problem with a redirection. i will not redirected to this > link! > in my view i have this: logout > > my main-controller: > @auth.requires_login() > def index(): >     return dict(message="main/index") > > d

[web2py] Re: Update_record and validator conflict.

2011-03-07 Thread villas
Hi Annet Seems strange that you are creating a form for a real table by using SQLFORM.factory. Why do that, rather than create a normal form? If you created a normal form, I suspect the issue would be resolved. You don't show the model or validators, so can't comment on those. Regards, D On

[web2py] Re: How to make a simple counter

2011-03-07 Thread minux
Thanks a log pbreit. Your suggested perfectly solved my problem. I fiddled a bit with update_record but had difficulty who to grab the field in database, in order to update it. Since this seem to be a pretty common task (and difficulty for noobs), perhaps It would be good if this example somehow be

[web2py] Re: web2py applications and apache vhosts

2011-03-07 Thread Haros
Thank you for the quick reply Jonathan. It's true that syntax for domain mapping has become very easy and also can be used with different webservers, but I find this way a bit unefficient when it comes to many domains / applications. I would be glad though if anyone could provide some help about

[web2py] web2py recommended web hosting

2011-03-07 Thread Alejandro
Hello everyone, I am new in web2py and I am very impressed by their simplicity and capabilities. I would like to know which is the best/recommended web hosting to run web2py. Thanks, Alejandro

[web2py] Re: DAL new syntax RFC

2011-03-07 Thread kenji4569
Other alternatives might be: Field('name', **Field.readonly)? Field('name').readonly()? though I appreciate explicit is better than implicit. On 3月6日, 午前9:49, Michele Comitini wrote: > +1 > > 2011/3/6 Thadeus Burgess : > > > > > > > > > Explicit is better than implicit. Typing is cheap. Design

[web2py] Re: Database fieldname convention

2011-03-07 Thread Kevin Ivarsen
Hello, I recently ran into this problem as well - field names with uppercase characters were ignored in SQLFORM inserts/updates. Luckily, I found that the behavior is fixed in the latest 1.93.2 release of web2py. Try upgrading and see if that solves the problem. Kevin On Mar 7, 4:15 am, StUStD

[web2py] Re: web2py recommended web hosting

2011-03-07 Thread Anthony
You should be able to host web2py apps just about anywhere you can run Python, including many shared hosts. For VPS/dedicated hosting, I think a common setup is Ubuntu and Apache. See the book for deployment instructions (http://web2py.com/book/default/chapter/11), including pointers to some on

[web2py] NameError: global name 'db' is not defined

2011-03-07 Thread Johann Spies
I want to run a script in the commandline shell to insert records into the database, but have a problem handling the namespace. When I try to run it with the '%run' option or do a 'from

[web2py] Re: redirection to /default/user/profile

2011-03-07 Thread pk
nobody? On 7 Mrz., 13:22, pk wrote: > i need very badly help... > thanks > > On 7 Mrz., 11:59, pk wrote: > > > > > > > > > hi together, > > > i have a problem with a redirection. i will not redirected to this > > link! > > in my view i have this: logout > > > my main-controller: > > @auth.requir

[web2py] Re: NameError: global name 'db' is not defined

2011-03-07 Thread Anthony
When you import a module, I don't think it's functions see the web2py globals. You probably have to explicitly pass db as an argument to the function you're calling in your module. On Monday, March 7, 2011 8:53:37 AM UTC-5, spyker wrote: > I want to run a script in the commandline shell to inse

[web2py] Re: Update_record and validator conflict.

2011-03-07 Thread annet
Hi David, This is the relevant part of the model file, table definition: db.define_table('company', Field('name',length=54,default='',notnull=True), Field('CoC_number',length=8), Field('subdossiernumber',length=4,default=''), ... Field(...), migrate=False) ... and the

Re: [web2py] web2py recommended web hosting

2011-03-07 Thread rochacbruno
For shared hosts. The best, easiest and with a nice cost is webfaction.com Em 07/03/2011, às 06:12, Alejandro escreveu: > Hello everyone, > > I am new in web2py and I am very impressed by their simplicity and > capabilities. > I would like to know which is the best/recommended web hosting to

[web2py] Re: how to check if form is submitted?

2011-03-07 Thread Iceberg
On Mar 7, 1:33 am, LightOfMooN wrote: > I try to process , but can't check, if > form with that checkbox is submitted. > > How to check if form is submitted? As long as your form is submitted into your own web server, a new line of log appears in the log file or console. Isn't that your case?

Re: [web2py] Re: web2py applications and apache vhosts

2011-03-07 Thread Jonathan Lundell
On Mar 6, 2011, at 3:57 PM, Haros wrote: > > Thank you for the quick reply Jonathan. > > It's true that syntax for domain mapping has become very easy and also > can be used with different webservers, but I find this way a bit > unefficient when it comes to many domains / applications. > > I wou

[web2py] Basic authentication user id

2011-03-07 Thread Alexei Vinidiktov
Hello, When I do basic authentication to a web2py app from a *desktop* app (tried two test apps I wrote in Python and REALbasic) I can get the user's first name and last name from the web app, but I can't get his/her id. @service.xmlrpc @service.jsonrpc def getUserName(): return str(auth.user

Re: [web2py] Basic authentication user id

2011-03-07 Thread Jonathan Lundell
On Mar 7, 2011, at 7:51 AM, Alexei Vinidiktov wrote: > When I do basic authentication to a web2py app from a *desktop* app (tried > two test apps I wrote in Python and REALbasic) I can get the user's first > name and last name from the web app, but I can't get his/her id. > > @service.xmlrpc

Re: [web2py] Basic authentication user id

2011-03-07 Thread Alexei Vinidiktov
On Mon, Mar 7, 2011 at 10:16 PM, Jonathan Lundell wrote: > On Mar 7, 2011, at 7:51 AM, Alexei Vinidiktov wrote: > > When I do basic authentication to a web2py app from a *desktop* app > (tried two test apps I wrote in Python and REALbasic) I can get the user's > first name and last name from the w

Re: [web2py] Basic authentication user id

2011-03-07 Thread ron_m
In the file gluon/tools.py line 808 in trunk the Auth class __init__ method you will find these lines if auth and auth.last_visit and auth.last_visit\ + datetime.timedelta(days=0, seconds=auth.expiration)\ > request.now: self.user = auth.user

Re: [web2py] Basic authentication user id

2011-03-07 Thread Jonathan Lundell
On Mar 7, 2011, at 8:54 AM, ron_m wrote: > In the file gluon/tools.py line 808 in trunk the Auth class __init__ method > you will find these lines > > if auth and auth.last_visit and auth.last_visit\ > + datetime.timedelta(days=0, seconds=auth.expiration)\ > > re

Re: [web2py] Basic authentication user id

2011-03-07 Thread ron_m
I am guessing some more because I didn't trace the code but I think auth.user eventually gets set in login_bare without setting auth.user_id but then do standalone apps actually login? I could only find 3 places where self.user_id is used in the class, the 2 places in the if else and as a test t

[web2py] Re: bug? - boolean field automatically toggles in forms when validation fails

2011-03-07 Thread Carlos
Hi Massimo, This has been fixed in latest stable 1.93.2. Thanks!, Carlos

Re: [web2py] Basic authentication user id

2011-03-07 Thread Jonathan Lundell
On Mar 7, 2011, at 9:23 AM, ron_m wrote: > I am guessing some more because I didn't trace the code but I think auth.user > eventually gets set in login_bare without setting auth.user_id but then do > standalone apps actually login? > I could only find 3 places where self.user_id is used in the cl

[web2py] Re: redirection to /default/user/profile

2011-03-07 Thread pbreit
I think the URL tag should be: URL(c='default', f='user', args=['logout']) It's not really clear to me what you are trying to do. I would strongly suggest just using Web2py's built-in register/login/logout functionality. If you are just starting out, I would advise creating a new application in

Re: [web2py] web2py recommended web hosting

2011-03-07 Thread contatogilson...@gmail.com
I recommend webfaction. _ *Gilson Filho* *Web Developer http://gilsondev.com* 2011/3/7 rochacbruno > For shared hosts. The best, easiest and with a nice cost is webfaction.com > > > Em 07/03/2011, às 06:12, Alejandro escreveu: > > > Hello everyone,

[web2py] Re: Update_record and validator conflict.

2011-03-07 Thread DenesL
Hi Annet, when you use SQLFORM to update a record you supply the record or the record id, so web2py can retrieve it for you. The IS_NOT_IN_DB validator checks against the record id so updates don't get a validation error. Since SQLFORM.factory does not allow you to supply the record or record id

[web2py] Re: how to check if form is submitted?

2011-03-07 Thread LightOfMooN
No. I need to know when the form is submitted to make some process. For example if i have form with and some inputs for data, I can process it in controller with checking form submitting like that: mycontroller_function(): if request.vars.mysubmit: do something but if I want to subm

[web2py] Re: web2py recommended web hosting

2011-03-07 Thread Kevin Ivarsen
I recently had a good experience deploying a web2py website with a VPS on hostgator.com. During peak periods we had several dozen simultaneous users hitting the site, and everything remained speedy and responsive. We used MySQL and Apache with mod_wsgi to deploy. Kevin On Mar 7, 4:12 am, Alejandr

[web2py] Image serving performance

2011-03-07 Thread pbreit
I saw over on web2py-developers that Bruno raised a question about image serving performance through the "download" function. I was curious about this myself as my app will be serving an excessive amount of imagery. I was surprised that images weren't just served statically. What exactly would I

[web2py] Re: web2py recommended web hosting

2011-03-07 Thread pbreit
My only advice is that if you are struggling to get web2py running on your host, don't fight it, switch. Webfaction comes up a lot as a great provider. If you are at all thinking about cloud, I say "go for it". Amazon, RackSpace and Linode are great options.

Re: [web2py] Image serving performance

2011-03-07 Thread rochacbruno
I know there is a way to config apache for serve static/* but I did not find how to do it in webfaction yet. But certainly putting images under static is much faster than download function. Em 07/03/2011, às 16:36, pbreit escreveu: > I saw over on web2py-developers that Bruno raised a quest

[web2py] web2py and ispcp (or any other contol panel)

2011-03-07 Thread Haros
Hello, I am trying to make web2py work with ispcp but I fail. Google doesn't provide any tutorial or hint and I guess it's beyond my knowledge to make it work without help... So, is there anyone that made web2py work with ispcp? I could also accept web2py with webmin but there is not much info fo

Re: [web2py] Image serving performance

2011-03-07 Thread pbreit
Do you know what functionality the download function provides beyond serving and authentication?

[web2py] ProgrammingError: Cannot operate on a closed database

2011-03-07 Thread Ross Peoples
Updated to R-1.32.2 from trunk this morning. Ran into this error a few times today: ProgrammingError: Cannot operate on a closed database. I don't know if it's because of a bug introduced in the release or if my ajax is killing it. I just start playing with submitting ajax forms and right after

[web2py] 1.93.2 broken update_record!

2011-03-07 Thread Clayton
sess.update_record(lockedby=request.vars.client) used to set the field "lockedby" in the database to the value of request.vars.client As of 1.93.2, it sets the field "lockedby" to the value "lockedby" (the string!). This is with sqlite. Crashes my app. Was I using it wrong to begin with? Clayton

[web2py] Re: 1.93.2 broken update_record!

2011-03-07 Thread Clayton
Issue 210: Typo in gluon.dal.update_record Patched it manually to get my app up and running. This breaks a lot of apps; how soon can a new release get out? Clayton On Mar 7, 4:11 pm, Clayton wrote: > sess.update_record(lockedby=request.vars.client) used to set the field > "lockedby" in th

[web2py] Re: how to check if form is submitted?

2011-03-07 Thread DenesL
Any submit sends the form to the controller. Can you post the exact code?. On Mar 7, 2:12 pm, LightOfMooN wrote: > No. I need to know when the form is submitted to make some process. > > For example if i have form with > and some inputs for data, I can process it in controller with checking >

[web2py] some functionality to mix html and {{python expression}} is broken since 1.92.3, even back to 1.91.6

2011-03-07 Thread dlypka
The following worked in 1.77.3 but not in 1.91.6 and not in 1.92.3 {{level0result = DIV()}} {{for row in sortedfolderlist:}} {{ myrow = row[1]}} {{ myli = LI(A(myrow['strRegionNameRendered'], _href="#") }} {{ level0result.append(myli)}} {{pass}} {{=level0result}} This gets an error: Traceba

[web2py] Re: how to check if form is submitted?

2011-03-07 Thread LightOfMooN
I need to check value of this checkbox in controller only when user click on it and do smth (for example, session.helloworld=True if it's checked and False if not) But I can't check if form is submitted, because if it is and checkbox isn't checked, "if request.vars.helloworld" returns False

[web2py] XML() object in html.py breaks ajax callback which needs HTML returned.

2011-03-07 Thread dlypka
Ever since web2py 1.91.6 I have had to patch html.py to avoid this exception when my code tries to do an ajax callback to get some HTML: Traceback (most recent call last): File "c:\Google\AppEngine\esentrnet\gluon\restricted.py", line 188, in restricted exec ccode in environment File "c:\G

[web2py] maintaining references while importing records from multiple tables

2011-03-07 Thread Philip
I am importing data into an existing web2py application. The tables are connected - I'll pretend for the moment that they are the owners and dogs tables from the web2py book. I used the shell and typed in the following commands (based on an example previously posted by Massimo): map = {} db.owne

[web2py] Re: DAL new syntax RFC

2011-03-07 Thread Massimo Di Pierro
I am leaning towards r=False,w=False,d='default' as alises for readable, writable and default. On Mar 7, 7:36 am, kenji4569 wrote: > Other alternatives might be: > > Field('name', **Field.readonly)? > Field('name').readonly()? > > though I appreciate explicit is better than implicit. > > On 3月6日

[web2py] Re: NameError: global name 'db' is not defined

2011-03-07 Thread Massimo Di Pierro
python web2py.py -M -N -S kb -R script.py On Mar 7, 7:53 am, Johann Spies wrote: > I want to run a script in the commandline shell to insert records into the > database, but have a problem handling the namespace. > > When I try to run it with the '%run' option or do a 'from

[web2py] Re: DAL new syntax RFC

2011-03-07 Thread ron_m
+1

[web2py] Re: redirection to /default/user/profile

2011-03-07 Thread Massimo Di Pierro
Hello pk, I do not fully understand the problem. I understand the code but not your workflow. Can you exaplain what you click on and what you expect and what you get? On Mar 7, 4:59 am, pk wrote: > hi together, > > i have a problem with a redirection. i will not redirected to this > link! > in m

[web2py] Re: web2py and ispcp (or any other contol panel)

2011-03-07 Thread Massimo Di Pierro
I have never used this. Is there a python module for ispcp? On Mar 7, 1:59 pm, Haros wrote: > Hello, > > I am trying to make web2py work with ispcp but I fail. Google doesn't > provide any tutorial or hint and I guess it's beyond my knowledge to > make it work without help... > > So, is there any

Re: [web2py] Re: DAL new syntax RFC

2011-03-07 Thread Luis Díaz
in my humble opinion I think abbreviations are unnecessary. this is ruby on rails remember everyone: the code is read more times than is written. Díaz Luis http://www.facebook.com/diazluis2007 TSU Analisis de Sistemas Universidad de Carabobo Facultad de Odontología

[web2py] Re: web2py recommended web hosting

2011-03-07 Thread Christopher Steel
I like Webfaction a lot. Once you get a handle on the Webfaction vocabulary and setup it is great, before that happens you may find yourself learning how it all works. In the end this is a good thing because you will really understand how things are setup if you ever have an issue, but it the begin

[web2py] Re: web2py recommended web hosting

2011-03-07 Thread Plumo
Unless you need special features I recommend Google App Engine because there is no upfront costs and easy to deploy.

[web2py] How to catch values from CRUD.CREATE and validate?

2011-03-07 Thread Ialejandro
Hi again! Playing again with my hotel booking sys I have a new doubt... I have this model: db.define_table('room', Field('name','string), Field('ubication','string')) db.define_table('booking', Field('room',db.room), Field('host','string')) So I have this controller: def index()

[web2py] Re: some functionality to mix html and {{python expression}} is broken since 1.92.3, even back to 1.91.6

2011-03-07 Thread Brian M
Well you're missing a closing ) in this line - the A() is closed but the LI( is not: {{ myli = LI(A(myrow['strRegionNameRendered'], _href="#") }} Why not simplify your template down a bit - Having your LI's inside a DIV seems a bit odd. {{myUL = UL(_id="dhtmlgoodies_tree", _class="dhtmlgoodie

[web2py] Re: Update_record and validator conflict.

2011-03-07 Thread villas
>           # this is undocumented >           db.company.CoC_number.requires.set_self_id(company[0].id) Denes, Thanks for showing us this! We should have an 'official' method to do this, it is an important feature.

[web2py] DAL shortcuts

2011-03-07 Thread pbreit
Are these three equivalent? db(db.mytable.id==id).select().first() db.mytable[id] db.mytable*(*id*)*

[web2py] Re: DAL shortcuts

2011-03-07 Thread Massimo Di Pierro
On Mar 7, 7:06 pm, pbreit wrote: > Are these three equivalent? > these two are equivalent: db(db.mytable.id==id).select().first() db.mytable(id) This is equivalent db.mytable[id] only if the id exists. The former two return None if id does not exist, the third raises an exception.

Re: [web2py] Re: DAL new syntax RFC

2011-03-07 Thread Michael Barrow
Yeah -- I agree with that! Macros in your editor keep you from typing as much. This is akin to technical folks incessant desire to create new acronyms. Ugh! On Mon, Mar 7, 2011 at 3:30 PM, Luis Díaz wrote: > in my humble opinion > I think abbreviations are unnecessary. > this is ruby on rails >

[web2py] Re: DAL new syntax RFC

2011-03-07 Thread pbreit
If we are evaluating enhancements that save a few keystrokes AND increase clarity, I'd consider this. :-) URL('default/home') for URL(c='default', f='home') or URL('default', 'home')

Re: [web2py] Re: DAL new syntax RFC

2011-03-07 Thread Thadeus Burgess
You can already do URL('default', 'home') It has been in web2py for some months now. -- Thadeus On Mon, Mar 7, 2011 at 9:20 PM, pbreit wrote: > If we are evaluating enhancements that save a few keystrokes AND increase > clarity, I'd consider this. :-) > > URL('default/home') for URL(c

[web2py] Re: DAL tutorial video

2011-03-07 Thread mart
Massimo, this is great! context is everything and nothing like audio to accompany the visual! Thanks for that! :) if possible, would you to see the output of those 200 and some lines to a text file or something? There were a few parts (well, maybe more than a few) in there that I really found int

[web2py] DAL issue with w2p 1.91.6

2011-03-07 Thread Michael Barrow
I'm running v1.91.6 and I try out a simple db.*table*.insert in the shell from the admin application and it works just fine. However, when the exact same code is in one of my controllers, an exception is generated because web2py is trying to cram some hunk of data into a column that's only 512 byte

Re: [web2py] Re: DAL new syntax RFC

2011-03-07 Thread Luis Díaz
"premature optimization is the root of all evil" otherwise I still use: URL (f = 'default ', c = 'home') these characters f =, c = I may write more readable code

[web2py] Re: DAL issue with w2p 1.91.6

2011-03-07 Thread Michael Barrow
To follow up, I turned on query logging in the database and it looks like when the code runs in the controller, it's trying to do an insert for all of the columns in the table and not just the ones I specified in the db.table.insert(). Any suggestions as to where I can track down what's going on he

[web2py] Re: DAL issue with w2p 1.91.6

2011-03-07 Thread pbreit
Can you provide some code for us to look at?

Re: [web2py] Re: DAL new syntax RFC

2011-03-07 Thread pbreit
Yeah, I did also note URL('default', 'home') Sure it's only 3 or 4 chars but I also like the readability of 'default/index' when working on web projects. This is not a big deal, of course.

Re: [web2py] Re: NameError: global name 'db' is not defined

2011-03-07 Thread Johann Spies
On 8 March 2011 01:12, Massimo Di Pierro wrote: > > > python web2py.py -M -N -S kb -R script.py > > Thanks! Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godli

Re: [web2py] Re: DAL issue with w2p 1.91.6

2011-03-07 Thread Michael Barrow
Yeah -- I'm a loser. Sorry about that. I tracked it down to something I had been attempting to use to automatically stamp record creation and modifications. Hindsight being 20/20, I realized that I'd not fully vetted the syntax and was attempting to cram a printed object where it didn't belong. Mea

[web2py] routes on GAE

2011-03-07 Thread Plumo
I have the following listing in routes: ('/robots.txt', '/cms/static/robots.txt') This lets me access /robots.txt on my local computer, but returns "invalid request" when I upload this to GAE. Are there meant to be any differences when using routes on GAE? I can access /cms/static/robots.txt on