Re: [web2py] Re: create new record and update status simultaneously

2011-04-21 Thread Stifan Kristi
thank you so much for your pointer, bruno, it seems onaccept, can't receive
request.vars that been passed during form submit, because when i tried to
replace the request.vars into the value id (1, 2, etc), no errors occured.
did anyone have meet the same problem?

thank you very much before

On Fri, Apr 22, 2011 at 1:29 PM, Bruno Rocha  wrote:

> You can try to set default before the creation of the form, something like:
>
> db.booking.status.default="Booked"
> form = crud.create(db.booking)
>
> --
> Bruno Rocha
> [ About me: http://zerp.ly/rochacbruno ]
>
>
>
> On Fri, Apr 22, 2011 at 2:24 AM, Stifan Kristi <
> steve.van.chris...@gmail.com> wrote:
>
>> a, i c, thank you so much for your pointer anthony, is there any others
>> way to that without using update() or update_record()?
>>
>> thank you very much
>>
>>
>>  On Fri, Apr 22, 2011 at 1:33 AM, Anthony  wrote:
>>
>>> I think onaccept has to be a function.
>>>
>>> On Thursday, April 21, 2011 1:12:24 PM UTC-4, 黄祥 wrote:
>>>
 hi,

 is it possible to create new record and update status simultaneously?
 e.g. update()
 def __add_2():
 form = crud.create(db.booking, next = URL(request.application,
 request.controller, 'index'), onaccept = db.room(db.room.id ==
 request.vars.room_id).update(status = 'Booked'))
 return dict(form = form)

 an error occured said:
 AttributeError: 'NoneType' object has no attribute 'update'

 i've tried another (update_record):
 def __add_2():
 form = crud.create(db.booking, next = URL(request.application,
 request.controller, 'index'), onaccept = db.room(db.room.id ==
 request.vars.room_id).update_record(status = 'Booked'))
 return dict(form = form)

 an error occured said:
 AttributeError: 'NoneType' object has no attribute 'update_record'

 i know i was wrong, but i'm not understand where is my fault code,
 could there anybody give me a pointer and shows me how to fix it?

 thank you so much before
>>>
>>>
>>
>


Re: [web2py] Re: create new record and update status simultaneously

2011-04-21 Thread Bruno Rocha
You can try to set default before the creation of the form, something like:

db.booking.status.default="Booked"
form = crud.create(db.booking)

--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]



On Fri, Apr 22, 2011 at 2:24 AM, Stifan Kristi  wrote:

> a, i c, thank you so much for your pointer anthony, is there any others way
> to that without using update() or update_record()?
>
> thank you very much
>
>
> On Fri, Apr 22, 2011 at 1:33 AM, Anthony  wrote:
>
>> I think onaccept has to be a function.
>>
>> On Thursday, April 21, 2011 1:12:24 PM UTC-4, 黄祥 wrote:
>>
>>> hi,
>>>
>>> is it possible to create new record and update status simultaneously?
>>> e.g. update()
>>> def __add_2():
>>> form = crud.create(db.booking, next = URL(request.application,
>>> request.controller, 'index'), onaccept = db.room(db.room.id ==
>>> request.vars.room_id).update(status = 'Booked'))
>>> return dict(form = form)
>>>
>>> an error occured said:
>>> AttributeError: 'NoneType' object has no attribute 'update'
>>>
>>> i've tried another (update_record):
>>> def __add_2():
>>> form = crud.create(db.booking, next = URL(request.application,
>>> request.controller, 'index'), onaccept = db.room(db.room.id ==
>>> request.vars.room_id).update_record(status = 'Booked'))
>>> return dict(form = form)
>>>
>>> an error occured said:
>>> AttributeError: 'NoneType' object has no attribute 'update_record'
>>>
>>> i know i was wrong, but i'm not understand where is my fault code,
>>> could there anybody give me a pointer and shows me how to fix it?
>>>
>>> thank you so much before
>>
>>
>


Re: [web2py] Re: create new record and update status simultaneously

2011-04-21 Thread Stifan Kristi
a, i c, thank you so much for your pointer anthony, is there any others way
to that without using update() or update_record()?

thank you very much

On Fri, Apr 22, 2011 at 1:33 AM, Anthony  wrote:

> I think onaccept has to be a function.
>
> On Thursday, April 21, 2011 1:12:24 PM UTC-4, 黄祥 wrote:
>
>> hi,
>>
>> is it possible to create new record and update status simultaneously?
>> e.g. update()
>> def __add_2():
>> form = crud.create(db.booking, next = URL(request.application,
>> request.controller, 'index'), onaccept = db.room(db.room.id ==
>> request.vars.room_id).update(status = 'Booked'))
>> return dict(form = form)
>>
>> an error occured said:
>> AttributeError: 'NoneType' object has no attribute 'update'
>>
>> i've tried another (update_record):
>> def __add_2():
>> form = crud.create(db.booking, next = URL(request.application,
>> request.controller, 'index'), onaccept = db.room(db.room.id ==
>> request.vars.room_id).update_record(status = 'Booked'))
>> return dict(form = form)
>>
>> an error occured said:
>> AttributeError: 'NoneType' object has no attribute 'update_record'
>>
>> i know i was wrong, but i'm not understand where is my fault code,
>> could there anybody give me a pointer and shows me how to fix it?
>>
>> thank you so much before
>
>


Re: [web2py] Re: new web2py version

2011-04-21 Thread Bruno Rocha
I got the same error when trying to access the appadmin controller


Traceback (most recent call last):

  File "/home/rochacbruno/Dropbox/cursodepython/web2py/gluon/restricted.py",
line 181, in restricted

exec ccode in environment

  File 
"/home/rochacbruno/Dropbox/cursodepython/web2py/applications/init/controllers/appadmin.py"
, line
11, in 

import gluon.contenttype

  File "/home/rochacbruno/Dropbox/cursodepython/web2py/gluon/custom_import.py",
line 70, in _web2py__import__

locals, fromlist, level)

  File "/home/rochacbruno/Dropbox/cursodepython/web2py/gluon/custom_import.py",
line 46, in _web2py__import__dot

result = result or new_mod.__dict__[name]
KeyError: 'gluon'

--

Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]


[web2py] Re: IS_IN_DB using a dal.Set

