[web2py] Re: uWSGI + Cherokee + web2py - a howto.

2010-04-17 Thread muybay
Thanks for this great guide Ivan, you saved me hours of configuration
time and I learned a lot.

On Mar 2, 1:35 am, Ivan P  wrote:
> Make that rule "^/app/static"
>
> On Mar 2, 1:29 am, Ivan P  wrote:
>
> > Could you elaborate? You want those two rules to point to a static
> > folder?
> > If that is the case, you would probably add a new regex rule with
> > something like "^/app/static$", and add a "static" handler to that
> > rule, and for the handler just pick the directory where the static
> > files are.
>
> > On Feb 27, 1:10 am, Thadeus  wrote:
>
> > > What if I want
>
> > > example.com/app/static
> > > example.com/app2/static
>
> > > What exact rule do I use for this situation?
>
> > > On Feb 24, 12:37 am, GrayMatterComputing 
> > > wrote:
>
> > > > Open theCherokeeAdmin -> General -> Server Permissions. There you
> > > > are :)
>
> > > > Cherokeewill respond in the priority order you have set for the
> > > > virtual servers and behaviors. It will evaluate only the first rule in
> > > > the list that matches. For example, if you had a static content rule
> > > > for the directory "/static" and web2py was the default, a request for
> > > > "example.com/stuff" would pass to web2py, while  "example.com/static/
> > > > stuff" would be evaluated by the static content rule.
>
> > > > On Feb 22, 2:40 pm, Thadeus Burgess  wrote:
>
> > > > > How do you tell what usercherokeegets executed as when the server 
> > > > > boots up?
>
> > > > > In my typical installation I have a generic user account (like
> > > > > "servant") that everything server related exists in this home
> > > > > directory, and it owns everything. With Apache I have to chown/mod the
> > > > > files so that www-data can read them.
>
> > > > > I need to use a user account instead of www-data since mercurial is 
> > > > > involved.
>
> > > > > As far as static file streaming, doescherokeeintercept web2py file 
> > > > > serving?
>
> > > > > Is there a way to tellcherokeeto serve all requests to the "static"
> > > > > folder without even going through web2py?
>
> > > > > -Thadeus
>
> > > > > On Fri, Feb 5, 2010 at 4:45 AM, Ivan P  wrote:
> > > > > > Sorry for the delayed response.
> > > > > > I think that usually means that your permissions are not set. Make
> > > > > > sure thatuwsgiis running under the same user that owns your web2py
> > > > > > directory. The error is unknown cause web2py cannot open the error
> > > > > > file, because it cannot write it to disc.
>
> > > > > > On Jan 27, 3:56 pm, Adi  wrote:
> > > > > >> Hi Ivan,
>
> > > > > >> I followed this howto, and when I try to access the application I 
> > > > > >> get
> > > > > >> an internal error thrown by web2py:
> > > > > >> Ticket issued: unknown
>
> > > > > >> Any idea how to read contents of this ticket to debug?
>
> > > > > >> On Jan 15, 3:14 am, Ivan P  wrote:
>
> > > > > >> > Inspired by Phyo Arkar's howto on setting up web2py 
> > > > > >> > withCherokeeand
> > > > > >> > FCGI I tried the setup, but was somewhat unsatisfied with the 
> > > > > >> > fcgi
> > > > > >> > method and decided to tryuWSGI. I am happy I did so, since it 
> > > > > >> > proved
> > > > > >> > to be real easy anduWSGIis a real powerhouse and deserves 
> > > > > >> > attention
> > > > > >> > of the whole python webdev community. On to the howto.
>
> > > > > >> > I. Compile from source and run the latestuWSGI, 0.9.3 in my case
> > > > > >> > (available herehttp://projects.unbit.it/uwsgi/wiki).
> > > > > >> > 1. Download the source from and unzip.
>
> > > > > >> > 2. To compile you must install packages python-dev and 
> > > > > >> > libxml2-dev (at
> > > > > >> > least thats what they are called on a debian-based system)
>
> > > > > >> > 3. When compiling simply run pick a makefile which matches your 
> > > > > >> > OS and
> > > > > >> > python version and run something like "make -f 
> > > > > >> > Makefile.Linux.Py26".
> > > > > >> > This produces only one executable named uwsgi26, where 26 is my 
> > > > > >> > python
> > > > > >> > version. You can put it in /usr/local/bin.
>
> > > > > >> > 5. To run it, you have two options:
>
> > > > > >> > 5a) Create an xml file and call it, for example, config.xml. Put
> > > > > >> > something like this in it:
> > > > > >> > 
> > > > > >> >     /var/web2py/
> > > > > >> >     
> > > > > >> >     wsgihandler
> > > > > >> >     
> > > > > >> > 
> > > > > >> > In this file "pythonpath" is where your web2py directory is and
> > > > > >> > "script" is the file you want to run, in this case its web2py's
> > > > > >> > "wsgihandler.py". Now runuWSGIlike this, but replace "www-data" 
> > > > > >> > with
> > > > > >> > the owner of your web2py directory, if its the same as your 
> > > > > >> > current
> > > > > >> > user omit the sudo command:
> > > > > >> > sudo -u www-data uwsgi26 -s /tmp/uwsgi.sock -C -x config.xml
> > > > > >> > Why you need to change user is because web2py writes things 
> > > > > >> > (session
> > > > > >> > data for example) to disc during executi

[web2py] Re: cas_auth.py

2010-04-17 Thread mdipierro
I think I broke this when I moved it from mdp.cti.depaul.edu to
web2py.com. I will check tomorrow.

On Apr 17, 10:56 pm, Erik Southworth 
wrote:
> On Mar 4, 11:48 pm, mdipierro  wrote:
>
> > thanks to Gyuris Szabolcs we have a working gluon/contrib/
> > login_methods/cas_auth.py
>
> > Let us know if you give it a try.
>
> > massimo
>
> From the index page: 'register' link action does NOT redirect to CAS
> like the 'login' link action does. Same with
> 'lost_password' (request_reset_password) link.
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: web2py on IDE

2010-04-17 Thread mdipierro
Something that would make easy to move file and plugins across
applications, pack and unpack apps and plugins may also be useful.

On Apr 17, 9:57 pm, Thadeus Burgess  wrote:
> Instead of "Create new file" you can have "Create Controller"/"Create
> Model"/"Create View" etc etc.. And it will just make the file in the
> proper place for that framework.
>
> I would also like to see, for web2py, is to have exec/build mapped to
> F5, but for web2py projects it will launch a single instance of
> web2py, and load up your projects as simlinks to applications folder.
> Using Netbeans, each project I have to include web2py folder and the
> project folder, so I have 10 projects all pointing to the same web2py
> folder, it just seems to be a waist.
>
> --
> Thadeus
>
> On Sat, Apr 17, 2010 at 8:10 PM, Doug Elkin  wrote:
> > Feel free to take these requests with a grain of salt... I know most
> > things with development are easier said than done, but these are just
> > things I'd really like to see:
>
> > When doing tab-completion on web2py functions, I'd like to be able to
> > see any other possible variables that can be passed to the function.
> > There really isn't much documentation on a few of these, and sometimes
> > you have to look up the source code to the function in epydocs to
> > really find out the different possible options.
>
> > Support for the storage class would be awesome.
>
> > As far as the IDE itself goes, a VIM mode would be a final selling
> > point for me.
>
> > On Apr 16, 7:25 pm, Mengu  wrote:
> >> hi all,
>
> >> many of you know that i'm developing a web development IDE that will
> >> support many frameworks including web2py. so i want to hear your ideas
> >> and suggestions for both web2py part and the IDE in general.
>
> >> your sincerely
> >> mengu
>
> >> --
> >> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: web2py on IDE

2010-04-17 Thread Mengu
On 18 Nisan, 04:10, Doug Elkin  wrote:
> Feel free to take these requests with a grain of salt... I know most
> things with development are easier said than done, but these are just
> things I'd really like to see:
>
> When doing tab-completion on web2py functions, I'd like to be able to
> see any other possible variables that can be passed to the function.
> There really isn't much documentation on a few of these, and sometimes
> you have to look up the source code to the function in epydocs to
> really find out the different possible options.
>
> Support for the storage class would be awesome.
>
> As far as the IDE itself goes, a VIM mode would be a final selling
> point for me.
>
> On Apr 16, 7:25 pm, Mengu  wrote:
>

i currently don't know how to do vim mode and never done a research on
this but i will take a look. your other suggestion is a must so i will
include it.



On 18 Nisan, 05:57, Thadeus Burgess  wrote:
> Instead of "Create new file" you can have "Create Controller"/"Create
> Model"/"Create View" etc etc.. And it will just make the file in the
> proper place for that framework.
>
> I would also like to see, for web2py, is to have exec/build mapped to
> F5, but for web2py projects it will launch a single instance of
> web2py, and load up your projects as simlinks to applications folder.
> Using Netbeans, each project I have to include web2py folder and the
> project folder, so I have 10 projects all pointing to the same web2py
> folder, it just seems to be a waist.
>
> --
> Thadeus
>