2011-04-21 Thread niknok
I still couldn't find out how to do it with IS_IN_DB and a DAL Set.

But using IS_IN_SET works:

mp_list=gdb(gdb.municipality.province==gdb.province.id)\
.select(gdb.municipality.psgc_m,gdb.municipality.name,\

gdb.province.name,orderby=gdb.municipality.name).as_list()
mp_dd2=[(i['municipality']['psgc_m'],\
i['municipality']['name']+' ('+i['province']['name']+')')\
for i in mp_list if i]

Field('muni',requires=IS_IN_SET(mp_dd2,zero='None')


On Apr 22, 11:02 am, niknok  wrote:
> I have a set
>
> mp_list=gdb(gdb.municipality.province==gdb.province.id)
>
> which I'm trying to use it in a select field but causes an error:
>
> Field('municipality',requires=IS_IN_DB(mp_list,'municipality.psgc_m',
>                                         '%(municipality.name)s 
> (%(province.name)s)'))
>
> I'm trying to get it to show in the dropdown like this: municipal_name
> (province_name). How do I format the field names from a set?
>
> I tried and can generate a query of the rows I'd like to have :
>
> mp_list=gdb(gdb.municipality.province==gdb.province.id)\
>                 .select(gdb.municipality.psgc_m,gdb.municipality.name,\
>                         gdb.province.name,orderby=gdb.municipality.name)
> for x in mp_list: print x['municipality']['name']+' 
> ('+x['province']['name']+')'


[web2py] IS_IN_DB using a dal.Set

2011-04-21 Thread niknok
I have a set

mp_list=gdb(gdb.municipality.province==gdb.province.id)


which I'm trying to use it in a select field but causes an error:

Field('municipality',requires=IS_IN_DB(mp_list,'municipality.psgc_m',
'%(municipality.name)s 
(%(province.name)s)'))


I'm trying to get it to show in the dropdown like this: municipal_name
(province_name). How do I format the field names from a set?

I tried and can generate a query of the rows I'd like to have : 

mp_list=gdb(gdb.municipality.province==gdb.province.id)\
.select(gdb.municipality.psgc_m,gdb.municipality.name,\
gdb.province.name,orderby=gdb.municipality.name)
for x in mp_list: print x['municipality']['name']+' ('+x['province']['name']+')'




[web2py] Re: web2py and freelancing services

2011-04-21 Thread Jim Karsten
Looks interesting. Thanks for the link.

On Apr 21, 4:09 pm, Kenneth Lundström 
wrote:
> Hello Jim,
>
> have you looked atwww.experts4solutions.com?
>
> Kenneth
>
>
>
>
>
>
>
> > We are looking for experienced developers to work on a web2py project.
> > We are considering using a freelancing service like vworker.com
> > (formerly rent-a-coder) or elance. Does anyone have any experience
> > with these companies?
>
> > Jim Karsten


[web2py] Re: IMPROVED: show error tickets directly if you are a authorized web2py admin

2011-04-21 Thread pbreit
Didn't seem like a big improvement to me and feared I'd lose the ability to 
open error in new tab. But it's fine, seems like there's quite a bit of 
interest.

Re: [web2py] Re: new web2py version

2011-04-21 Thread Tito Garrido
In fact it's happening with SQLite too when I try to open the database
administrator.

On Thu, Apr 21, 2011 at 8:59 PM, Tito Garrido  wrote:

> This is what I get when I try to conect to a mysql database:
>
>
> Traceback (most recent call last):
>
>
>   File "/Users/titogarrido/Documents/Projetos/web2py/gluon/restricted.py", 
> line 181, in restricted
>
>
> exec ccode in environment
>
>
>   File 
> "/Users/titogarrido/Documents/Projetos/web2py/applications/bidsite/controllers/appadmin.py"
>  , 
> line 11, in 
>
>
> import gluon.contenttype
>
>
>   File "/Users/titogarrido/Documents/Projetos/web2py/gluon/custom_import.py", 
> line 70, in _web2py__import__
>
>
> locals, fromlist, level)
>
>
>   File "/Users/titogarrido/Documents/Projetos/web2py/gluon/custom_import.py", 
> line 46, in _web2py__import__dot
>
>
> result = result or new_mod.__dict__[name]
>
> KeyError: 'gluon'
>
>
> On Thu, Apr 21, 2011 at 8:40 PM, ron_m  wrote:
>
>> I ran my application and did not see any problems. I am over a PostgreSQL
>> database. I likely did not exercise any new features, I have not touched the
>> code in a week or more - working on other things right now.
>>
>
>
>
> --
>
> Linux User #387870
> .
>  _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:___
>



-- 

Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___


Re: [web2py] Re: new web2py version

2011-04-21 Thread Tito Garrido
This is what I get when I try to conect to a mysql database:


Traceback (most recent call last):

  File "/Users/titogarrido/Documents/Projetos/web2py/gluon/restricted.py",
line 181, in restricted

exec ccode in environment

  File 
"/Users/titogarrido/Documents/Projetos/web2py/applications/bidsite/controllers/appadmin.py"
,
line 11, in 

import gluon.contenttype

  File "/Users/titogarrido/Documents/Projetos/web2py/gluon/custom_import.py",
line 70, in _web2py__import__

locals, fromlist, level)

  File "/Users/titogarrido/Documents/Projetos/web2py/gluon/custom_import.py",
line 46, in _web2py__import__dot

result = result or new_mod.__dict__[name]
KeyError: 'gluon'


On Thu, Apr 21, 2011 at 8:40 PM, ron_m  wrote:

> I ran my application and did not see any problems. I am over a PostgreSQL
> database. I likely did not exercise any new features, I have not touched the
> code in a week or more - working on other things right now.
>



-- 

Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___


[web2py] Re: new web2py version

2011-04-21 Thread ron_m
I ran my application and did not see any problems. I am over a PostgreSQL 
database. I likely did not exercise any new features, I have not touched the 
code in a week or more - working on other things right now.


[web2py] Re: Appengine, inbound mail & code placement...

2011-04-21 Thread Massimo Di Pierro
This is really useful. Thanks for sharing. Would you add a
web2pyslice.com

On Apr 21, 4:52 pm, mattynoce  wrote:
> just as a follow-up here, i got this to work simply using a combination of
> what everyone said. here's what i did:
>
> i added the following to my app.yaml above the handlers: section:
>
> inbound_services:
> - mail
>
> under handlers (and for me, below remote_api), i added the following code:
> - url: /_ah/mail/.+
>   script: gaehandler.py
>   login: admin
>
> i then went followed jonathan's advice and copied router.example.py in the
> web2py folder to routes.py, and uncommented (and changed "welcome" to
> "init") the following lines:
>
> routers = dict(
>
>     # base router
>     BASE = dict(
>         default_application = 'init', # used to be 'welcome'
>     ),
> )
>
> i created a table in db.py as such:
>
> db.define_table('email',
>     Field('body', 'string')
>     )
>
> finally, i went to my init/controllers directory, created _ah.py and put
> this inside:
>
> def mail():
>     # more details 
> here:http://code.google.com/appengine/docs/python/mail/receivingmail.html
>     from google.appengine.api.mail import InboundEmailMessage
>
>     message = InboundEmailMessage(request.body)
>     html_bodies = message.bodies('text/html')
>     for content_type, body in html_bodies:
>         decoded_html = body.decode()
>
>     db.email[0] = dict(body=decoded_html)
>
> that's it -- it works, and the body of the email ends up in my db. i hope
> that helps.
>
> matt


[web2py] Re: IMPROVED: show error tickets directly if you are a authorized web2py admin

2011-04-21 Thread Massimo Di Pierro
why the -1?

On Apr 21, 1:04 pm, pbreit  wrote:
> This potentially saves one click and prevents opening the error in a new tab?
>
> -1


[web2py] Re: how to increase font-size in Markmin code highlight ?

2011-04-21 Thread Massimo Di Pierro
Two line break break paragraphs  therefore you should use CSS
to add space between paragraphs.


On Apr 21, 10:04 am, VP  wrote:
> On a related note on MARKMIN syntax.
>
> For images, the code looks like this:  [[title url position size]]
>
> It appears "position" can be "left", "right", or "center".
>
> It turns out what you really want is "middle", and NOT "center".   For
> image alignment, "center" doesn't work.
>
> My additional suggestion for MARKMIN:   2 consecutive lines breaks
> should be converted into a break ()


[web2py] Re: [w2py-dev] Re: Problems related to keeping applications in seperate folder and not in web2py installation.

2011-04-21 Thread Massimo Di Pierro
Are you using trunk or stable?

On Apr 21, 2011, at 1:56 PM, Arun K.Rajeevan wrote:

> btw., If I change line 224 of  cache.py to "folder = folder or 
> os.path.join(os.path.abspath(request.folder), 'cache')"
> I get following error
> OSError: [Errno 2] No such file or directory: 
> '/home/kra/Works/Python/web2py_projects/trunk/applications/powerpack/cache'
> 
> It should be: 
> '/home/kra/Works/Python/web2py_projects/applications/powerpack/cache'
> 
> obviuosly request.folder that's passed in is incorrect and doesn't consider 
> --folder option that I've used.
> 
> -- 
> mail from:GoogleGroups "web2py-developers" mailing list
> make speech: web2py-develop...@googlegroups.com
> unsubscribe: web2py-developers+unsubscr...@googlegroups.com
> details : http://groups.google.com/group/web2py-developers
> the project: http://code.google.com/p/web2py/
> official : http://www.web2py.com/



Re: [web2py] Re: Appengine, inbound mail & code placement...

2011-04-21 Thread mattynoce
just as a follow-up here, i got this to work simply using a combination of 
what everyone said. here's what i did:

i added the following to my app.yaml above the handlers: section:

inbound_services:
- mail

under handlers (and for me, below remote_api), i added the following code:
- url: /_ah/mail/.+ 
  script: gaehandler.py 
  login: admin

i then went followed jonathan's advice and copied router.example.py in the 
web2py folder to routes.py, and uncommented (and changed "welcome" to 
"init") the following lines:

routers = dict(

# base router
BASE = dict(
default_application = 'init', # used to be 'welcome'
),
)

i created a table in db.py as such:

db.define_table('email',
Field('body', 'string')
)

finally, i went to my init/controllers directory, created _ah.py and put 
this inside:

def mail():
# more details here: 
http://code.google.com/appengine/docs/python/mail/receivingmail.html
from google.appengine.api.mail import InboundEmailMessage

message = InboundEmailMessage(request.body)
html_bodies = message.bodies('text/html')
for content_type, body in html_bodies:
decoded_html = body.decode()

db.email[0] = dict(body=decoded_html)

that's it -- it works, and the body of the email ends up in my db. i hope 
that helps.

matt


[web2py] Re: IMPROVED: show error tickets directly if you are a authorized web2py admin

2011-04-21 Thread selecta


On Apr 21, 8:04 pm, pbreit  wrote:
> This potentially saves one click
right not more not less
>and prevents opening the error in a new tab?
why? the link is still there, you can do it if you want to
>
> -1


[web2py] Re: web2py in OS X - Where to put custom applications

2011-04-21 Thread pbreit
Yeah, probably wouldn't hurt to steer more Mac users to source. From the 
Download page, it seems Mac users should download the Mac package.

If you use version control (if you don't, you should!) it's even better to 
clone it from Google code. Then you can easily control your web2py version.


[web2py] Re: web2py and freelancing services

2011-04-21 Thread pbreit
I had good luck with oDesk for a small project.

[web2py] Re: cas_auth.py

2011-04-21 Thread luis diaz
Question:
how to make CAS manage change password for access to my application?.

I ask because the menu:
[login, password]
of my application by clicking on password
one is sent to the home page of the application itself instead of
CAS website

I would like an automatic method similar to the one used to log


Re: [web2py] web2py and freelancing services

2011-04-21 Thread Kenneth Lundström

Hello Jim,

have you looked at www.experts4solutions.com?


Kenneth

We are looking for experienced developers to work on a web2py project.
We are considering using a freelancing service like vworker.com
(formerly rent-a-coder) or elance. Does anyone have any experience
with these companies?

Jim Karsten




[web2py] web2py and freelancing services

2011-04-21 Thread Jim Karsten
We are looking for experienced developers to work on a web2py project.
We are considering using a freelancing service like vworker.com
(formerly rent-a-coder) or elance. Does anyone have any experience
with these companies?

Jim Karsten


[web2py] Re: Problems related to keeping applications in seperate folder and not in web2py installation.

2011-04-21 Thread Arun K.Rajeevan
btw., If I change line 224 of  cache.py to "folder = folder or 
os.path.join(os.path.abspath(request.folder), 'cache')"
I get following error
OSError: [Errno 2] No such file or directory: 
'/home/kra/Works/Python/web2py_projects/trunk/applications/powerpack/cache'

It should be: 
'/home/kra/Works/Python/web2py_projects/applications/powerpack/cache'

obviuosly request.folder that's passed in is incorrect and doesn't consider 
--folder option that I've used.


[web2py] Problems related to keeping applications in seperate folder and not in web2py installation.

2011-04-21 Thread Arun K.Rajeevan
I want to test  Martin Mulone's power pack plug-in.
I can test this in usual way, ie., application is within web2py directory.

But my problem is that I kept all my applications out of web2py installation 
directory.
Now if I run following command, all I get is an error saying "application 
powerpack doesn't exist. want to create(y/n)?" 
and if I say yes it will create an application within application folder 
inside web2py installation directory. 
It never sees the powerpack app within my custom folder where I kept 
applications.  

$> python web2py.py -f /home/kra/Works/Python/web2py_projects -S powerpack 
-M -N -R applications/powerpack/private/groups.py 


If I say no, it gives an error saying that *OSError: [Errno 2] No such file 
or directory: 'applications/powerpack/cache'*, it gives same error even if 
there is a directory "cache"
So I assume it must be the problem with web2py, which doesn't uses 
os.path.abspath()
I had one such issue before I tried different folder set-up, So, please look 
into it. Also I'll try to investigate and fix the problem myself.

For those who're concerned trace-back is included below.

application powerpack does not exist, create (y/n)?n
Traceback (most recent call last):
  File "trunk/web2py.py", line 19, in 
gluon.widget.start(cron=True)
  File "/home/kra/Works/Python/web2py_projects/trunk/gluon/widget.py", line 
804, in start
import_models=options.import_models, startfile=options.run)
  File "/home/kra/Works/Python/web2py_projects/trunk/gluon/shell.py", line 
185, in run
_env = env(a, c=c, import_models=import_models)
  File "/home/kra/Works/Python/web2py_projects/trunk/gluon/shell.py", line 
122, in env
environment = build_environment(request, response, session)
  File "/home/kra/Works/Python/web2py_projects/trunk/gluon/compileapp.py", 
line 228, in build_environment
environment['cache'] = Cache(request)
  File "/home/kra/Works/Python/web2py_projects/trunk/gluon/cache.py", line 
365, in __init__
self.disk = CacheOnDisk(request)
  File "/home/kra/Works/Python/web2py_projects/trunk/gluon/cache.py", line 
227, in __init__
os.mkdir(folder)
OSError: [Errno 2] No such file or directory: 'applications/powerpack/cache'



[web2py] Re: create new record and update status simultaneously

2011-04-21 Thread Anthony
I think onaccept has to be a function.

On Thursday, April 21, 2011 1:12:24 PM UTC-4, 黄祥 wrote:

> hi, 
>
> is it possible to create new record and update status simultaneously? 
> e.g. update() 
> def __add_2(): 
> form = crud.create(db.booking, next = URL(request.application, 
> request.controller, 'index'), onaccept = db.room(db.room.id == 
> request.vars.room_id).update(status = 'Booked')) 
> return dict(form = form) 
>
> an error occured said: 
> AttributeError: 'NoneType' object has no attribute 'update' 
>
> i've tried another (update_record): 
> def __add_2(): 
> form = crud.create(db.booking, next = URL(request.application, 
> request.controller, 'index'), onaccept = db.room(db.room.id == 
> request.vars.room_id).update_record(status = 'Booked')) 
> return dict(form = form) 
>
> an error occured said: 
> AttributeError: 'NoneType' object has no attribute 'update_record' 
>
> i know i was wrong, but i'm not understand where is my fault code, 
> could there anybody give me a pointer and shows me how to fix it? 
>
> thank you so much before



[web2py] Re: web2py in OS X - Where to put custom applications

2011-04-21 Thread Julio Schwarzbeck
Well, isn't this a breathe of fresh air, as pbreit suggested, I
downloaded the source code of web2py, symlinked my custom applications
into web2py's applications and voilá, they are all working locally,
talking about OS portability, I had everything running in 5 min, this
is sweet!

On Apr 21, 11:07 am, Julio Schwarzbeck  wrote:
> Hmm, interesting pbreit, hadn't thought about it, I will probably do
> that also, especially since I'd like to debug the web2py app itself
> (via Wing IDE for example), thanks for the comment!
>
> Julio
>
> On Apr 21, 11:03 am, pbreit  wrote:
>
>
>
> > I just switched from the .app to source and am much happier. But when I ran 
> > off .app, I just put apps in the regular applications folder. Seemed to 
> > work fine for me.


[web2py] Re: web2py in OS X - Where to put custom applications

2011-04-21 Thread Julio Schwarzbeck
Hmm, interesting pbreit, hadn't thought about it, I will probably do
that also, especially since I'd like to debug the web2py app itself
(via Wing IDE for example), thanks for the comment!

Julio

On Apr 21, 11:03 am, pbreit  wrote:
> I just switched from the .app to source and am much happier. But when I ran 
> off .app, I just put apps in the regular applications folder. Seemed to work 
> fine for me.


[web2py] web2py in OS X - Where to put custom applications

2011-04-21 Thread pbreit
I just switched from the .app to source and am much happier. But when I ran off 
.app, I just put apps in the regular applications folder. Seemed to work fine 
for me.


[web2py] Re: IMPROVED: show error tickets directly if you are a authorized web2py admin

2011-04-21 Thread pbreit
This potentially saves one click and prevents opening the error in a new tab?

-1


[web2py] web2py in OS X - Where to put custom applications

2011-04-21 Thread Julio Schwarzbeck
Hi folks,

I am wondering what is the "suggested approach" of placing the custom
applications on an OS X web2py installation. I am a longtime Linux and
OS X user, and I use my Mac for day to day work, and use a VM (Fusion)
with a Linux Image (Fedora) in which I run web2py, mysql, python, etc,
and use my local editor to edit these files "remotely", so far this
has worked fine.

Problem is that debugging is not so straight forward so I am switching
to web2py.app (in OS X) to run the server (and hopefully DAL() will
open my "remote" DB).

My question is, where is the "recommended" place in the filesystem to
put my applications (for developing)?

I wouldn't want to place them directly into my Resources folder in the
app, is a symlink the solution for this?? - what will happen if I
trash the app and update it later?, I will have to re-add the symlink
to find my apps I imagine..

Any suggestions will be very helpful, thanks gang.

Julio


[web2py] Re: IMPROVED: show error tickets directly if you are a authorized web2py admin

2011-04-21 Thread David Marko
+1

[web2py] create new record and update status simultaneously

2011-04-21 Thread 黄祥
hi,

is it possible to create new record and update status simultaneously?
e.g. update()
def __add_2():
form = crud.create(db.booking, next = URL(request.application,
request.controller, 'index'), onaccept = db.room(db.room.id ==
request.vars.room_id).update(status = 'Booked'))
return dict(form = form)

an error occured said:
AttributeError: 'NoneType' object has no attribute 'update'

i've tried another (update_record):
def __add_2():
form = crud.create(db.booking, next = URL(request.application,
request.controller, 'index'), onaccept = db.room(db.room.id ==
request.vars.room_id).update_record(status = 'Booked'))
return dict(form = form)

an error occured said:
AttributeError: 'NoneType' object has no attribute 'update_record'

i know i was wrong, but i'm not understand where is my fault code,
could there anybody give me a pointer and shows me how to fix it?

thank you so much before


[web2py] Re: Can't serialize select result with fields from two or more tables in JSON

2011-04-21 Thread Rafael Sales
By the way, I'm using Ubuntu 10.10 and the current version of Web2Py:
1.94.6

On 21 abr, 13:31, Franzé Jr.  wrote:
> I think so
>
> On Apr 20, 6:09 pm, Rafael Sales  wrote:
>
> > Hello,
> > I'm facing a very tricky error with JSON.
> > I have an action that must return a json object with the results of a
> > select. The select must return fields from two tables. When I use this
> > kind of select return fields from two or more tables, the simple json
> > cannot serialize the result of the select.
> > [Code A] Here's my code:
> > def getDespesasPorHospedagem():
> >     id_locado = request.vars.id_locado
> >     if id_locado == None:
> >         return response.json({'despesas': []})
>
> >     orderBy = db.despesa.id.lower()
> >     query = ((db.despesa.id_locado == id_locado) &
> >              (db.despesa.id_servico == db.servico.id))
> >     despesas = db(query).select(db.despesa.ALL, db.servico.ALL,
> > orderby = orderBy)
>
> >     return response.json({'despesas': despesas})
>
> > Invoking the URL (.../getDespesasPorHospedagem?id_locado=100) throws
> > the following error:http://pastebin.com/PsX8dD4e
> > Changing the return expressions respectively to: "return dict(despesas
> > = [])" and "return dict(despesas = despesas)", the URL above works
> > without any error and shows the result dictionary, but:
> >  - the URL (.../getDespesasPorHospedagem.json?id_locado=100) returns
> > "no json" and
> >  - the URL (.../getDespesasPorHospedagem.xml?id_locado=100) returns
> > the correct XML.
>
> > [Code B]
> > When I change my action as below, which have the same effect for me
> > although less concise, the return object can be serialized
> > successfully. And note that I'm using the same queries:
> > def getDespesasPorHospedagem():
> >     id_locado = request.vars.id_locado
> >     if id_locado == None:
> >         return response.json({'despesas': [], 'servicos': []})
>
> >     orderBy = db.despesa.id.lower()
> >     query = ((db.despesa.id_locado == id_locado) &
> >              (db.despesa.id_servico == db.servico.id))
> >     despesas = db(query).select(db.despesa.ALL, orderby = orderBy)
>
> >     orderBy = db.despesa.id.lower()
> >     query = ((db.despesa.id_locado == id_locado) &
> >              (db.despesa.id_servico == db.servico.id))
> >     servicos = db(query).select(db.servico.ALL, orderby = orderBy)
>
> >     return response.json({'despesas': despesas, 'servicos': servicos})
>
> > So... is this a bug?
> > Rafael Sales
>
>


[web2py] Re: IMPROVED: show error tickets directly if you are a authorized web2py admin

2011-04-21 Thread Arun K.Rajeevan
+1


[web2py] Re: SQLtable customizations + urls

2011-04-21 Thread howesc
how about creating a virtual field that you append only in that 
controller/view?

http://web2py.com/book/default/chapter/06?search=virtual+fields#Virtual-Fields


[web2py] Re: Can't serialize select result with fields from two or more tables in JSON

2011-04-21 Thread Franzé Jr .
I think so

On Apr 20, 6:09 pm, Rafael Sales  wrote:
> Hello,
> I'm facing a very tricky error with JSON.
> I have an action that must return a json object with the results of a
> select. The select must return fields from two tables. When I use this
> kind of select return fields from two or more tables, the simple json
> cannot serialize the result of the select.
> [Code A] Here's my code:
> def getDespesasPorHospedagem():
>     id_locado = request.vars.id_locado
>     if id_locado == None:
>         return response.json({'despesas': []})
>
>     orderBy = db.despesa.id.lower()
>     query = ((db.despesa.id_locado == id_locado) &
>              (db.despesa.id_servico == db.servico.id))
>     despesas = db(query).select(db.despesa.ALL, db.servico.ALL,
> orderby = orderBy)
>
>     return response.json({'despesas': despesas})
>
> Invoking the URL (.../getDespesasPorHospedagem?id_locado=100) throws
> the following error:http://pastebin.com/PsX8dD4e
> Changing the return expressions respectively to: "return dict(despesas
> = [])" and "return dict(despesas = despesas)", the URL above works
> without any error and shows the result dictionary, but:
>  - the URL (.../getDespesasPorHospedagem.json?id_locado=100) returns
> "no json" and
>  - the URL (.../getDespesasPorHospedagem.xml?id_locado=100) returns
> the correct XML.
>
> [Code B]
> When I change my action as below, which have the same effect for me
> although less concise, the return object can be serialized
> successfully. And note that I'm using the same queries:
> def getDespesasPorHospedagem():
>     id_locado = request.vars.id_locado
>     if id_locado == None:
>         return response.json({'despesas': [], 'servicos': []})
>
>     orderBy = db.despesa.id.lower()
>     query = ((db.despesa.id_locado == id_locado) &
>              (db.despesa.id_servico == db.servico.id))
>     despesas = db(query).select(db.despesa.ALL, orderby = orderBy)
>
>     orderBy = db.despesa.id.lower()
>     query = ((db.despesa.id_locado == id_locado) &
>              (db.despesa.id_servico == db.servico.id))
>     servicos = db(query).select(db.servico.ALL, orderby = orderBy)
>
>     return response.json({'despesas': despesas, 'servicos': servicos})
>
> So... is this a bug?
> Rafael Sales


[web2py] Re: Require login for whole application

2011-04-21 Thread Will Stevens
for the record.  i had to change this a bit to get it to work.

i was getting 'too many redirects' when i used this, so i changed it
to this:
(so it did not try to redirect when db.py was processing the 'login'
request)

if auth.user is None and 'login' not in request.args:
  redirect(URL('default', 'user', args='login',
vars={'_next':request.url}))

the 'too many redirects' problem may only show in my setup because I
also have this in routes.py:

routes_in = ((r'/secure-login(?P.*)', r'/myapp/default/user/
login\g'),)
routes_out = ((r'/myapp/default/user/login(?P.*)', r'/secure-
login\g'),)


On Apr 5, 9:40 pm, pbreit  wrote:
> Slight correction:
>
> if auth.user is None:
>     redirect(URL('default','user', args='login'))
>
> And if you want "next" functionality (not tested):
>
> if auth.user is None:
>     redirect(URL('default','user', args='login', vars={'_next': request.url}
> ))


[web2py] Re: MULTIUSER MODE problem

2011-04-21 Thread VP
I have opened an issue.  In fact, I opened a few issues related to
MULTIUSER_MODE.

This mode is quite useful, but I think it needs some work.




On Apr 21, 8:31 am, Massimo Di Pierro 
wrote:
> Please open an issue in google code
>
> On Apr 21, 12:51 am, VP  wrote:
>
>
>
>
>
>
>
> > when a user in MULTIUSER MODE deletes his app, it gets deleted but the
> > link is still there.  I think the appropriate entry in database needs
> > to be removed.


[web2py] Re: how to increase font-size in Markmin code highlight ?

2011-04-21 Thread VP
On a related note on MARKMIN syntax.


For images, the code looks like this:  [[title url position size]]

It appears "position" can be "left", "right", or "center".

It turns out what you really want is "middle", and NOT "center".   For
image alignment, "center" doesn't work.

My additional suggestion for MARKMIN:   2 consecutive lines breaks
should be converted into a break ()


[web2py] Re: how to increase font-size in Markmin code highlight ?

2011-04-21 Thread VP
Massimo:

In my css file, I simply used this:

pre { font-size: 130% !important; }

This will do it; as the code is enclosed within a "pre".  This will
override the font-size and leave the rest of the styling intact.

My suggestion is NOT to specify the font size in CODE (highlight.py).
This makes it a little easier for people to fine tune (I think fewer
people know of !important).





On Apr 20, 8:58 pm, Massimo Di Pierro 
wrote:
> Can you please post an example of your preferred solution?
>
> On Apr 20, 4:29 pm, VP  wrote:
>
>
>
>
>
>
>
> > I got it working by reading the function highlight.py in gluon/
> > highlight.py.
>
> > But the !important thing works better.
>
> > Thank you.
>
> > On Apr 20, 4:06 pm, Anthony  wrote:
>
> > > Maybe trying adding !important after your CSS rule and see if that will
> > > override the hard-coded font style.
>
> > > Anthony
>
> > > On Wednesday, April 20, 2011 4:58:53 PM UTC-4, VP wrote:
> > > > I tried, but I couldn't.  The font-size is hard-coded like this, and I
> > > > just couldn't figure out how to change it in css.  Any idea?  Thanks.
>
> > > > http://www.web2py.com/examples/static/markmin.html
>
> > > > > > something like ````:code_html ,etc...
>
> > > > > > My question, how do I increase the font size of the code enclosed in
> > > > > > `` ... ``:code_html or :code_python?
>
> > > > > > It default font seems to be 11pt (too small for my use case).  I 
> > > > > > can't
> > > > > > change it with css.  Is there are parameter to pass to the function
> > > > > > (CODE) to increase the font size?
>
> > > > > > Thank you.


[web2py] Re: importing gluon to a module in the modules directory

2011-04-21 Thread Omri Har-Shemesh
I thought I tried it before, but apparently I didn't, or I changed something 
because this way seems to work.
It also works if I use import gluon.dal and check for gluon.dal.DAL.

Sorry to have bothered you, but beforehand I got an error saying that gluon 
is not recognized. I'm not so sure what changed exactly. 

Thanks anyway for the help,
Omri


[web2py] Re: importing gluon to a module in the modules directory

2011-04-21 Thread Omri Har-Shemesh
This is stable - I only use the stable version and frequently update using 
the "Update" link.

[web2py] Re: importing gluon to a module in the modules directory

2011-04-21 Thread Anthony
Did you try
 
from gluon.dal import DAL
 

On Thursday, April 21, 2011 10:17:47 AM UTC-4, Omri Har-Shemesh wrote:

> Hello, 
>
> I'm writing a module to contain some class definitions I need for my 
> application's business logic and I would like to access gluon from my 
> module. 
> I placed my module inside the modules directory and import it using 
> local_import. I want to have the classes in the module access the database 
> (which I managed by passing the db DAL instance to the classe's 
> constructor), but I would like to be able to check that the expected DAL 
> object is transferred during construction of the object. To that end I would 
> like to write something like:
>
> if isinstance(db, gluon.dal.DAL) 
>
> or just 
>
> if isinstance(db,DAL).
>
> I have tried to import web2py in the usual way (import web2py) - and it 
> raised an exception - TclError: image "pyimage2" doesn't exist.
>
> and opened a white triangular window without any borders that will not go 
> away unless I close the web2py application. It does the same when I try to 
> import only web2py.gluon.dal.
>
> I'm running on Ubuntu 10.10 with web2py version 1.94.6.
>
> Thanks,
> Omri
>
>

[web2py] Re: importing gluon to a module in the modules directory

2011-04-21 Thread Massimo Di Pierro
Is this trunk or stable? Because we are testing a new import
mechanism, although I do not know that is the cause of the problem.

On Apr 21, 9:17 am, Omri Har-Shemesh  wrote:
> Hello,
>
> I'm writing a module to contain some class definitions I need for my
> application's business logic and I would like to access gluon from my
> module.
> I placed my module inside the modules directory and import it using
> local_import. I want to have the classes in the module access the database
> (which I managed by passing the db DAL instance to the classe's
> constructor), but I would like to be able to check that the expected DAL
> object is transferred during construction of the object. To that end I would
> like to write something like:
>
> if isinstance(db, gluon.dal.DAL)
>
> or just
>
> if isinstance(db,DAL).
>
> I have tried to import web2py in the usual way (import web2py) - and it
> raised an exception - TclError: image "pyimage2" doesn't exist.
>
> and opened a white triangular window without any borders that will not go
> away unless I close the web2py application. It does the same when I try to
> import only web2py.gluon.dal.
>
> I'm running on Ubuntu 10.10 with web2py version 1.94.6.
>
> Thanks,
> Omri


[web2py] importing gluon to a module in the modules directory

2011-04-21 Thread Omri Har-Shemesh
Hello,

I'm writing a module to contain some class definitions I need for my 
application's business logic and I would like to access gluon from my 
module. 
I placed my module inside the modules directory and import it using 
local_import. I want to have the classes in the module access the database 
(which I managed by passing the db DAL instance to the classe's 
constructor), but I would like to be able to check that the expected DAL 
object is transferred during construction of the object. To that end I would 
like to write something like:

if isinstance(db, gluon.dal.DAL) 

or just 

if isinstance(db,DAL).

I have tried to import web2py in the usual way (import web2py) - and it 
raised an exception - TclError: image "pyimage2" doesn't exist.

and opened a white triangular window without any borders that will not go 
away unless I close the web2py application. It does the same when I try to 
import only web2py.gluon.dal.

I'm running on Ubuntu 10.10 with web2py version 1.94.6.

Thanks,
Omri



[web2py] Re: custom error ticket message

2011-04-21 Thread selecta
i dont think this would help since the issue tracker should be a
plugin
as a plugin it can only provide files and folders starting with
plugin_
:(

On Apr 21, 3:59 pm, Anthony  wrote:
> Would it help to use app-specific routes (i.e., put a routes.py file in the
> application folder)?
>
>
>
> On Thursday, April 21, 2011 9:37:33 AM UTC-4, selecta wrote:
> > that is not so nice, it would be a lot better if i could define the
> > error message in my application
> > the reason is that i created an issue tracker plugin that should
> > directly be displayed with the error message
> > however since this is a plugin it may not be available in every
> > application, also the plugin should not have to modify routes to work
> > can this be fixed?
>
> > On Apr 21, 3:07 pm, Anthony  wrote:
> > > I think you should be able to specify that in routes.py, as explained
> > here:http://web2py.com/book/default/chapter/04#Routes-on-Error
>
> > > On Thursday, April 21, 2011 5:44:26 AM UTC-4, selecta wrote:
> > > > I found that in rewrite.py
> > > > def _params_default(app=None):
> > > > there is
> > > >    p.error_message_ticket = ...
>
> > > > Is there a way to customise/overwrite this error messag in my
> > > > application?
> > > > or do i have to edit rewrite.py to customize it


[web2py] Re: custom error ticket message

2011-04-21 Thread Anthony
Would it help to use app-specific routes (i.e., put a routes.py file in the 
application folder)?

On Thursday, April 21, 2011 9:37:33 AM UTC-4, selecta wrote:

> that is not so nice, it would be a lot better if i could define the 
> error message in my application 
> the reason is that i created an issue tracker plugin that should 
> directly be displayed with the error message 
> however since this is a plugin it may not be available in every 
> application, also the plugin should not have to modify routes to work 
> can this be fixed? 
>
> On Apr 21, 3:07 pm, Anthony  wrote: 
> > I think you should be able to specify that in routes.py, as explained 
> here:http://web2py.com/book/default/chapter/04#Routes-on-Error 
> > 
> > 
> > 
> > On Thursday, April 21, 2011 5:44:26 AM UTC-4, selecta wrote: 
> > > I found that in rewrite.py 
> > > def _params_default(app=None): 
> > > there is 
> > >p.error_message_ticket = ... 
> > 
> > > Is there a way to customise/overwrite this error messag in my 
> > > application? 
> > > or do i have to edit rewrite.py to customize it



[web2py] IMPROVED: show error tickets directly if you are a authorized web2py admin

2011-04-21 Thread selecta
this patch fixes the files needed to show error tickets directly if
you are logged in into the admin app
if not you will only see the old error message, nothing else

http://code.google.com/p/web2py/issues/detail?id=241

massimo, it would be really nice if you could look at this and include
it into web2py as it speeds up the development of web2py applications
alot

this was discussed many times before
http://groups.google.com/group/web2py/browse_thread/thread/a5ce9867336d7193
http://groups.google.com/group/web2py/browse_thread/thread/817ae6e1b1e6baa5
http://groups.google.com/group/web2py/browse_thread/thread/8be17358de52122c
...

this is one step towards a issue tracker that i try to create, another
thing that i would need is here
http://groups.google.com/group/web2py/browse_thread/thread/36de28ac878b7cb4/52365af581f80763#52365af581f80763




[web2py] Re: New here and web2py looks so easy

2011-04-21 Thread Anthony
To view your pages, you have to run web2py (i.e., the web2py built-in 
server) on your local machine. See 
http://web2py.com/book/default/chapter/03#Startup for instructions. Once 
web2py is running, go to 
http://127.0.0.1:8000/yourapp/yourcontroller/yourfunction to view a 
particular page. You can also go to http://127.0.0.1:8000/admin to get to 
the admin interface, and from there you can easily navigate to any of your 
application pages (see 
http://web2py.com/book/default/chapter/03#More-on-admin for more details).
 
Anthony

On Thursday, April 21, 2011 6:54:36 AM UTC-4, Sea water wrote:

> I just got it today and like the look of it. 
>
> I havent figured out how to paste my already written hmtl and css into 
> newly created pages yet but Ill get there. 
>
> The interface looks great and am glad it seems easy. One thing that 
> does get me is how to preview any pages.??? On wp you just press 
> the view site or whatever it is, I was wondering how its done in 
> web2py 
>
> Cheers guys



[web2py] Re: custom error ticket message

2011-04-21 Thread selecta
that is not so nice, it would be a lot better if i could define the
error message in my application
the reason is that i created an issue tracker plugin that should
directly be displayed with the error message
however since this is a plugin it may not be available in every
application, also the plugin should not have to modify routes to work
can this be fixed?

On Apr 21, 3:07 pm, Anthony  wrote:
> I think you should be able to specify that in routes.py, as explained 
> here:http://web2py.com/book/default/chapter/04#Routes-on-Error
>
>
>
> On Thursday, April 21, 2011 5:44:26 AM UTC-4, selecta wrote:
> > I found that in rewrite.py
> > def _params_default(app=None):
> > there is
> >    p.error_message_ticket = ...
>
> > Is there a way to customise/overwrite this error messag in my
> > application?
> > or do i have to edit rewrite.py to customize it


[web2py] New here and web2py looks so easy

2011-04-21 Thread Sea water
I just got it today and like the look of it.

I havent figured out how to paste my already written hmtl and css into
newly created pages yet but Ill get there.

The interface looks great and am glad it seems easy. One thing that
does get me is how to preview any pages.??? On wp you just press
the view site or whatever it is, I was wondering how its done in
web2py

Cheers guys


[web2py] Re: MULTIUSER MODE problem

2011-04-21 Thread Massimo Di Pierro
Please open an issue in google code

On Apr 21, 12:51 am, VP  wrote:
> when a user in MULTIUSER MODE deletes his app, it gets deleted but the
> link is still there.  I think the appropriate entry in database needs
> to be removed.


[web2py] Re: custom error ticket message

2011-04-21 Thread Anthony
I think you should be able to specify that in routes.py, as explained here: 
http://web2py.com/book/default/chapter/04#Routes-on-Error

On Thursday, April 21, 2011 5:44:26 AM UTC-4, selecta wrote:

> I found that in rewrite.py 
> def _params_default(app=None): 
> there is 
>p.error_message_ticket = ... 
>
> Is there a way to customise/overwrite this error messag in my 
> application? 
> or do i have to edit rewrite.py to customize it



Re: [web2py] Re: Web2py & GAE integration

2011-04-21 Thread Ahmed Sharkawy
*We solve the problem*
*by downloading the file from the web2py project page in google code and it
contain more files and I think it was the problem*
*
*
*also configuration file as mentioned in the book*
*gaehandler *
***app,yaml*
*
*
*thanks for your help*
*
*
On 27 March 2011 17:52:16 UTC+3, Jonathan Lundell wrote:

> On Mar 27, 2011, at 2:08 AM, Mariusz Zieliński wrote:
> >
> > More details would be useful. I'm no expert on deploying on GAE,
> > though I succesfully managed to deploy my first app on GAE
> > yesterday :) I got some problems with app.yaml file as with some rules
> > from example file in skip_files section there were errors, that it
> > couldn't find contrib modules. Other than that deployment went without
> > problems. Also remember to run app on Python 2.5 just like Luther
> > wrote as that's version which GAE uses currently.
>
> Which contrib modules did you end up needing?
>
> app.example.yaml is configured to upload & run the web2py welcome app, and
> it doesn't upload all of contrib.
>
>
> >
> > On 27 Mar, 01:10, Shark  wrote:
> >> We have troubles in GAE and web2py integration in our graduation
> >> project
> >> We tried many tutorials in the web and we fails so I hope you can help
> >> us with step by step advice
> >>
> >> Ahmed Sharkawy
> >>
> >> 4th year engineering faculty
>
>
>


-- 
Ahmed Sharkawy


Re: [web2py] A question on sitepoint

2011-04-21 Thread Martín Mulone
Powerpack

http://martin.tecnodoc.com.ar/default/post/2011/04/18/12_powerpack-intro

and

http://martin.tecnodoc.com.ar/default/post/2011/04/21/14_installing-powerpack-from-zero

2011/4/21 luckysmack 

> Thought some other more experienced devs might want to chime in:
>
>
> http://www.sitepoint.com/forums/perl-python-other-languages-36/writing-blog-using-web2py-django-752190.html


[web2py] custom error ticket message

2011-04-21 Thread selecta
I found that in rewrite.py
def _params_default(app=None):
there is
   p.error_message_ticket = ...

Is there a way to customise/overwrite this error messag in my
application?
or do i have to edit rewrite.py to customize it


Re: [web2py] Re: OpenID - Best Example

2011-04-21 Thread Jason (spot) Brower

Profit
...
Classic
I too will be using this feature soon in my software.  Thanks for the
pointer.
BR,
Jason

On Wed, Apr 20, 2011 at 8:53 PM, Nite  wrote:

> Well... this turns out to be an easy one to answer *if* you know where
> to look. Unfortunately the abundance of ways to get it done and
> various changes over the years made it harder than it ought to be.
>
> Here's the answer for future reference:
>
> See http://vimeo.com/13485916 - Specifically Time 00:30-00:60
>
> Note that the auth.settings.login_form 'domain=' does not match the
> Janrain Domain which includes the full URL, but rather is only the
> name of the application from when the Janrain account was created
> (this caused me alot of headaches).
>
> Short Version:
> 1. Create janrain account and app
> 2. Uncomment the (4) lines in db.py
> 3. ...
> 4. Profit!
>
> Cheers!
>
> On Apr 10, 2:09 pm, Nite  wrote:
> > Can someone point me to the preferred method/example for using Openid
> > for authentication?
> >
> > There are examples (Web2py Book and elsewhere) that I have tried, but
> > without luck and they appear to implement slightly differently.
> >
> > Perhaps my ignorance on the subject, but if there is a preferred
> > method or place to start I would appreciate the pointer.
> >
> > Kind Regards,
> >
> > -- Nite
>


[web2py] A question on sitepoint

2011-04-21 Thread luckysmack
Thought some other more experienced devs might want to chime in:

http://www.sitepoint.com/forums/perl-python-other-languages-36/writing-blog-using-web2py-django-752190.html