your first suggestion is already done, see at: http://omploader.org/vNDZ1cQ

all web2py apps are in the main web2py folder/applications. so when
you create a new project, you just select the web2py path and i use
web2py.py to create the new folder. so you don't have to include
anything with my IDE. :)


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: cas_auth.py

2010-04-17 Thread Erik Southworth


On Mar 4, 11:48 pm, mdipierro  wrote:
> thanks to Gyuris Szabolcs we have a working gluon/contrib/
> login_methods/cas_auth.py
>
> Let us know if you give it a try.
>
> massimo

>From the index page: 'register' link action does NOT redirect to CAS
like the 'login' link action does. Same with
'lost_password' (request_reset_password) link.


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: web2py on IDE

2010-04-17 Thread Thadeus Burgess
Instead of "Create new file" you can have "Create Controller"/"Create
Model"/"Create View" etc etc.. And it will just make the file in the
proper place for that framework.

I would also like to see, for web2py, is to have exec/build mapped to
F5, but for web2py projects it will launch a single instance of
web2py, and load up your projects as simlinks to applications folder.
Using Netbeans, each project I have to include web2py folder and the
project folder, so I have 10 projects all pointing to the same web2py
folder, it just seems to be a waist.

--
Thadeus





On Sat, Apr 17, 2010 at 8:10 PM, Doug Elkin  wrote:
> Feel free to take these requests with a grain of salt... I know most
> things with development are easier said than done, but these are just
> things I'd really like to see:
>
> When doing tab-completion on web2py functions, I'd like to be able to
> see any other possible variables that can be passed to the function.
> There really isn't much documentation on a few of these, and sometimes
> you have to look up the source code to the function in epydocs to
> really find out the different possible options.
>
> Support for the storage class would be awesome.
>
> As far as the IDE itself goes, a VIM mode would be a final selling
> point for me.
>
>
> On Apr 16, 7:25 pm, Mengu  wrote:
>> hi all,
>>
>> many of you know that i'm developing a web development IDE that will
>> support many frameworks including web2py. so i want to hear your ideas
>> and suggestions for both web2py part and the IDE in general.
>>
>> your sincerely
>> mengu
>>
>> --
>> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en
>


[web2py] Re: web2py on IDE

2010-04-17 Thread Doug Elkin
Feel free to take these requests with a grain of salt... I know most
things with development are easier said than done, but these are just
things I'd really like to see:

When doing tab-completion on web2py functions, I'd like to be able to
see any other possible variables that can be passed to the function.
There really isn't much documentation on a few of these, and sometimes
you have to look up the source code to the function in epydocs to
really find out the different possible options.

Support for the storage class would be awesome.

As far as the IDE itself goes, a VIM mode would be a final selling
point for me.


On Apr 16, 7:25 pm, Mengu  wrote:
> hi all,
>
> many of you know that i'm developing a web development IDE that will
> support many frameworks including web2py. so i want to hear your ideas
> and suggestions for both web2py part and the IDE in general.
>
> your sincerely
> mengu
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: options.py problem

2010-04-17 Thread Tomas Pelka
Tomas Pelka wrote:
> Still:
> Cannot import config file [options]
> 
> Btw I need to start web2py from script using:
> 
> gluon.widget.start(cron=True)
> 
> Is there any way how to preset options? 

I get it, I have to run directly HttpServer(option here).

Looking in source I can see that
> 
> 647  parser.add_option('-L',
> 648'--config',
> 649dest='config',
> 650default='',
> 651help='config file')
> 
> there is no default config, right?
> 
> Thanks
> 
> mdipierro wrote:
>> Looks like you are not doing anything wrong but test=false is missing
>> from the options file. I changed the source in trunk so that it does
>> not expect options.test
>>
>> Massimo
>>
>> On Apr 16, 5:14 pm, Tomas Pelka  wrote:
>>> Hi all,
>>>
>>> python web2py -L options.py
>>> ends with:
>>>
>>> File "web2py.py", line 20, in 
>>> gluon.widget.start(cron=True)
>>>   File "/home/tom/workspace/pyNetSim/web2py/gluon/widget.py", line 750,
>>> in start
>>> if options.test:
>>> AttributeError: 'module' object has no attribute 'test'
>>>
>>> No -T option specified.
>>>
>>> Options.py looks like:
>>>
>>> import os
>>> ip = '10.8.0.10'
>>> port = 
>>> password = ''
>>> pid_filename = 'httpserver.pid'
>>> log_filename = 'httpserver.log'
>>> profiler_filename = None
>>> ssl_certificate = 'secret/server.crt'
>>> ssl_private_key = 'secret/server.key'
>>> numthreads = 10
>>> server_name = 'NetSim'
>>> request_queue_size = 10
>>> timeout = 10
>>> shutdown_timeout = 5
>>> folder = os.getcwd()
>>> extcron = None
>>> nocron = None
>>>
>>> Am I doing anythin wrong?
>>>
>>> Thanks for answers (web2py 1.76.5).
>>>
>>> --
>>> Tom
>>>
>>> --
>>> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en
> 
> 


-- 
Tom

Key fingerprint = 06C0 23C6 9EB7 0761 9807  65F4 7F6F 7EAB 496B 28AA


[web2py] Re: Jquery Modal with values from

2010-04-17 Thread ChrisM
Sorry if I didn't explain enough. I have a series of messages called
"beats"
(db.beats)
which are displayed on the page in tabulated  elements.
Each beat has fields one of which is user_id.
Within each div is a link that will open the modal which contains the
form with the slider widget.
I want the form to be associated with the correct "beat" so I wish to
pass value of  b.user_id to the form in the modal.
The form will then submit and update a second table.

On Apr 17, 7:56 pm, mdipierro  wrote:
> I am sorry I do not understand. Could you explain the logic first?
> What is the purpose of the modal?
>
> On Apr 17, 6:03 am, ChrisM  wrote:
>
> > Hi,
> > I have web2py return a selection from a controller function i.e.
> > return dict(beats=beats)
> > which I am iterating on a page using:
>
> > I have a jquery Modal dialog which is shown after this click function
> > for each "b":
> > {{for b in beats:}}
> > $('#msemp_{{=b.uuid}}').click(function() {
> > $('#dialog_{{=b.uuid}}').dialog({"autoOpen": "false", "width":
> > "600px"});
> > $('#dialog_{{=b.uuid}}').dialog('open');
> > {{pass}}
>
> > then in body:
>
> > {{for b in beats:}}
> > somestuff
> > {{pass}}
>
> > I have in the jquery  modal dialog form using the slider widget.
>
> > 
> > {{def give_emp(val):
> >   return DIV(
> >     form.custom.begin,
> >     DIV(form.custom.widget.q),
> >     DIV(form.custom.submit),
> >     form.custom.end
> >     )
> > pass}}
>
> > {{=give_emp()}}
> >         just to test uuid value: {{=b.uuid}}
> >         just to test user_id value: {{=b.user_id}} > p>
> > 
>
> > I want to be able to pass values from b.??? (ie. b.user_id) to the
> > jquery modal dialog.
>
> > I have tried web2py ajax function using a callback function from
> > controller but I couldn't get it working and also maybe this would
> > involve too many server requests (GAE?).
>
> > I have also tried callback functions in jquery but couldn't get it to
> > work.
>
> > Maybe there is a simpler approach?
>
> > Any help /ideas most appreciated.
>
> > ChrisM
>
> > --
> > Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] cool html5 stuff

2010-04-17 Thread mdipierro
http://apirocks.com/html5/html5.html#slide39


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Application logging

2010-04-17 Thread Keith Edmunds
What are others doing for application logging? I'm not referring to the
HTTP logs, but program-generated logs.

I've recently been looking at the Python 'logging' module, which I've not
used before. I initiate logging from a file in the 'modules' directory
which does this:


import logging
from logging.handlers import SysLogHandler

logger = logging.getLogger("MyApp")
logger.setLevel(logging.DEBUG)
hdlr = SysLogHandler(address='/dev/log')
formatter = logging.Formatter('tigerpy[%(process)d]: %(levelname)s:
%(filename)s at line %(lineno)d: %(message)s') hdlr.setFormatter(formatter)
logger.addHandler(hdlr)


Then each file that I want to log from does this:


import logging

logger = logging.getLogger("MyApp")
.
.
logger.info("Something interesting happened")


This logs to syslog: the only problem is that each logging message is
written to syslog many (20-40) times(!). This isn't just in one place in
my code, but throughout. I don't think the code is being executed multiple
times, so I'm not sure why I'm getting so many log entries.

So, I'm interested in what others do to log application events.


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: optgroup support

2010-04-17 Thread mdipierro
you must user SELECT and not TAG.SELECT. The former is derived from
INPUT an knows how to process options, tha latter is simply derived
from a DIV and does not.

On Apr 17, 1:08 pm, Iceberg  wrote:
> Hi Denes and/or Massimo,
>
> I just pick up this old post 
> fromhttp://groups.google.com/group/web2py/browse_frm/thread/971433920541935a
>
> I used the code suggested by Denes, e.g. using TAG.SELECT and
> TAG.OPTGROUP.
>
> The code shows proper drop-down box but, after form.accepts(...) the
> form.vars.my_field seems always None.
>
> def test_code():
>     OG=TAG.OPTGROUP
>     g1=[ OPTION( r, _value=r ) for r in [23, 24, 25] ]
>     g2=[ OPTION( r, _value=r ) for r in [32, 33, 34] ]
>     ogs=[OG(_label='30 and under',*g1),OG(_label='over 30',*g2)]
>     sel = TAG.SELECT(_name='person', *ogs) # DO NOT USE
> sel=SELECT(...)
>     form=FORM( sel, INPUT(_type='submit') )
>     if form.accepts(request.vars,keepvalues=True):
>       response.flash = 'got %s' % form.vars.person # Why always got
> none?
>     return dict(form=form)
>
> Question: What need I change to make form.vars.my_field work when
> using TAG.SELECT()?
>
> By the way, in case some people might ask why bother, why not just use
> request.vars.my_field instead, well, it is just my personal best-
> practice because form.vars.my_field usually contains data qualified by
> validators, therefore more precisely than request.vars.my_field. Think
> about this:
>   define_table('my_table',Field('my_field', requires=IS_UPPER()))
>   form = SQLFORM(db.mytable)
> and input "hello world", then
>   request.vars.my_field=="hello world"
> but
>   form.vars.my_field=="HELLO WORLD"
> usually form.vars.my_field contains what I really need.
>
> Regards,
> Iceberg
>
> On Feb18, 12:48am, DenesL  wrote:
>
> > So for future reference:
>
> > you can create OPTGROUPs with TAG.OPTGROUP
> > but do NOT use it with the SELECT helper,
> > you must use TAG.SELECT as in the following example:
>
> > def index():
> >      OG=TAG.OPTGROUP
> >      g1=[ OPTION( r.name, _value=r.id ) for r in
> > db(db.person.age<=30).select() ]
> >      g2=[ OPTION( r.name, _value=r.id ) for r in
> > db(db.person.age>30).select() ]
> >      ogs=[OG(_label='30 and under',*g1),OG(_label='over 30',*g2)]
> >      sel = TAG.SELECT(_name='person', *ogs)
> >      # DO NOT USE sel=SELECT(_name='person',*ogs )
> >      f=FORM( sel )
> >      return dict(f=f)
>
> > Denes.


[web2py] Re: Digest for web2py@googlegroups.com - 25 Messages in 12 Topics

2010-04-17 Thread mdipierro
by web shop. Do you mean a web store? We (actually Yako did) run the
pycon registration for 2009 and 2010. That is kind of a store.

Massimo

On Apr 17, 11:13 am, "Ron K. Jeffries"  wrote:
> Would someone please point me to a web shop site implemented
> using web2py?
>
> Thanks in advance.
> ---
> Ron K. Jeffrieshttp://ronkjeffries.posterous.com
>
> On Sat, Apr 17, 2010 at 08:33,   wrote:
> >   Today's Topic Summary
>
> > Group:http://groups.google.com/group/web2py/topics
>
> > error compiling app [1 Update]
> > compiling apps and reporting errors [1 Update]
> > nightly built [7 Updates]
> > Jquery Modal with values from [1 Update]
> > How to return the resources? [3 Updates]
> > NameError: global name 'formstyle' is not defined [1 Update]
> > _href and src url not rendered [3 Updates]
> > options.py problem [1 Update]
> > web2conf for FLISOL installfest [2 Updates]
> > web2py on IDE [2 Updates]
> > web2py on Kodingen? [1 Update]
> > Presentation of web2py [2 Updates]
>
> >  Topic: error compiling app
>
> > Jonathan Lundell  Apr 17 08:23AM -0700 ^
>
> > On Apr 16, 2010, at 6:47 PM, mdipierro wrote:
>
> >> reponse.layout}} instead. I tried and both work for me (unless the app
> >> is bytecode compiled). If the app is bytecode compiled dynamical
> >> extend and imports are not supported.
>
> > That sounds like what I'm seeing. The failure (traceback below) happens
> > during the compile itself.
>
> > The exception is raised during the eval in parse_template:
>
> > # check whether it extends a layout
> > while 1:
> > match = re_extend.search(text)
> > if not match:
> > break
> > t = os.path.join(path, eval(match.group('name'), context))
> > try:
> > fp = open(t, 'rb')
>
> > Perhaps the eval should be in a try, to make the error reporting a little
> > more explicit? Otherwise it's a little confusing for code that works
> > normally to crash a compile.
>
> >  Topic: compiling apps and reporting errors
>
> > Jonathan Lundell  Apr 17 08:17AM -0700 ^
>
> > On Apr 16, 2010, at 6:39 PM, mdipierro wrote:
>
> >> I think I fixed it in trunk, please let check it.
>
> > It looks right. I'll try to make a test case.
>
> > Two minor things. You added ", e" to the except clause, but e appears to be
> > unused. Is there a reason for it?
>
> > Second, while it makes no difference to the logic, I'd return None instead
> > of False in the normal case, for aesthetic reasons.
>
> >  Topic: nightly built
>
> > mdipierro  Apr 16 10:17PM -0700 ^
>
> > Please check it:
>
> >http://web2py.com/examples/static/nightly/web2py_src.zip
> >http://web2py.com/examples/static/nightly/web2py_win.zip
> >http://web2py.com/examples/static/nightly/web2py_osx.zip
>
> > --
> > Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en
>
> > mdipierro  Apr 16 10:40PM -0700 ^
>
> > Replaced CherryPy with Rocket web server, thanks Tim
> > CacheOnDisk allows to specify a folder
> > IS_DATE/DATETIME can handle any year since 0
> > Field().with_alias, thanks Nathan and Mengu
> > has_membership(group=...,role=...), thank Jonathan
> > db.define_table(username=True), thanks Jonathan
> > gluon.tools.prettydate
> > can specify hostname in routes_out (same syntax as routes in), thanks
> > Martin
> > db.table.bulk_insert([...records...]) now works on GAE, thanks Jon
> > IS_EMAIL validates on 'localhost', thanks Jonathan
> > welcome/views/layout.html uses ez.css, thanks Yarko
> > mail attachments support utf8, thanks szimszon
> > works with PyPy, thanks Joe
> > better Firebird support, thanks Jose
> > better Oracle support, thanks Gabriele
> > cron supports days of week
> > SQLFORM(...,formstyle="table3cols") or "table2cols" or "divs" or "ul"
> > crud.settings.formstyle
> > web2py.py -f folder allows to specify locations of applications,
> > thanks Iceberg
> > better/faster regex in template works in Jython
> > fixed lots of small bugs
>
> > --
> > Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en
>
> > Jason Brower  Apr 17 09:54AM +0300 ^
>
> > Woah nelly. These are cool features!
> > br,
> > Jason
> > On Fri, 2010-04-16 at 22:40 -0700, mdipierro wrote:
>
> > --
> > Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en
>
> > DenesL  Apr 17 04:49AM -0700 ^
>
> > Indeed, thanks fly off to all involved.
> > The readme says 1.77.1, but no official announce?
>
> > --
> > Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en
>
> > Yarko Tymciurak  Apr 17 07:24AM -0700 ^
>
> >> Indeed, thanks fly off to all involved.
> >> The readme says 1.77.1, but no official announce?
>
> > More importantly: there README says 1.77.1, but:
> > - The VERSION file doesn't;
> > - There was no action: hg tag "1.77.1"
> > (I can tell from the .hgtags file)
>
> > Just a reminder.
>
> > - Yarko
>
> > Yarko Tymciurak  Apr 17 07:28AM -0700 ^
>
> > On Apr 17, 9:24 am, Yarko Tymciurak 
> > wrote:
> >> -  There was no action:  hg tag "1.77.1"
> >>    (I can tell from the .hgtags file)
>
> >> Just a reminder.
>

[web2py] Re: error compiling app

2010-04-17 Thread mdipierro
uploading to trunk!

On Apr 17, 10:23 am, Jonathan Lundell  wrote:
> On Apr 16, 2010, at 6:47 PM, mdipierro wrote:
>
> > I am readying your question and my answer again and I said something
> > silly. You should be able to do what you originally proposed
>
> > {{extend request.layout}} although I'd probably do {{extend
> > reponse.layout}} instead. I tried and both work for me (unless the app
> > is bytecode compiled). If the app is bytecode compiled dynamical
> > extend and imports are not supported.
>
> That sounds like what I'm seeing. The failure (traceback below) happens 
> during the compile itself.
>
> The exception is raised during the eval in parse_template:
>
>     # check whether it extends a layout
>     while 1:
>         match = re_extend.search(text)
>         if not match:
>             break
>         t = os.path.join(path, eval(match.group('name'), context))
>         try:
>             fp = open(t, 'rb')
>
> Perhaps the eval should be in a try, to make the error reporting a little 
> more explicit? Otherwise it's a little confusing for code that works normally 
> to crash a compile.
>
>
>
> > Massimo
>
> > On Apr 16, 8:09 pm, Jonathan Lundell  wrote:
> >> On Apr 16, 2010, at 5:13 PM, mdipierro wrote:
>
> >>> Not quite.
>
> >>> {{extend name}} without quote is supported by name has to be a
> >>> variable containing the name of the template. This allows to have
> >>> templates determined dynamically based on user for example.
>
> >> So instead of {{extend request.layout}}, what?
>
> >> Can I do:
>
> >> {{layout = request.layout}}
> >> {{extend layout}}
>
> >> ?
>
> >> Note that {{extend request.layout}} works fine in normal operation. It 
> >> only breaks when I try to compile the app, because request isn't defined 
> >> for the eval().
>
> >>> On Apr 16, 5:24 pm, Jonathan Lundell  wrote:
>  On Apr 16, 2010, at 2:11 PM, Jonathan Lundell wrote:
>
> > I have several questions regarding app compiles, but the first one is 
> > this:
>
> > Error traceback
> > 1.
> > 2.
> > 3.
> > 4.
> > 5.
> > 6.
> > 7.
> > 8.
> > 9.
> > 10.
> > 11.
> > 12.
> > 13.
> > 14.
> > 15.
> > 16.
> > 17.
> > 18.
> > 19.
> > Traceback (most recent call last):
> >   File "/Users/jlundell/VTC/vpeps-web2py/web2py/gluon/restricted.py", 
> > line 173, in restricted
> >     exec ccode in environment
> >   File 
> > "/Users/jlundell/VTC/vpeps-web2py/web2py/applications/admin/controllers/default.py",
> >  line 1061, in 
> >   File "/Users/jlundell/VTC/vpeps-web2py/web2py/gluon/globals.py", line 
> > 96, in 
> >     self._caller = lambda f: f()
> >   File 
> > "/Users/jlundell/VTC/vpeps-web2py/web2py/applications/admin/controllers/default.py",
> >  line 213, in compile_app
> >     c = app_compile(request.args[0], request)
> >   File "/Users/jlundell/VTC/vpeps-web2py/web2py/gluon/admin.py", line 
> > 141, in app_compile
> >     compile_application(folder)
> >   File "/Users/jlundell/VTC/vpeps-web2py/web2py/gluon/compileapp.py", 
> > line 520, in compile_application
> >     compile_views(folder)
> >   File "/Users/jlundell/VTC/vpeps-web2py/web2py/gluon/compileapp.py", 
> > line 293, in compile_views
> >     data = parse_template(file, path)
> >   File "/Users/jlundell/VTC/vpeps-web2py/web2py/gluon/template.py", 
> > line 139, in parse_template
> >     t = os.path.join(path, eval(match.group('name'), context))
> >   File "", line 1, in 
> > NameError: name 'request' is not defined
> > The match in question is presumably {{extend request.layout}}, right?
>
>  OK, that's what I changed. Because I was experimenting with layouts, I 
>  changed {{extend 'layout.html'}} to {{extend request.layout}}, which I 
>  assumed would work because request appears to be defined in views. But 
>  it's not defined in the context of the extend logic's eval().
>
>  It seems like a reasonable thing to be able to do
>
>  --
>  Subscription 
>  settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: Jquery Modal with values from

2010-04-17 Thread mdipierro
I am sorry I do not understand. Could you explain the logic first?
What is the purpose of the modal?

On Apr 17, 6:03 am, ChrisM  wrote:
> Hi,
> I have web2py return a selection from a controller function i.e.
> return dict(beats=beats)
> which I am iterating on a page using:
>
> I have a jquery Modal dialog which is shown after this click function
> for each "b":
> {{for b in beats:}}
> $('#msemp_{{=b.uuid}}').click(function() {
> $('#dialog_{{=b.uuid}}').dialog({"autoOpen": "false", "width":
> "600px"});
> $('#dialog_{{=b.uuid}}').dialog('open');
> {{pass}}
>
> then in body:
>
> {{for b in beats:}}
> somestuff
> {{pass}}
>
> I have in the jquery  modal dialog form using the slider widget.
>
> 
> {{def give_emp(val):
>   return DIV(
>     form.custom.begin,
>     DIV(form.custom.widget.q),
>     DIV(form.custom.submit),
>     form.custom.end
>     )
> pass}}
>
> {{=give_emp()}}
>         just to test uuid value: {{=b.uuid}}
>         just to test user_id value: {{=b.user_id}} p>
> 
>
> I want to be able to pass values from b.??? (ie. b.user_id) to the
> jquery modal dialog.
>
> I have tried web2py ajax function using a callback function from
> controller but I couldn't get it working and also maybe this would
> involve too many server requests (GAE?).
>
> I have also tried callback functions in jquery but couldn't get it to
> work.
>
> Maybe there is a simpler approach?
>
> Any help /ideas most appreciated.
>
> ChrisM
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: compiling apps and reporting errors

2010-04-17 Thread mdipierro
ok

On Apr 17, 10:17 am, Jonathan Lundell  wrote:
> On Apr 16, 2010, at 6:39 PM, mdipierro wrote:
>
> > I think I fixed it in trunk, please let check it.
>
> It looks right. I'll try to make a test case.
>
> Two minor things. You added ", e" to the except clause, but e appears to be 
> unused. Is there a reason for it?
>
> Second, while it makes no difference to the logic, I'd return None instead of 
> False in the normal case, for aesthetic reasons.
>
>
>
> > Massimo
>
> > On Apr 16, 4:15 pm, Jonathan Lundell  wrote:
> >> In admin/default, we have:
>
> >> def compile_app():
> >>     c = app_compile(request.args[0], request)
> >>     if c:
> >>         session.flash = T('application compiled')
> >>     else:
> >>         import traceback
> >>         tb = traceback.format_exc()
> >>         session.flash = DIV(T('Cannot compile: there are errors in your 
> >> app:',CODE(tb)))    
> >>     redirect(URL(r=request, f='site'))
>
> >> It's calling this from gluon/admin:
>
> >> def app_compile(app, request):
> >>     """
> >>     Compiles the application
>
> >>     Parameters
> >>     --
> >>     app:
> >>         application name
> >>     request:
> >>         the global request object
> >>     """
> >>     from compileapp import compile_application, remove_compiled_application
> >>     folder = apath(app, request)
> >>     try:
> >>         compile_application(folder)
> >>         return True
> >>     except (Exception, RestrictedError):
> >>         remove_compiled_application(folder)
> >>         return False
>
> >> However, CODE(tb) appears to be always empty. I believe that's because 
> >> traceback.format_exc() expects to find a traceback buffer on the stack, 
> >> but since app_compile() has returned after catching the exception, the 
> >> exception isn't on the stack any more. I think it's necessary for 
> >> app_compile to return the traceback to the caller.
>
> >> --
> >> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: optgroup support

2010-04-17 Thread Iceberg
Hi Denes and/or Massimo,

I just pick up this old post from 
http://groups.google.com/group/web2py/browse_frm/thread/971433920541935a

I used the code suggested by Denes, e.g. using TAG.SELECT and
TAG.OPTGROUP.

The code shows proper drop-down box but, after form.accepts(...) the
form.vars.my_field seems always None.

def test_code():
OG=TAG.OPTGROUP
g1=[ OPTION( r, _value=r ) for r in [23, 24, 25] ]
g2=[ OPTION( r, _value=r ) for r in [32, 33, 34] ]
ogs=[OG(_label='30 and under',*g1),OG(_label='over 30',*g2)]
sel = TAG.SELECT(_name='person', *ogs) # DO NOT USE
sel=SELECT(...)
form=FORM( sel, INPUT(_type='submit') )
if form.accepts(request.vars,keepvalues=True):
  response.flash = 'got %s' % form.vars.person # Why always got
none?
return dict(form=form)

Question: What need I change to make form.vars.my_field work when
using TAG.SELECT()?

By the way, in case some people might ask why bother, why not just use
request.vars.my_field instead, well, it is just my personal best-
practice because form.vars.my_field usually contains data qualified by
validators, therefore more precisely than request.vars.my_field. Think
about this:
  define_table('my_table',Field('my_field', requires=IS_UPPER()))
  form = SQLFORM(db.mytable)
and input "hello world", then
  request.vars.my_field=="hello world"
but
  form.vars.my_field=="HELLO WORLD"
usually form.vars.my_field contains what I really need.

Regards,
Iceberg

On Feb18, 12:48am, DenesL  wrote:
> So for future reference:
>
> you can create OPTGROUPs with TAG.OPTGROUP
> but do NOT use it with the SELECT helper,
> you must use TAG.SELECT as in the following example:
>
> def index():
>      OG=TAG.OPTGROUP
>      g1=[ OPTION( r.name, _value=r.id ) for r in
> db(db.person.age<=30).select() ]
>      g2=[ OPTION( r.name, _value=r.id ) for r in
> db(db.person.age>30).select() ]
>      ogs=[OG(_label='30 and under',*g1),OG(_label='over 30',*g2)]
>      sel = TAG.SELECT(_name='person', *ogs)
>      # DO NOT USE sel=SELECT(_name='person',*ogs )
>      f=FORM( sel )
>      return dict(f=f)
>
> Denes.




Re: [web2py] Digest for web2py@googlegroups.com - 25 Messages in 12 Topics

2010-04-17 Thread Ron K. Jeffries
Would someone please point me to a web shop site implemented
using web2py?

Thanks in advance.
---
Ron K. Jeffries
http://ronkjeffries.posterous.com









On Sat, Apr 17, 2010 at 08:33,   wrote:
>   Today's Topic Summary
>
> Group: http://groups.google.com/group/web2py/topics
>
> error compiling app [1 Update]
> compiling apps and reporting errors [1 Update]
> nightly built [7 Updates]
> Jquery Modal with values from [1 Update]
> How to return the resources? [3 Updates]
> NameError: global name 'formstyle' is not defined [1 Update]
> _href and src url not rendered [3 Updates]
> options.py problem [1 Update]
> web2conf for FLISOL installfest [2 Updates]
> web2py on IDE [2 Updates]
> web2py on Kodingen? [1 Update]
> Presentation of web2py [2 Updates]
>
>  Topic: error compiling app
>
> Jonathan Lundell  Apr 17 08:23AM -0700 ^
>
> On Apr 16, 2010, at 6:47 PM, mdipierro wrote:
>
>> reponse.layout}} instead. I tried and both work for me (unless the app
>> is bytecode compiled). If the app is bytecode compiled dynamical
>> extend and imports are not supported.
>
> That sounds like what I'm seeing. The failure (traceback below) happens
> during the compile itself.
>
> The exception is raised during the eval in parse_template:
>
> # check whether it extends a layout
> while 1:
> match = re_extend.search(text)
> if not match:
> break
> t = os.path.join(path, eval(match.group('name'), context))
> try:
> fp = open(t, 'rb')
>
>
> Perhaps the eval should be in a try, to make the error reporting a little
> more explicit? Otherwise it's a little confusing for code that works
> normally to crash a compile.
>
>
>
>
>  Topic: compiling apps and reporting errors
>
> Jonathan Lundell  Apr 17 08:17AM -0700 ^
>
> On Apr 16, 2010, at 6:39 PM, mdipierro wrote:
>
>> I think I fixed it in trunk, please let check it.
>
> It looks right. I'll try to make a test case.
>
> Two minor things. You added ", e" to the except clause, but e appears to be
> unused. Is there a reason for it?
>
> Second, while it makes no difference to the logic, I'd return None instead
> of False in the normal case, for aesthetic reasons.
>
>
>
>
>  Topic: nightly built
>
> mdipierro  Apr 16 10:17PM -0700 ^
>
> Please check it:
>
> http://web2py.com/examples/static/nightly/web2py_src.zip
> http://web2py.com/examples/static/nightly/web2py_win.zip
> http://web2py.com/examples/static/nightly/web2py_osx.zip
>
>
> --
> Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en
>
>
>
> mdipierro  Apr 16 10:40PM -0700 ^
>
> Replaced CherryPy with Rocket web server, thanks Tim
> CacheOnDisk allows to specify a folder
> IS_DATE/DATETIME can handle any year since 0
> Field().with_alias, thanks Nathan and Mengu
> has_membership(group=...,role=...), thank Jonathan
> db.define_table(username=True), thanks Jonathan
> gluon.tools.prettydate
> can specify hostname in routes_out (same syntax as routes in), thanks
> Martin
> db.table.bulk_insert([...records...]) now works on GAE, thanks Jon
> IS_EMAIL validates on 'localhost', thanks Jonathan
> welcome/views/layout.html uses ez.css, thanks Yarko
> mail attachments support utf8, thanks szimszon
> works with PyPy, thanks Joe
> better Firebird support, thanks Jose
> better Oracle support, thanks Gabriele
> cron supports days of week
> SQLFORM(...,formstyle="table3cols") or "table2cols" or "divs" or "ul"
> crud.settings.formstyle
> web2py.py -f folder allows to specify locations of applications,
> thanks Iceberg
> better/faster regex in template works in Jython
> fixed lots of small bugs
>
>
> --
> Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en
>
>
>
> Jason Brower  Apr 17 09:54AM +0300 ^
>
> Woah nelly. These are cool features!
> br,
> Jason
> On Fri, 2010-04-16 at 22:40 -0700, mdipierro wrote:
>
> --
> Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en
>
>
>
> DenesL  Apr 17 04:49AM -0700 ^
>
> Indeed, thanks fly off to all involved.
> The readme says 1.77.1, but no official announce?
>
>
> --
> Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en
>
>
>
> Yarko Tymciurak  Apr 17 07:24AM -0700 ^
>
>> Indeed, thanks fly off to all involved.
>> The readme says 1.77.1, but no official announce?
>
> More importantly: there README says 1.77.1, but:
> - The VERSION file doesn't;
> - There was no action: hg tag "1.77.1"
> (I can tell from the .hgtags file)
>
> Just a reminder.
>
> - Yarko
>
>
>
>
>
> Yarko Tymciurak  Apr 17 07:28AM -0700 ^
>
> On Apr 17, 9:24 am, Yarko Tymciurak 
> wrote:
>> -  There was no action:  hg tag "1.77.1"
>>    (I can tell from the .hgtags file)
>
>> Just a reminder.
>
> ... .a reminder, also, to try this build, and report any problems
>
>
>
> mdipierro  Apr 17 07:45AM -0700 ^
>
> I have not tagged it because this is not 1.77.1 yet. The reade shows
> what 1.77.1 will show.
>
> Massimo
>
> On Apr 17, 9:28 am, Yarko Tymciurak 
> wrote:
>
>
>
>  Topic: Jquery Modal with values from
>
> ChrisM  Apr 17 04:03AM -0700 ^

Re: [web2py] Re: error compiling app

2010-04-17 Thread Jonathan Lundell
On Apr 16, 2010, at 6:47 PM, mdipierro wrote:

> I am readying your question and my answer again and I said something
> silly. You should be able to do what you originally proposed
> 
> {{extend request.layout}} although I'd probably do {{extend
> reponse.layout}} instead. I tried and both work for me (unless the app
> is bytecode compiled). If the app is bytecode compiled dynamical
> extend and imports are not supported.

That sounds like what I'm seeing. The failure (traceback below) happens during 
the compile itself.

The exception is raised during the eval in parse_template:

# check whether it extends a layout
while 1:
match = re_extend.search(text)
if not match:
break
t = os.path.join(path, eval(match.group('name'), context))
try:
fp = open(t, 'rb')


Perhaps the eval should be in a try, to make the error reporting a little more 
explicit? Otherwise it's a little confusing for code that works normally to 
crash a compile.

> 
> Massimo
> 
> On Apr 16, 8:09 pm, Jonathan Lundell  wrote:
>> On Apr 16, 2010, at 5:13 PM, mdipierro wrote:
>> 
>>> Not quite.
>> 
>>> {{extend name}} without quote is supported by name has to be a
>>> variable containing the name of the template. This allows to have
>>> templates determined dynamically based on user for example.
>> 
>> So instead of {{extend request.layout}}, what?
>> 
>> Can I do:
>> 
>> {{layout = request.layout}}
>> {{extend layout}}
>> 
>> ?
>> 
>> Note that {{extend request.layout}} works fine in normal operation. It only 
>> breaks when I try to compile the app, because request isn't defined for the 
>> eval().
>> 
>> 
>> 
>>> On Apr 16, 5:24 pm, Jonathan Lundell  wrote:
 On Apr 16, 2010, at 2:11 PM, Jonathan Lundell wrote:
>> 
> I have several questions regarding app compiles, but the first one is 
> this:
>> 
> Error traceback
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> Traceback (most recent call last):
>   File "/Users/jlundell/VTC/vpeps-web2py/web2py/gluon/restricted.py", 
> line 173, in restricted
> exec ccode in environment
>   File 
> "/Users/jlundell/VTC/vpeps-web2py/web2py/applications/admin/controllers/default.py",
>  line 1061, in 
>   File "/Users/jlundell/VTC/vpeps-web2py/web2py/gluon/globals.py", line 
> 96, in 
> self._caller = lambda f: f()
>   File 
> "/Users/jlundell/VTC/vpeps-web2py/web2py/applications/admin/controllers/default.py",
>  line 213, in compile_app
> c = app_compile(request.args[0], request)
>   File "/Users/jlundell/VTC/vpeps-web2py/web2py/gluon/admin.py", line 
> 141, in app_compile
> compile_application(folder)
>   File "/Users/jlundell/VTC/vpeps-web2py/web2py/gluon/compileapp.py", 
> line 520, in compile_application
> compile_views(folder)
>   File "/Users/jlundell/VTC/vpeps-web2py/web2py/gluon/compileapp.py", 
> line 293, in compile_views
> data = parse_template(file, path)
>   File "/Users/jlundell/VTC/vpeps-web2py/web2py/gluon/template.py", line 
> 139, in parse_template
> t = os.path.join(path, eval(match.group('name'), context))
>   File "", line 1, in 
> NameError: name 'request' is not defined
> The match in question is presumably {{extend request.layout}}, right?
>> 
 OK, that's what I changed. Because I was experimenting with layouts, I 
 changed {{extend 'layout.html'}} to {{extend request.layout}}, which I 
 assumed would work because request appears to be defined in views. But 
 it's not defined in the context of the extend logic's eval().
>> 
 It seems like a reasonable thing to be able to do
>> 
 --
 Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en




Re: [web2py] Re: compiling apps and reporting errors

2010-04-17 Thread Jonathan Lundell
On Apr 16, 2010, at 6:39 PM, mdipierro wrote:

> I think I fixed it in trunk, please let check it.

It looks right. I'll try to make a test case.

Two minor things. You added ", e" to the except clause, but e appears to be 
unused. Is there a reason for it?

Second, while it makes no difference to the logic, I'd return None instead of 
False in the normal case, for aesthetic reasons.

> 
> Massimo
> 
> On Apr 16, 4:15 pm, Jonathan Lundell  wrote:
>> In admin/default, we have:
>> 
>> def compile_app():
>> c = app_compile(request.args[0], request)
>> if c:
>> session.flash = T('application compiled')
>> else:
>> import traceback
>> tb = traceback.format_exc()
>> session.flash = DIV(T('Cannot compile: there are errors in your 
>> app:',CODE(tb)))
>> redirect(URL(r=request, f='site'))
>> 
>> It's calling this from gluon/admin:
>> 
>> def app_compile(app, request):
>> """
>> Compiles the application
>> 
>> Parameters
>> --
>> app:
>> application name
>> request:
>> the global request object
>> """
>> from compileapp import compile_application, remove_compiled_application
>> folder = apath(app, request)
>> try:
>> compile_application(folder)
>> return True
>> except (Exception, RestrictedError):
>> remove_compiled_application(folder)
>> return False
>> 
>> However, CODE(tb) appears to be always empty. I believe that's because 
>> traceback.format_exc() expects to find a traceback buffer on the stack, but 
>> since app_compile() has returned after catching the exception, the exception 
>> isn't on the stack any more. I think it's necessary for app_compile to 
>> return the traceback to the caller.
>> 
>> --
>> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en




[web2py] Re: nightly built

2010-04-17 Thread mdipierro
I have not tagged it because this is not 1.77.1 yet. The reade shows
what 1.77.1 will show.

Massimo

On Apr 17, 9:28 am, Yarko Tymciurak 
wrote:
> On Apr 17, 9:24 am, Yarko Tymciurak 
> wrote:
>
> > On Apr 17, 6:49 am, DenesL  wrote:
>
> > > Indeed, thanks fly off to all involved.
> > > The readme says 1.77.1, but no official announce?
>
> > More importantly:   there README says 1.77.1, but:
> > -  The VERSION file doesn't;
> > -  There was no action:  hg tag "1.77.1"
> >    (I can tell from the .hgtags file)
>
> > Just a reminder.
>
> ... .a reminder, also, to try this build, and report any problems
>
>
>
> > - Yarko
>
> > > On Apr 17, 1:54 am, Jason Brower  wrote:
>
> > > > Woah nelly.  These are cool features!
>
> > > --
> > > Subscription 
> > > settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: nightly built

2010-04-17 Thread Yarko Tymciurak
On Apr 17, 9:24 am, Yarko Tymciurak 
wrote:
> On Apr 17, 6:49 am, DenesL  wrote:
>
> > Indeed, thanks fly off to all involved.
> > The readme says 1.77.1, but no official announce?
>
> More importantly:   there README says 1.77.1, but:
> -  The VERSION file doesn't;
> -  There was no action:  hg tag "1.77.1"
>    (I can tell from the .hgtags file)
>
> Just a reminder.

... .a reminder, also, to try this build, and report any problems
>
> - Yarko
>
>
>
> > On Apr 17, 1:54 am, Jason Brower  wrote:
>
> > > Woah nelly.  These are cool features!
>
> > --
> > Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: nightly built

2010-04-17 Thread Yarko Tymciurak
On Apr 17, 6:49 am, DenesL  wrote:
> Indeed, thanks fly off to all involved.
> The readme says 1.77.1, but no official announce?

More importantly:   there README says 1.77.1, but:
-  The VERSION file doesn't;
-  There was no action:  hg tag "1.77.1"
   (I can tell from the .hgtags file)

Just a reminder.

- Yarko


>
> On Apr 17, 1:54 am, Jason Brower  wrote:
>
> > Woah nelly.  These are cool features!
>
> --
> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: nightly built

2010-04-17 Thread DenesL
Indeed, thanks fly off to all involved.
The readme says 1.77.1, but no official announce?

On Apr 17, 1:54 am, Jason Brower  wrote:
> Woah nelly.  These are cool features!


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Jquery Modal with values from

2010-04-17 Thread ChrisM
Hi,
I have web2py return a selection from a controller function i.e.
return dict(beats=beats)
which I am iterating on a page using:

I have a jquery Modal dialog which is shown after this click function
for each "b":
{{for b in beats:}}
$('#msemp_{{=b.uuid}}').click(function() {
$('#dialog_{{=b.uuid}}').dialog({"autoOpen": "false", "width":
"600px"});
$('#dialog_{{=b.uuid}}').dialog('open');
{{pass}}

then in body:

{{for b in beats:}}
somestuff
{{pass}}


I have in the jquery  modal dialog form using the slider widget.


{{def give_emp(val):
  return DIV(
form.custom.begin,
DIV(form.custom.widget.q),
DIV(form.custom.submit),
form.custom.end
)
pass
}}
{{=give_emp()}}
just to test uuid value: {{=b.uuid}}
just to test user_id value: {{=b.user_id}}



I want to be able to pass values from b.??? (ie. b.user_id) to the
jquery modal dialog.

I have tried web2py ajax function using a callback function from
controller but I couldn't get it working and also maybe this would
involve too many server requests (GAE?).

I have also tried callback functions in jquery but couldn't get it to
work.

Maybe there is a simpler approach?

Any help /ideas most appreciated.

ChrisM


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: How to return the resources?

2010-04-17 Thread aabelyakov
Jason, thank you for the important addition...

On 17 апр, 13:07, Jason Brower  wrote:
> To add to the closed topic. (:
> Massimo and I worked over this with PySerial and yeah, having a separate
> program to manage the serial connection is actually VITAL.  Especially
> if your making devices that send important other data.  Have that
> external app just update a file in queue with information, and when you
> need it displayed in the webbrowser you can just make a request for the
> status from that file.
> This is similar to the issues found in a webcam.  You don't make the web
> application take a picture of a file when a webpage requests it as it
> would pile full of requests and errors as everyone is trying to use the
> same device.  With a file, like an image, everyone should have access to
> it very easily.
> In my setup I was dealing with industrial robots, some logic had to be
> done faster than the webbrowser could do it.  So having a "machine
> server" as we call it at work, helps take care of those common logic
> steps so that web2py doesn't worry about it.
> BR,
> Jason Brower
>
>
>
> On Sat, 2010-04-17 at 01:46 -0700, aabelyakov wrote:
> > Yes, this is the right decision!
> > Topic closed.
> > Thanks
>
> > On 16 апр, 17:30, mdipierro  wrote:
> > > I think there is a problem with multithreading because of PySerial.
> > > Pyserial open a post connected to COM and COM is a resource that
> > > cannot be shared. In web2py every request is executed in its own
> > > thread so it is not obvious who open the COM, who closes it and how
> > > conflicts are avoided.
>
> > > Please tell us more of what you are doing. The best solution may be
> > > not to use pyserial in a web2py problem but use it in a single
> > > bachground process that talks to web2py via queued messages.
>
> > > Massimo
>
> > > On Apr 16, 2:13 am, aabelyakov  wrote:
>
> > > > I do not use os.chdir or explicit calls to thread module.
> > > > I'm using PySerial and after the error COM port remains open.
> > > > To close it, I restart the web server.
> > > > How to avoid this?
>
> > > > On 15 ÁÐÒ, 22:46, mdipierro  wrote:
>
> > > > > Do you use os.chdir or explicit calls to the thread module in your
> > > > > code?
>
> > > > > On Apr 15, 12:15špm, aabelyakov  wrote:
>
> > > > > > During my application error occurs and it stops giving error ticket.
>
> > > > > > How can I in my application to return the resources of the operating
> > > > > > system
> > > > > > (eg close the COM port) šbefore the error ticket not to restart the
> > > > > > web server?
>
> > > > > > Excuse my bad English...
>
> > > > > > Regards- óËÒÙÔØ ÃÉÔÉÒÕÅÍÙÊ ÔÅËÓÔ -
>
> > > > > - ðÏËÁÚÁÔØ ÃÉÔÉÒÕÅÍÙÊ ÔÅËÓÔ -
>
> > > > --
> > > > Subscription 
> > > > settings:http://groups.google.com/group/web2py/subscribe?hl=en-Скрыть 
> > > > цитируемый текст -
>
> > > - Показать цитируемый текст -- Скрыть цитируемый текст -
>
> - Показать цитируемый текст -


Re: [web2py] Re: How to return the resources?

2010-04-17 Thread Jason Brower
To add to the closed topic. (:
Massimo and I worked over this with PySerial and yeah, having a separate
program to manage the serial connection is actually VITAL.  Especially
if your making devices that send important other data.  Have that
external app just update a file in queue with information, and when you
need it displayed in the webbrowser you can just make a request for the
status from that file.
This is similar to the issues found in a webcam.  You don't make the web
application take a picture of a file when a webpage requests it as it
would pile full of requests and errors as everyone is trying to use the
same device.  With a file, like an image, everyone should have access to
it very easily.
In my setup I was dealing with industrial robots, some logic had to be
done faster than the webbrowser could do it.  So having a "machine
server" as we call it at work, helps take care of those common logic
steps so that web2py doesn't worry about it. 
BR,
Jason Brower

On Sat, 2010-04-17 at 01:46 -0700, aabelyakov wrote: 
> Yes, this is the right decision!
> Topic closed.
> Thanks
> 
> On 16 апр, 17:30, mdipierro  wrote:
> > I think there is a problem with multithreading because of PySerial.
> > Pyserial open a post connected to COM and COM is a resource that
> > cannot be shared. In web2py every request is executed in its own
> > thread so it is not obvious who open the COM, who closes it and how
> > conflicts are avoided.
> >
> > Please tell us more of what you are doing. The best solution may be
> > not to use pyserial in a web2py problem but use it in a single
> > bachground process that talks to web2py via queued messages.
> >
> > Massimo
> >
> > On Apr 16, 2:13 am, aabelyakov  wrote:
> >
> >
> >
> > > I do not use os.chdir or explicit calls to thread module.
> > > I'm using PySerial and after the error COM port remains open.
> > > To close it, I restart the web server.
> > > How to avoid this?
> >
> > > On 15 ÁÐÒ, 22:46, mdipierro  wrote:
> >
> > > > Do you use os.chdir or explicit calls to the thread module in your
> > > > code?
> >
> > > > On Apr 15, 12:15špm, aabelyakov  wrote:
> >
> > > > > During my application error occurs and it stops giving error ticket.
> >
> > > > > How can I in my application to return the resources of the operating
> > > > > system
> > > > > (eg close the COM port) šbefore the error ticket not to restart the
> > > > > web server?
> >
> > > > > Excuse my bad English...
> >
> > > > > Regards- óËÒÙÔØ ÃÉÔÉÒÕÅÍÙÊ ÔÅËÓÔ -
> >
> > > > - ðÏËÁÚÁÔØ ÃÉÔÉÒÕÅÍÙÊ ÔÅËÓÔ -
> >
> > > --
> > > Subscription 
> > > settings:http://groups.google.com/group/web2py/subscribe?hl=en- Скрыть 
> > > цитируемый текст -
> >
> > - Показать цитируемый текст -




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

2010-04-17 Thread aabelyakov
I re-downloaded a working copy of trunk
from https://web2py.googlecode.com/hg/.

Error disappeared.
Topic closed.
Thanks

On 16 апр, 17:25, mdipierro  wrote:
> where did you get web2py from?
>
> On Apr 16, 2:01 am, aabelyakov  wrote:
>
>
>
> > On 16 апр, 10:21, mdipierro  wrote:
>
> > > In the version in trunk that line is 768 and not 977 and it is
> > > defined. It is an argument of the function.
> > > Your file appear longer than it should be and that is very odd. Please
> > > try download it again.
>
> > I added into sqlhtml.py 2 missing strings:
> >         formstyle = 'table3cols',
> >         self.formstyle = formstyle
>
> > but got the following error:
>
> > File "D:\MyProg\_MyPython\Web2py\gluon\sqlhtml.py", line 803, in
> > __init__
> >     for id,a,b,c in xfields:
> > ValueError: need more than 3 values to unpack
>
> > --
> > Subscription 
> > settings:http://groups.google.com/group/web2py/subscribe?hl=en- Скрыть 
> > цитируемый текст -
>
> - Показать цитируемый текст -


[web2py] Re: How to return the resources?

2010-04-17 Thread aabelyakov
Yes, this is the right decision!
Topic closed.
Thanks

On 16 апр, 17:30, mdipierro  wrote:
> I think there is a problem with multithreading because of PySerial.
> Pyserial open a post connected to COM and COM is a resource that
> cannot be shared. In web2py every request is executed in its own
> thread so it is not obvious who open the COM, who closes it and how
> conflicts are avoided.
>
> Please tell us more of what you are doing. The best solution may be
> not to use pyserial in a web2py problem but use it in a single
> bachground process that talks to web2py via queued messages.
>
> Massimo
>
> On Apr 16, 2:13 am, aabelyakov  wrote:
>
>
>
> > I do not use os.chdir or explicit calls to thread module.
> > I'm using PySerial and after the error COM port remains open.
> > To close it, I restart the web server.
> > How to avoid this?
>
> > On 15 ÁÐÒ, 22:46, mdipierro  wrote:
>
> > > Do you use os.chdir or explicit calls to the thread module in your
> > > code?
>
> > > On Apr 15, 12:15špm, aabelyakov  wrote:
>
> > > > During my application error occurs and it stops giving error ticket.
>
> > > > How can I in my application to return the resources of the operating
> > > > system
> > > > (eg close the COM port) šbefore the error ticket not to restart the
> > > > web server?
>
> > > > Excuse my bad English...
>
> > > > Regards- óËÒÙÔØ ÃÉÔÉÒÕÅÍÙÊ ÔÅËÓÔ -
>
> > > - ðÏËÁÚÁÔØ ÃÉÔÉÒÕÅÍÙÊ ÔÅËÓÔ -
>
> > --
> > Subscription 
> > settings:http://groups.google.com/group/web2py/subscribe?hl=en- Скрыть 
> > цитируемый текст -
>
> - Показать цитируемый текст -


[web2py] Re: _href and src url not rendered

2010-04-17 Thread annet
I converted the send_mail function to a none mail function. The
send_mail function:


def send_mail():
 
mailinglist=db((db.bedrijfcontactpersoon.bedrijf==db.bedrijf.id)&(db.bedrijfcontactpersoon.bedrijf==db.bedrijfinschrijving.bedrijf)&
\
 
(db.bedrijfcontactpersoon.contactpersoon==db.contactpersoon.id)&(db.bedrijfinschrijving.inschrijving==2)&
\
(db.contactpersoon.subscription==True))\

.select(db.bedrijf.bedrijfsnaam,db.bedrijfcontactpersoon.bedrijf,db.contactpersoon.id,db.contactpersoon.email,
\
orderby=db.bedrijfcontactpersoon.bedrijf)
for item in mailinglist:
context=dict(item=item)
message=response.render('clublocatormail/
send_mail.html',context)
recipient=item.contactpersoon.email
boolean=mail.send(to=[recipient],subject='Bedrijfsgegevens ' +
item.bedrijf.bedrijfsnaam + ' in Fitwise',message=[None,message])
if boolean:
 
db.mailing_stats.insert(bedrijf=item.bedrijfcontactpersoon.bedrijf,contactpersoon=item.contactpersoon.id,
\
controller='clublocatormail',functie='send_mail')
else:
 
db.admin_stats.insert(bedrijf=item.bedrijfcontactpersoon.bedrijf,contactpersoon=item.contactpersoon.id,
\
controller='clublocatormail',functie='send_mail')
return True


... and its view:



  

Template - Single Column
  
  



  

  

  

  
Having trouble viewing this email? {{=A('View
it in your browser',
_href=URL(r=request,c='clublocatormail',f='browser_version',args=[item.bedrijfcontactpersoon.bedrijf,item.contactpersoon.id]),
_target="_blank")}}
  


  

  


  

  

  

Fitwise

Fitwise is een informatie en
communicatie tool op internet waarmee u uw klanten en potentiële
klanten moeiteloos bereikt en waarmee zij
u moeiteloos kunnen vinden via onze
   {{=A('club locator',
_href=URL(r=request,c='clublocatormail',f='clublocator',args=[item.bedrijfcontactpersoon.bedrijf,item.contactpersoon.id]),
_target="_blank")}}.
   Als ondernemer wilt u natuurlijk dat uw
bedrijfsgegevens in ons systeem up-to-date zijn. Controleer daarom
   {{=A('uw bedrijfsgegevens in Fitwise',
_href=URL(r=request,c='clublocatormail',f='check_details',args=[item.bedrijfcontactpersoon.bedrijf,item.contactpersoon.id]),
_target="_blank")}}

Zijn uw bedrijfsgegevens in ons systeem
niet up-to-date of wilt u uzelf als contactpersoon aanmelden. Vul dan
het
   {{=A('wijzigingsformulier',
_href=URL(r=request,c='clublocatormail',f='update_form',args=[item.bedrijfcontactpersoon.bedrijf,item.contactpersoon.id,]),
_target="_blank")}} in.
   Zijn uw bedrijfsgegevens in ons systeem up-
to-date? Laat het ons weten via het
   {{=A('bevestigingsformulier',
_href=URL(r=request,c='clublocatormail',f='update_form',args=[item.bedrijfcontactpersoon.bedrijf,item.contactpersoon.id,]),
_target="_blank")}}.

Met
vriendelijke groet


  

  

  


  
Not interested anymore? {{=A('Unsubscribe',
_href=URL(r=request,c='clublocatormail',f='unsubscribe',args=[item.bedrijfcontactpersoon.bedrijf,item.contactpersoon.id,]))}}

  

  

  

  

  





The not_send_mail function:

def not_send_mail():
 
item=db((db.bedrijfcontactpersoon.bedrijf==db.bedrijf.id)&(db.bedrijfcontactpersoon.bedrijf==db.bedrijfinschrijving.bedrijf)&
\
 
(db.bedrijfcontactpersoon.contactpersoon==db.contactpersoon.id)&(db.bedrijfinschrijving.inschrijving==2)&
\
(db.contactpersoon.subscription==True))\

.select(db.bedrijf.bedrijfsnaam,db.bedrijfcontactpersoon.bedrijf,db.contactpersoon.id,db.contactpersoon.email,
\
orderby=db.bedrijfcontactpersoon.bedrijf)
return dict(item=item)


... and in its view, which is identical to the one above, I replaced
the item attributes with item[0]. When I expose the latter the _href
and scr attributes are rendered correctly:



"Having trouble viewing this email?"
View it in your brwoser








Is it the response.render() function that is causing the problem, or
something else?


Kind regards,

Annet.


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] Re: _href and src url not rendered

2010-04-17 Thread annet
Maybe the following information is of help to help me solve the
problem. The mail function reads like:


def send_mail():
mailinglist=db((db.bedrijfcontactpersoon.bedrijf==db.bedrijf.id)&(db.bedrijfcontactpersoon.bedrijf==db.bedrijfinschrijving.bedrijf)&
\
 
(db.bedrijfcontactpersoon.contactpersoon==db.contactpersoon.id)&(db.bedrijfinschrijving.inschrijving==2)&
\
(db.contactpersoon.subscription==True))\

.select(db.bedrijf.bedrijfsnaam,db.bedrijfcontactpersoon.bedrijf,db.contactpersoon.id,db.contactpersoon.email,
\
orderby=db.bedrijfcontactpersoon.bedrijf)
for item in mailinglist:
context=dict(item=item)
message=response.render('clublocatormail/
send_mail.html',context)
recipient=item.contactpersoon.email
boolean=mail.send(to=[recipient],subject='Bedrijfsgegevens ' +
item.bedrijf.bedrijfsnaam + ' in Fitwise',message=[None,message])
if boolean:
 
db.mailing_stats.insert(bedrijf=item.bedrijfcontactpersoon.bedrijf,contactpersoon=item.contactpersoon.id,
\
controller='clublocatormail',functie='send_mail')
else:
 
db.admin_stats.insert(bedrijf=item.bedrijfcontactpersoon.bedrijf,contactpersoon=item.contactpersoon.id,
\
controller='clublocatormail',functie='send_mail')
return True


And the view:



  

Template - Single Column
  
  



  

  

  

  
Having trouble viewing this email? {{=A('View
it in your browser',
_href=URL(r=request,c='clublocatormail',f='browser_version',args=[item.bedrijfcontactpersoon.bedrijf,item.contactpersoon.id]),
_target="_blank")}}
  


  

  


  

  

  

Fitwise

Fitwise is een informatie en
communicatie tool op internet waarmee u uw klanten en potentiële
klanten moeiteloos bereikt en waarmee zij
u moeiteloos kunnen vinden via onze
   {{=A('club locator',
_href=URL(r=request,c='clublocatormail',f='clublocator',args=[item.bedrijfcontactpersoon.bedrijf,item.contactpersoon.id]),
_target="_blank")}}.
   Als ondernemer wilt u natuurlijk dat uw
bedrijfsgegevens in ons systeem up-to-date zijn. Controleer daarom
   {{=A('uw bedrijfsgegevens in Fitwise',
_href=URL(r=request,c='clublocatormail',f='check_details',args=[item.bedrijfcontactpersoon.bedrijf,item.contactpersoon.id]),
_target="_blank")}}

Zijn uw bedrijfsgegevens in ons systeem
niet up-to-date of wilt u uzelf als contactpersoon aanmelden. Vul dan
het
   {{=A('wijzigingsformulier',
_href=URL(r=request,c='clublocatormail',f='update_form',args=[item.bedrijfcontactpersoon.bedrijf,item.contactpersoon.id,]),
_target="_blank")}} in.
   Zijn uw bedrijfsgegevens in ons systeem up-
to-date? Laat het ons weten via het
   {{=A('bevestigingsformulier',
_href=URL(r=request,c='clublocatormail',f='update_form',args=[item.bedrijfcontactpersoon.bedrijf,item.contactpersoon.id,]),
_target="_blank")}}.

Met
vriendelijke groet


  

  

  


  
Not interested anymore? {{=A('Unsubscribe',
_href=URL(r=request,c='clublocatormail',f='unsubscribe',args=[item.bedrijfcontactpersoon.bedrijf,item.contactpersoon.id,]))}}

  

  

  

  

  





When I change the mail function to read like:

def not_send_mail():
 
item=db((db.bedrijfcontactpersoon.bedrijf==db.bedrijf.id)&(db.bedrijfcontactpersoon.bedrijf==db.bedrijfinschrijving.bedrijf)&
\
 
(db.bedrijfcontactpersoon.contactpersoon==db.contactpersoon.id)&(db.bedrijfinschrijving.inschrijving==2)&
\
(db.contactpersoon.subscription==True))\

.select(db.bedrijf.bedrijfsnaam,db.bedrijfcontactpersoon.bedrijf,db.contactpersoon.id,db.contactpersoon.email,
\
orderby=db.bedrijfcontactpersoon.bedrijf)
return dict(item=item)


And in the view replace item with item[0]. Then, when I expose the
not_send_mail function the view is rendered correctly:



"Having trouble viewing this email?"









Kind regards,

Annet


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


[web2py] _href and src url not rendered

2010-04-17 Thread annet
In the view of a html mail function I have got the following A-helper
and img tag:


Having trouble viewing this email? {{=A('View it in your browser',
_href=URL(r=request,c='clublocatormail',f='browser_version',args=[item.bedrijfcontactpersoon.bedrijf,item.contactpersoon.id]),
_target="_blank")}}








When I expose the function both locally and on the server the _href
and src attributes aren't rendered, i.e. when I open the mail in a
mail client or for example roundcube web mail the attributes just
aren't there:



Having trouble viewing this email? View it in your browser







Does one of you know why, and how to solve this problem?


Kind regards,

Annet.


-- 
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en


Re: [web2py] Re: options.py problem

2010-04-17 Thread Tomas Pelka
Still:
Cannot import config file [options]

Btw I need to start web2py from script using:

gluon.widget.start(cron=True)

Is there any way how to preset options? Looking in source I can see that

647  parser.add_option('-L',
648'--config',
649dest='config',
650default='',
651help='config file')

there is no default config, right?

Thanks

mdipierro wrote:
> Looks like you are not doing anything wrong but test=false is missing
> from the options file. I changed the source in trunk so that it does
> not expect options.test
> 
> Massimo
> 
> On Apr 16, 5:14 pm, Tomas Pelka  wrote:
>> Hi all,
>>
>> python web2py -L options.py
>> ends with:
>>
>> File "web2py.py", line 20, in 
>> gluon.widget.start(cron=True)
>>   File "/home/tom/workspace/pyNetSim/web2py/gluon/widget.py", line 750,
>> in start
>> if options.test:
>> AttributeError: 'module' object has no attribute 'test'
>>
>> No -T option specified.
>>
>> Options.py looks like:
>>
>> import os
>> ip = '10.8.0.10'
>> port = 
>> password = ''
>> pid_filename = 'httpserver.pid'
>> log_filename = 'httpserver.log'
>> profiler_filename = None
>> ssl_certificate = 'secret/server.crt'
>> ssl_private_key = 'secret/server.key'
>> numthreads = 10
>> server_name = 'NetSim'
>> request_queue_size = 10
>> timeout = 10
>> shutdown_timeout = 5
>> folder = os.getcwd()
>> extcron = None
>> nocron = None
>>
>> Am I doing anythin wrong?
>>
>> Thanks for answers (web2py 1.76.5).
>>
>> --
>> Tom
>>
>> --
>> Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en


-- 
Tom