[web2py] Re: Looping in the browser?

2010-05-11 Thread cjrh
On May 12, 4:25 am, Miguel Lopes  wrote:

Alternatively, instead of this:

>             result_list.append(a_str)
>
>    # Now you can return the list
>    return result_list

one could yield the values:

  yield(a_str)

and then whatever other code uses function "check()" can still iterate
over the generator as in:

for s in check():
# Operate on s


[web2py] Question about sequences

2010-05-11 Thread Sverre
In the database administration a query to select all is (id>0). But
some databases like postgresql starting a sequence default by 0, not
like sqlite with 1. So how can I avoid problems?


[web2py] Re: Using LOAD from a controller?

2010-05-11 Thread Iceberg
On a second look, your case seems having no need for LOAD. How about
adjust your code like this?

New todo

 


On May12, 4:43am, Keith Edmunds  wrote:
> Sorry, Iceburg, I appreciate your attempt to help, but you've lost me
> completely! Can you explain?
>
> Thanks


[web2py] Re: Review my web2py app: Radbox.me

2010-05-11 Thread Adi
On May 12, 4:25 am, b00m_chef  wrote:
> FYI:
>
> Fix your routes.py http://radbox.me/index.html = Invalid Controller.
>

Where did you get that link? http://radbox.me/index should work.


[web2py] Re: ORM-like DAL

2010-05-11 Thread vihang
Some of the apps I am working currently are much more easy to build if
the models can be defined as a class with methods that act on them.


On May 12, 5:51 am, Álvaro Justen  wrote:
> On Tue, May 11, 2010 at 21:38, Richard  wrote:
> > there was a discussion about this on the developers mailing list last
> > week:
> >http://groups.google.com/group/web2py-developers/browse_thread/thread...
>
> Yes, started by me.
>
> > On May 7, 12:50 am, vihang  wrote:
> >> Hello,
>
> >> A long time back, someone (mostly probably massimo) had written a few
> >> lines of code showing how DAL could be extended to be used in class,
> >> and effective like ORM. I have spent a lot of time searching for this
> >> on this group, but unable to find it. Any help would be appreciated.
>
> vihang, why do you want an ORM? :)
>
> >> Thanks
> >> Vihang
>
> --
> Álvaro Justen - Turicas
>  http://blog.justen.eng.br/
>  21 9898-0141


[web2py] Re: New to web app development -- is web2py a good choice

2010-05-11 Thread Richard
The book was a huge improvement but there is certainly more to be
done. Unfortunately this kind of work is not fun so happens slowly.

Would it be worth migrating useful content to the book (and slices)
and close the legacy apps (AlterEgo, wiki)?

Having a list of notable web2py driven sites is a good idea.
Perhaps someone with design skills could submit an improved look for
web2py.com and the default app.

Richard


On May 11, 4:54 am, Anthony  wrote:
> All, thanks so much for your thoughtful responses -- very helpful and
> encouraging. I can see this is a very active, open, and supportive
> community, and I believe I will give web2py a try. (I followed
> Massimo's advice and posted a similar question on the ROR list, and
> Massimo even popped up over there to add to the discussion -- nice
> work.)
>
> I appreciate the points made regarding why I'm not finding a lot of
> impressive looking examples of web2py-powered sites (i.e., focus on
> intranet development; lack of design-oriented web2py developers).
> Digging into the list a bit, it appears this issue has come up before:
>
> http://groups.google.com/group/web2py/browse_frm/thread/22d37d27b6fc969fhttp://groups.google.com/group/web2py/browse_frm/thread/e70143ebf8be476c
>
> I know I'm new here, and I don't want to be presumptuous, but perhaps
> it would be useful to hear the perspective of someone who has recently
> been "shopping" for a web framework and comparing the different
> alternatives. For me at least (and I suspect I'm not alone), it's very
> helpful to be able to identify some high quality examples and/or some
> high profile organizations using the framework. These "used by"
> examples (a) tell me that other successful organizations have found
> value in the framework, (b) demonstrate real-world capabilities and
> use cases, and (c) boost confidence in the long-term viability of the
> framework (i.e., it's more likely to continue being developed/
> supported if it's got lots of users and/or at least a few high profile
> users).
>
> Given web2py's unique situation, you might consider some of the
> following:
>
> * Identify a handful of your best public examples and highlight just
> those. Among the existing crop, a few that stood out to me were
> several of Julio Flores' sites (i.e., pyforum.org, techfuel.net, and
> the screenshots of pyshowcase.org and pystack.com posted on
> techfuel.net), web2pyslices.com (though the design could use a little
> polishing), and qualitysystems.com.
>
> * Just as important as what you include is what you don't. Don't list
> 50 sites just because they all happen to use web2py. The unimpressive
> ones may actually detract from interest in web2py, and they make it a
> lot harder to find the few good ones (not to mention that some of the
> sites listed don't even exist anymore). If there are a few sites that
> have some impressive capabilities under the hood but just happen not
> to look so pretty, maybe call those out separately, but provide some
> explanation (e.g., "Doesn't look pretty because not intended for wide
> public consumption, but it does XYZ in only 100 lines of code...").
>
> * For internal/intranet projects with notable companies, try to get
> permission to mention the company name (possibly with logo) on the
> web2py site.
>
> * If you can't get permission to mention the company name, provide a
> general description of the type of company and nature of the project
> (e.g., "A Fortune 500 financial services organization uses web2py to
> power its mission critical XYZ system...").
>
> * In some cases, you might also be able to show redacted screenshots
> (i.e., blur out confidential/proprietary details or replace with
> generic data).
>
> More generally, compared with some of the other frameworks (even
> Pylons and TurboGears), I think the web2py site itself could use a
> little more polish and organization. There appear to be a lot of great
> resources, but they seem a bit scattered. For example, there's the
> book, which includes its own wiki pages, plus a separate wiki style
> FAQ (which is just a very long unorganized list), plus an entirely
> separate wiki site, all with different UI's. In addition, there are
> examples and applications on the main site (not particularly well
> organized), a separate plugins site, and additional apps, plugins,
> examples, and snippets on web2pyslices.com, again all with different
> UI's. That's a lot of seemingly related documentation and resources
> scattered across a lot of different places (that are not well
> integrated or universally searchable). Also, I can't find a way to
> navigate to the "Powered By" list without already knowing the URL
> (actually, that's probably a good thing for the time being), and at
> least two of the affiliated companies listed don't appear to exist
> anymore. I could go on, but you get the idea.
>
> Honestly, coming from the sites of some of the other frameworks,
> web2py suffers a bit by comparison (I think unnecessarily so). 

[web2py] Re: User stack or queue

2010-05-11 Thread Richard
I recommend spending a day working through the book (http://web2py.com/
book).
But if you really don't have the time try editing an existing app to
do what you want. Or just pay someone on this mailing list to do it
for you.


On May 11, 4:43 am, pk  wrote:
> annotation:
> the project time is very short, i have no time to learn python perfect
> in this short time.
> when i will have more time than i read the book or the docu.
> thanks peter
>
> On 10 Mai, 20:41, pk  wrote:
>
> > hi,
> > i am usual not a coder, i am a designer.
> > and i normally using not python or web2py, but now we have a project.
> > thats the reason why i need help. and if nobody has time to help, it´s
> > also ok,
> > but i think a mailing list is also a possibilty to help others (also
> > beginners, in my case).
> > and i only ask to help me
>
> > On 10 Mai, 20:09, Iceberg  wrote:
>
> > > Hi peter, since you are a beginner of web2py even python, why not just
> > > come back to learn Python [1] and then web2py [2]? Don't expect to
> > > learn their "syntax" on a maillist. Please, cherish your time, as well
> > > as others. If, after your syntax learning, you have some design
> > > question or puzzles, feel free to come back and lots of people will be
> > > glad to help you. By the way, you join this maillist one year ago and
> > > sent 100+ posts. Didn't you learn some python and web2py since then?
>
> > > [1]http://docs.python.org/tutorial/
> > > [2]http://www.web2py.com/book
>
> > > On May11, 12:21am, pk  wrote:
>
> > > > ok thank you very much,
> > > > but i am a beginner of web2py and python.
> > > > what i have to do into a controller, what into the view?
> > > > how is the syntax?
>
> > > > peter
>
> > > > On 10 Mai, 18:17, Vasile Ermicioi  wrote:
>
> > > > > here is a sketch:
>
> > > > > db.define_table('what_to_see',  Field('html_code', 'text'))
> > > > > db.define_table('what_to_see_queue',  Field('user', db.users),
> > > > > Field('when_allowed_to_see', 'datetime'))
>
> > > > > if user_not_in_queue:
> > > > >     if last_user_allowed_time + 5minutes < time_now:
> > > > >      when_allowed_to_see = time_now
> > > > >     else:
> > > > > when_allowed_to_see = time_now
> > > > >     add_user_to_queue_with_his_time
> > > > > if when_allowed_to_see > time_now:
> > > > >   display_refresh_in (when_allowed_to_see - time_now)
> > > > >   and_a_script_to_refresh_page_after_a_period_of_time
> > > > > else:
> > > > >   display_html_code
> > > > >   delete_user_from_queue


[web2py] Re: please check the latest builds

2010-05-11 Thread mdipierro
Nothing specifically. Just make sure your apps do not break.

Massimo

On May 11, 9:27 pm, Álvaro Justen  wrote:
> On Tue, May 11, 2010 at 22:29, mdipierro  wrote:
> >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
>
> Check for... ?
>
> --
> Álvaro Justen - Turicas
>  http://blog.justen.eng.br/
>  21 9898-0141


Re: [web2py] please check the latest builds

2010-05-11 Thread Álvaro Justen
On Tue, May 11, 2010 at 22:29, mdipierro  wrote:
> 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

Check for... ?

-- 
Álvaro Justen - Turicas
 http://blog.justen.eng.br/
 21 9898-0141


Re: [web2py] Looping in the browser?

2010-05-11 Thread Miguel Lopes
I suppose you want to return several positions that match (domain ==
session.target_domain) then you must not use return (as it escapes the loop
and exits the function scope). You should collect all your matches in a list
and the return the list in the end. Something like:

def check():
   result_list = []
   for target_keyword in session.keywords.split(','):
  ...
  ...
  ...
  for idx, res in enumerate(results):
 ...
 ...
 if domain == session.target_domain:
a_str = "Your google position is %d for keyword '%s' on domain
%s" \
% (idx+1, target_keyword,
session.target_domain)
result_list.append(a_str)

   # Now you can return the list
   return result_list

  HTH


On Wed, May 12, 2010 at 2:34 AM, Andrew Evans wrote:

> Hello I have a problem. I have code written for web2py that has two
> functions, the problem is in the looping of the second function. it
> only executes the loop once. Is there anyway I can continue looping
>
> def check():
>for target_keyword in session.keywords.split(','):
>gs = GoogleSearch(target_keyword)
>gs.results_per_page = int(session.results_per_page_num)
>results = gs.get_results()
>for idx, res in enumerate(results):
>parsed = urlparse(res.url)
>domain = mk_nice_domain(parsed.netloc)
>if domain == session.target_domain:
>return dict(search=build("Your google position is %d
> for keyword '%s' on domain %s" % (idx+1,
>target_keyword, session.target_domain)))
>
> Thanks if you can help
>
>


[web2py] Looping in the browser?

2010-05-11 Thread Andrew Evans
Hello I have a problem. I have code written for web2py that has two
functions, the problem is in the looping of the second function. it
only executes the loop once. Is there anyway I can continue looping

def check():
for target_keyword in session.keywords.split(','):
gs = GoogleSearch(target_keyword)
gs.results_per_page = int(session.results_per_page_num)
results = gs.get_results()
for idx, res in enumerate(results):
parsed = urlparse(res.url)
domain = mk_nice_domain(parsed.netloc)
if domain == session.target_domain:
return dict(search=build("Your google position is %d
for keyword '%s' on domain %s" % (idx+1,
target_keyword, session.target_domain)))

Thanks if you can help



[web2py] please check the latest builds

2010-05-11 Thread mdipierro
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


[web2py] Re: jsonrpc call failure [FALSE ALARM]

2010-05-11 Thread mdipierro
:-)

On May 11, 7:55 pm, Miguel Lopes  wrote:
> On Wed, May 12, 2010 at 1:48 AM, mdipierro  wrote:
> > Can you describe what happens in the uncessful test? Do you see a new
> > ticket file being generate in the errors/ folder? What does it say?
>
>  Upps! Sorry false alarm. I was calling the remote server with the port and
> this was causing the connection to be refused. Unfortunately I've been doing
> variations on this for about 20 minutes or so!!!
> Sorry for this and Txs for the help!
> Miguel


Re: [web2py] Re: jsonrpc call failure

2010-05-11 Thread Miguel Lopes
On Wed, May 12, 2010 at 1:48 AM, mdipierro  wrote:

> Can you describe what happens in the uncessful test? Do you see a new
> ticket file being generate in the errors/ folder? What does it say?
>
>
 Upps! Sorry false alarm. I was calling the remote server with the port and
this was causing the connection to be refused. Unfortunately I've been doing
variations on this for about 20 minutes or so!!!
Sorry for this and Txs for the help!
Miguel


Re: [web2py] Re: ORM-like DAL

2010-05-11 Thread Álvaro Justen
On Tue, May 11, 2010 at 21:38, Richard  wrote:
> there was a discussion about this on the developers mailing list last
> week:
> http://groups.google.com/group/web2py-developers/browse_thread/thread/778e4015b8fae372

Yes, started by me.

> On May 7, 12:50 am, vihang  wrote:
>> Hello,
>>
>> A long time back, someone (mostly probably massimo) had written a few
>> lines of code showing how DAL could be extended to be used in class,
>> and effective like ORM. I have spent a lot of time searching for this
>> on this group, but unable to find it. Any help would be appreciated.

vihang, why do you want an ORM? :)

>> Thanks
>> Vihang

-- 
Álvaro Justen - Turicas
 http://blog.justen.eng.br/
 21 9898-0141


[web2py] Re: jsonrpc call failure

2010-05-11 Thread mdipierro
Can you describe what happens in the uncessful test? Do you see a new
ticket file being generate in the errors/ folder? What does it say?


On May 11, 7:46 pm, Miguel Lopes  wrote:
> I've managed to successfully call on a jsonrpc service using localhost.
> However I cannot replicate this with a remote server.
> For the client I'm using jsonrpc at the Python prompt:
>
>
>
> >>> sv = ServiceProxy('http://127.0.0.1:8000/testapp/default/call/jsonrpc')
> >>> sv.getRequests()
> ['json test']
>
> The very standard controller is:
> @service.jsonrpc
> def getRequests():
>     return ["json test"]
>
> def call():
>     session.forget()
>     return service()
>
> Notably I'm running web2py 1.74.4 on OSX on the localhost - the successful
> test
> And web2py 1.65.5 on Debian on the remote server - the unsuccessful test
>
> I believe 1.65.5 supports jsonrpc and that this is served by default on port
> 8000. Am I wrong? What am I missing?
>
> Miguel


[web2py] jsonrpc call failure

2010-05-11 Thread Miguel Lopes
I've managed to successfully call on a jsonrpc service using localhost.
However I cannot replicate this with a remote server.
For the client I'm using jsonrpc at the Python prompt:

>>> sv = ServiceProxy('http://127.0.0.1:8000/testapp/default/call/jsonrpc')
>>> sv.getRequests()
['json test']
>>>

The very standard controller is:
@service.jsonrpc
def getRequests():
return ["json test"]

def call():
session.forget()
return service()

Notably I'm running web2py 1.74.4 on OSX on the localhost - the successful
test
And web2py 1.65.5 on Debian on the remote server - the unsuccessful test

I believe 1.65.5 supports jsonrpc and that this is served by default on port
8000. Am I wrong? What am I missing?

Miguel


[web2py] Re: Running a script with Google App Engine

2010-05-11 Thread Richard
> Does this apply to the dev environment as well? Just fire it up and run it 
> via localhost?

Unfortunately no (for the Python API):
http://code.google.com/appengine/docs/python/taskqueue/overview.html#Task_Queues_and_the_Development_Server

"""
When your app is running in the development server, task queues are
not processed automatically. Instead, task queues accrue tasks which
you can examine and execute from the developer console
"""

Richard


On May 11, 12:14 pm, Matthew  wrote:
> Does this apply to the dev environment as well? Just fire it up and
> run it via localhost?
>
> If that's the case, would you mind providing an example or the proper
> documentation link to help me get started?
>
> Also, since bulk inserts are now possible in 
> GAEhttp://groups.google.com/group/web2py/browse_thread/thread/93d3dad847...,
> does that mean they're only possible from within the application
> itself (not via script)?
>
> Thanks,
> Matthew
>
> On May 10, 7:04 pm, howesc  wrote:
>
> > everything on GAE must be called via a URL (it must be a controller/
> > function).  if you need to run it periodically look up how to do cron
> > on GAE and create your cron.yaml.
>
> > @auth.requires_membership() is your friend in this case to limit who
> > can call your controller. :)
>
> > i have several of these sorts of things running on GAE, and it seems
> > to work quite well.
>
> > On May 9, 7:14 pm, mdipierro  wrote:
>
> > > no
>
> > > On May 9, 8:33 pm, Matthew  wrote:
>
> > > > You can run a script with Postgres or MySQL using this syntax:
>
> > > >     python web2py.py -S myapp -M -R applications/myapp/modules/
> > > > myscript.py
>
> > > > Can a script be run in this way using App Engine as the datastore?


[web2py] Re: Running a script with Google App Engine

2010-05-11 Thread mdipierro
thanks for the clarification.

On May 11, 7:43 pm, Richard  wrote:
> http://code.google.com/appengine/docs/python/taskqueue/overview.html#...
>
> """
> If the execution of a particular Task fails (by returning any HTTP
> status code outside of the range 200-299), App Engine will attempt to
> retry until it succeeds. The system will back off gradually so as not
> to flood your application with too many requests, but it will retry
> failed tasks at least once a day at minimum.
> """
>
> On May 12, 9:30 am, mdipierro  wrote:
>
> > How safe is this approach? You process 100 records ate the time and
> > call the function itself again until done. If this fails for any
> > reason (like time constraints imposed by GAE or other GAE db access
> > failure), this is not going to call itself again and it will never
> > complete. Is it a possibility?
>
> > Another issue: your  looping condition is the creation time of the
> > record. That works. If the condition where different nothing would
> > prevent a new record to be inserted by a different user that would
> > fall thought the cracks in the list of records that where already
> > processed. This only works for simple queries.
>
> > Massimo
>
> > On May 11, 5:38 pm, howesc  wrote:
>
> > > yes, it applies to the dev environment as well.
>
> > > i have not used bulk inserts yet, but they would have to run as a
> > > controller that is accessible via URL.  (at least as far as i can
> > > tell).  Even the bulkloader.py tool distributed with the SDK talks to
> > > a particular app URL and does everything in 30 second chunks.
>
> > > here is an example of an upgrade i had to do where i needed to add a
> > > new field to the database, and make sure all existing records had a
> > > default value for that field (because queries with filters on unset
> > > values don't work on google app engine).  I ran it by hitting the URL,
> > > and when it ran out of time it just queued itself to keep going.  if
> > > you want to cron it look 
> > > athttp://code.google.com/appengine/docs/python/config/cron.html
>
> > > i put the controller in default.py, so it was accessed at
> > > .appspot.com/app/default/task.html
>
> > > 
> > > def task():
> > >     """
> > >     today (19-mar-2010) we are going to use this to add
> > > processed_audio
> > >     field to recordings
> > >     """
> > >     return
> > >     from google.appengine.api.labs import taskqueue
> > >     from google.appengine.runtime import DeadlineExceededError
> > >     logging.info("in da task")
>
> > >     last_id = request.vars.id.split(".")[0]
>
> > >     rows = db((db.recording.created_time >=
> > > last_id)).select(db.recording.media,
>
> > > orderby=db.recording.created_time,
> > >                                             limitby=(0, 100))
> > >     try:
> > >         #update processed_audio
> > >         for r in rows:
> > >             media_ids = r['media'].split('|')
> > >             processed = False
> > >             if media_ids:
> > >                  processed=True
>
> > > db(db.recording.id==r.id).update(processed_audio=processed)
> > >             last_id = r.created_time
> > >     except DeadlineExceededError:
> > >         logging.info("cutoff at %s" %repr(last_id))
> > >         taskqueue.add(url='/default/task', params={'id': last_id})
> > >         return
>
> > >     if len(rows) < 100:
> > >         logging.info("no more rows to process")
> > >         return
>
> > >     logging.info("finished at %s" %repr(last_id))
> > >     taskqueue.add(url='/default/task', params={'id': last_id})
> > >     return
> > > 
>
> > > good luck!
>
> > > cfh
>
> > > On May 10, 7:14 pm, Matthew  wrote:
>
> > > > Does this apply to the dev environment as well? Just fire it up and
> > > > run it via localhost?
>
> > > > If that's the case, would you mind providing an example or the proper
> > > > documentation link to help me get started?
>
> > > > Also, since bulk inserts are now possible in 
> > > > GAEhttp://groups.google.com/group/web2py/browse_thread/thread/93d3dad847...,
> > > > does that mean they're only possible from within the application
> > > > itself (not via script)?
>
> > > > Thanks,
> > > > Matthew
>
> > > > On May 10, 7:04 pm, howesc  wrote:
>
> > > > > everything on GAE must be called via a URL (it must be a controller/
> > > > > function).  if you need to run it periodically look up how to do cron
> > > > > on GAE and create your cron.yaml.
>
> > > > > @auth.requires_membership() is your friend in this case to limit who
> > > > > can call your controller. :)
>
> > > > > i have several of these sorts of things running on GAE, and it seems
> > > > > to work quite well.
>
> > > > > On May 9, 7:14 pm, mdipierro  wrote:
>
> > > > > > no
>
> > > > > > On May 9, 8:33 pm, Matthew  wrote:
>
> > > > > > > You can run a script with Postgres or MySQL using this syntax:
>
> > > > > > >     python web2py.py -S myapp -M -R applications/myapp/modules/
> > > > > > > myscript.py
>
> > > > > > > Can a script be ru

[web2py] Re: Running a script with Google App Engine

2010-05-11 Thread Richard
http://code.google.com/appengine/docs/python/taskqueue/overview.html#Task_Execution

"""
If the execution of a particular Task fails (by returning any HTTP
status code outside of the range 200-299), App Engine will attempt to
retry until it succeeds. The system will back off gradually so as not
to flood your application with too many requests, but it will retry
failed tasks at least once a day at minimum.
"""


On May 12, 9:30 am, mdipierro  wrote:
> How safe is this approach? You process 100 records ate the time and
> call the function itself again until done. If this fails for any
> reason (like time constraints imposed by GAE or other GAE db access
> failure), this is not going to call itself again and it will never
> complete. Is it a possibility?
>
> Another issue: your  looping condition is the creation time of the
> record. That works. If the condition where different nothing would
> prevent a new record to be inserted by a different user that would
> fall thought the cracks in the list of records that where already
> processed. This only works for simple queries.
>
> Massimo
>
> On May 11, 5:38 pm, howesc  wrote:
>
> > yes, it applies to the dev environment as well.
>
> > i have not used bulk inserts yet, but they would have to run as a
> > controller that is accessible via URL.  (at least as far as i can
> > tell).  Even the bulkloader.py tool distributed with the SDK talks to
> > a particular app URL and does everything in 30 second chunks.
>
> > here is an example of an upgrade i had to do where i needed to add a
> > new field to the database, and make sure all existing records had a
> > default value for that field (because queries with filters on unset
> > values don't work on google app engine).  I ran it by hitting the URL,
> > and when it ran out of time it just queued itself to keep going.  if
> > you want to cron it look 
> > athttp://code.google.com/appengine/docs/python/config/cron.html
>
> > i put the controller in default.py, so it was accessed at
> > .appspot.com/app/default/task.html
>
> > 
> > def task():
> >     """
> >     today (19-mar-2010) we are going to use this to add
> > processed_audio
> >     field to recordings
> >     """
> >     return
> >     from google.appengine.api.labs import taskqueue
> >     from google.appengine.runtime import DeadlineExceededError
> >     logging.info("in da task")
>
> >     last_id = request.vars.id.split(".")[0]
>
> >     rows = db((db.recording.created_time >=
> > last_id)).select(db.recording.media,
>
> > orderby=db.recording.created_time,
> >                                             limitby=(0, 100))
> >     try:
> >         #update processed_audio
> >         for r in rows:
> >             media_ids = r['media'].split('|')
> >             processed = False
> >             if media_ids:
> >                  processed=True
>
> > db(db.recording.id==r.id).update(processed_audio=processed)
> >             last_id = r.created_time
> >     except DeadlineExceededError:
> >         logging.info("cutoff at %s" %repr(last_id))
> >         taskqueue.add(url='/default/task', params={'id': last_id})
> >         return
>
> >     if len(rows) < 100:
> >         logging.info("no more rows to process")
> >         return
>
> >     logging.info("finished at %s" %repr(last_id))
> >     taskqueue.add(url='/default/task', params={'id': last_id})
> >     return
> > 
>
> > good luck!
>
> > cfh
>
> > On May 10, 7:14 pm, Matthew  wrote:
>
> > > Does this apply to the dev environment as well? Just fire it up and
> > > run it via localhost?
>
> > > If that's the case, would you mind providing an example or the proper
> > > documentation link to help me get started?
>
> > > Also, since bulk inserts are now possible in 
> > > GAEhttp://groups.google.com/group/web2py/browse_thread/thread/93d3dad847...,
> > > does that mean they're only possible from within the application
> > > itself (not via script)?
>
> > > Thanks,
> > > Matthew
>
> > > On May 10, 7:04 pm, howesc  wrote:
>
> > > > everything on GAE must be called via a URL (it must be a controller/
> > > > function).  if you need to run it periodically look up how to do cron
> > > > on GAE and create your cron.yaml.
>
> > > > @auth.requires_membership() is your friend in this case to limit who
> > > > can call your controller. :)
>
> > > > i have several of these sorts of things running on GAE, and it seems
> > > > to work quite well.
>
> > > > On May 9, 7:14 pm, mdipierro  wrote:
>
> > > > > no
>
> > > > > On May 9, 8:33 pm, Matthew  wrote:
>
> > > > > > You can run a script with Postgres or MySQL using this syntax:
>
> > > > > >     python web2py.py -S myapp -M -R applications/myapp/modules/
> > > > > > myscript.py
>
> > > > > > Can a script be run in this way using App Engine as the datastore?


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

2010-05-11 Thread mdipierro
Glad to hear about this.
Can you tell us in which country and in which field your previous
employer was operating?

On May 11, 7:34 pm, drelyn86  wrote:
> With my previous employer, I used web2py to build a few basic
> applications. One was an application to input and track inventory
> mistakes in warehouse operations. Another was a similar application to
> input and track the results of daily audits performed by each
> warehouse department. I also made an application to provide a daily
> report of the toner and maintenance kit status in 40+ of our
> production printers. Lastly, I made an application that our IT
> department used to manage the logins and permissions of users for each
> of these applications.
> These projects were part of a bigger initiative to ween the facility
> off of dependence on dozens of large and unmaintained Microsoft Access
> databases. The rapid-development and multi-database-friendliness of
> web2py made it the best tool for what I needed.
>
> I won't be able to provide the company name, as I haven't maintained
> contact with my previous employer. Likewise, I will not be able to
> provide a screenshot, as the layout was branded with company logos.
>
> I really like working with web2py. It's the first and only framework I
> have learned so far, and these applications were the first of anything
> useful I have built outside of "Hello World" in any language I have
> ever attempted learning. By no means, do I consider myself a
> programmer... and that's why I think python and web2py works for me
> (the are, however, very talented programmers using web2py).
>
> I was able to talk about this experience in a job-interview that
> landed me at a company that offers MUCH more opportunity. I'd like to
> thank everyone in the web2py community for being so much help and
> doing such a great job.
>
> Yours Truly...
>
> On May 10, 5:09 pm, mdipierro  wrote:
>
> > Anthony made some good 
> > points:http://groups.google.com/group/web2py/msg/a40b27807edc8603
>
> > For now let's concentrate on one of them for now. If you have
> > developed software in web2py that you use internally in your company
> > but you cannot release it open source, would you let us know? Can you
> > tell us what is the software for? Could you provide a screenshot? Can
> > we quote the name of the company?
>
> > Massimo


[web2py] Re: ORM-like DAL

2010-05-11 Thread Richard
there was a discussion about this on the developers mailing list last
week:
http://groups.google.com/group/web2py-developers/browse_thread/thread/778e4015b8fae372


On May 7, 12:50 am, vihang  wrote:
> Hello,
>
> A long time back, someone (mostly probably massimo) had written a few
> lines of code showing how DAL could be extended to be used in class,
> and effective like ORM. I have spent a lot of time searching for this
> on this group, but unable to find it. Any help would be appreciated.
>
> Thanks
> Vihang


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

2010-05-11 Thread drelyn86
With my previous employer, I used web2py to build a few basic
applications. One was an application to input and track inventory
mistakes in warehouse operations. Another was a similar application to
input and track the results of daily audits performed by each
warehouse department. I also made an application to provide a daily
report of the toner and maintenance kit status in 40+ of our
production printers. Lastly, I made an application that our IT
department used to manage the logins and permissions of users for each
of these applications.
These projects were part of a bigger initiative to ween the facility
off of dependence on dozens of large and unmaintained Microsoft Access
databases. The rapid-development and multi-database-friendliness of
web2py made it the best tool for what I needed.

I won't be able to provide the company name, as I haven't maintained
contact with my previous employer. Likewise, I will not be able to
provide a screenshot, as the layout was branded with company logos.

I really like working with web2py. It's the first and only framework I
have learned so far, and these applications were the first of anything
useful I have built outside of "Hello World" in any language I have
ever attempted learning. By no means, do I consider myself a
programmer... and that's why I think python and web2py works for me
(the are, however, very talented programmers using web2py).

I was able to talk about this experience in a job-interview that
landed me at a company that offers MUCH more opportunity. I'd like to
thank everyone in the web2py community for being so much help and
doing such a great job.

Yours Truly...

On May 10, 5:09 pm, mdipierro  wrote:
> Anthony made some good 
> points:http://groups.google.com/group/web2py/msg/a40b27807edc8603
>
> For now let's concentrate on one of them for now. If you have
> developed software in web2py that you use internally in your company
> but you cannot release it open source, would you let us know? Can you
> tell us what is the software for? Could you provide a screenshot? Can
> we quote the name of the company?
>
> Massimo


[web2py] Re: Running a script with Google App Engine

2010-05-11 Thread mdipierro
How safe is this approach? You process 100 records ate the time and
call the function itself again until done. If this fails for any
reason (like time constraints imposed by GAE or other GAE db access
failure), this is not going to call itself again and it will never
complete. Is it a possibility?

Another issue: your  looping condition is the creation time of the
record. That works. If the condition where different nothing would
prevent a new record to be inserted by a different user that would
fall thought the cracks in the list of records that where already
processed. This only works for simple queries.

Massimo

On May 11, 5:38 pm, howesc  wrote:
> yes, it applies to the dev environment as well.
>
> i have not used bulk inserts yet, but they would have to run as a
> controller that is accessible via URL.  (at least as far as i can
> tell).  Even the bulkloader.py tool distributed with the SDK talks to
> a particular app URL and does everything in 30 second chunks.
>
> here is an example of an upgrade i had to do where i needed to add a
> new field to the database, and make sure all existing records had a
> default value for that field (because queries with filters on unset
> values don't work on google app engine).  I ran it by hitting the URL,
> and when it ran out of time it just queued itself to keep going.  if
> you want to cron it look 
> athttp://code.google.com/appengine/docs/python/config/cron.html
>
> i put the controller in default.py, so it was accessed at
> .appspot.com/app/default/task.html
>
> 
> def task():
>     """
>     today (19-mar-2010) we are going to use this to add
> processed_audio
>     field to recordings
>     """
>     return
>     from google.appengine.api.labs import taskqueue
>     from google.appengine.runtime import DeadlineExceededError
>     logging.info("in da task")
>
>     last_id = request.vars.id.split(".")[0]
>
>     rows = db((db.recording.created_time >=
> last_id)).select(db.recording.media,
>
> orderby=db.recording.created_time,
>                                             limitby=(0, 100))
>     try:
>         #update processed_audio
>         for r in rows:
>             media_ids = r['media'].split('|')
>             processed = False
>             if media_ids:
>                  processed=True
>
> db(db.recording.id==r.id).update(processed_audio=processed)
>             last_id = r.created_time
>     except DeadlineExceededError:
>         logging.info("cutoff at %s" %repr(last_id))
>         taskqueue.add(url='/default/task', params={'id': last_id})
>         return
>
>     if len(rows) < 100:
>         logging.info("no more rows to process")
>         return
>
>     logging.info("finished at %s" %repr(last_id))
>     taskqueue.add(url='/default/task', params={'id': last_id})
>     return
> 
>
> good luck!
>
> cfh
>
> On May 10, 7:14 pm, Matthew  wrote:
>
> > Does this apply to the dev environment as well? Just fire it up and
> > run it via localhost?
>
> > If that's the case, would you mind providing an example or the proper
> > documentation link to help me get started?
>
> > Also, since bulk inserts are now possible in 
> > GAEhttp://groups.google.com/group/web2py/browse_thread/thread/93d3dad847...,
> > does that mean they're only possible from within the application
> > itself (not via script)?
>
> > Thanks,
> > Matthew
>
> > On May 10, 7:04 pm, howesc  wrote:
>
> > > everything on GAE must be called via a URL (it must be a controller/
> > > function).  if you need to run it periodically look up how to do cron
> > > on GAE and create your cron.yaml.
>
> > > @auth.requires_membership() is your friend in this case to limit who
> > > can call your controller. :)
>
> > > i have several of these sorts of things running on GAE, and it seems
> > > to work quite well.
>
> > > On May 9, 7:14 pm, mdipierro  wrote:
>
> > > > no
>
> > > > On May 9, 8:33 pm, Matthew  wrote:
>
> > > > > You can run a script with Postgres or MySQL using this syntax:
>
> > > > >     python web2py.py -S myapp -M -R applications/myapp/modules/
> > > > > myscript.py
>
> > > > > Can a script be run in this way using App Engine as the datastore?


[web2py] Re: ORM-like DAL

2010-05-11 Thread Jon Romero
Check this out (needs a lot of work)
http://bitbucket.org/jonromero/pyactiverecord/src/324551741662

On May 11, 8:10 am, vihang  wrote:
> I had seen the alterego posting. but that is more from using a Table
> instance. I am looking at true ORM capability where I create a class
> with methods which act on the model/db. I am hoping if anyone can find
> that snippet of code, its worth putting in the doc/manual/alterEgo
>
> On May 6, 8:50 pm, Thadeus Burgess  wrote:> I frankly 
> remember a guy posting something (github?) that makes an ORM
> > for the DAL, and it was a class you could almost put any kind of
> > database to it.
>
> > I too have been curious where this snippet of code ran off too.
>
> > --
> > Thadeus
>
> > On Thu, May 6, 2010 at 9:53 AM, mdipierro  wrote:
> > > I think you refer to this:
> > >http://web2py.com/AlterEgo/default/show/189
>
> > > On May 6, 9:50 am, vihang  wrote:
> > >> Hello,
>
> > >> A long time back, someone (mostly probably massimo) had written a few
> > >> lines of code showing how DAL could be extended to be used in class,
> > >> and effective like ORM. I have spent a lot of time searching for this
> > >> on this group, but unable to find it. Any help would be appreciated.
>
> > >> Thanks
> > >> Vihang


[web2py] Re: Review my web2py app: Radbox.me

2010-05-11 Thread b00m_chef
FYI:

Fix your routes.py
http://radbox.me/index.html  = Invalid Controller.



On May 11, 2:40 am, Adi  wrote:
> I saw some discussions flying around about web2py applications and
> users out there (http://groups.google.com/group/web2py/browse_thread/
> thread/606b6e90744ab3b5)
> and thought it would be a good time to talk about my application.
>
> Radbox (http://radbox.me) is a video bookmarking service. Its still a
> very young product, but I believe its pretty good at what it does.
>
> Right now we're using web2py 1.77.3 for the application.
>
> It has quite a few interesting features from a web2py developer's
> perspective:
>
> - custom auth_user table
> - Facebook integration for sign-up and (very very soon) publish to
> wall
> - generic embedded video display using swfobject
> - Twitter @anywhere integration (this is only in the view layer using
> javascript)
> - url rewrite using routes.py
> - RSS feed (only for users, not visitors)
> - Ajax "Like" and "Archive" implementation for every video
>
> Many other things are under development. I mentioned the above because
> lots of questions in this group are asked about these features.
>
> Please take the app for a test drive, let me know your feedback and
> questions on the implementation. My team and I are more than happy to
> recommend web2py for full-blown professional web applications, and
> we'll continue to bug this community (specially Massimo and Theadus)
> every time we hit a rough patch. :)


[web2py] Re: Letting one user access a particular page at a time (queuing)...

2010-05-11 Thread mdipierro
This is similar to yours but I am posting it anyway:

db.define_table('robot',
Field('user_id',db.auth_user),
Field('time_request_control','datetime'),
Field('time_start_control','datetime'),
Field('time_stop_control','datetime'),
Field('status',default='pending',
 
requires=IS_IN_SET(('queued','running','cancelled','done'

def has_control(user_id,seconds=300):
import datetime
# if user aready has control return
true
if db(db.robot.user_id==user_id)
(db.robot.status=='running').select().first():
return True
# if you have not done so, request
control:
if not db(db.robot.user_id==user_id)
(db.robot.status=='queued').count():
 
db.robot.insert(user_id=user_id,time_request_control=request.now,status='queued')
# if somebody lese has control return
false
# but if somebody else control expired take away
control
row=db(db.robot.user_id!=user_id)
(db.robot.status=='running').select().first()
if row:
if row.time_stop_control>=request.now:
return False
row.update_record(status='done')
# if nobody else has control of robot, look for next is
queue
row =
db(db.robot.status=='queued').select(orderby=db.robot.time_request_control).first()
# if user_id is next in queue, give him
control
if row.user_id==user_id:
row.update_record(time_start_control=request.now,
  time_stop_control=request.now
+datetime.timedelta(seconds=seconds),
  status='running')
return True
# else somebody else is next in
queue
else:
# TODO eventually if somebody requested control but does not
exercise for X secs,
# control should be
revoked.
return False

so just call has_access(auth.user_id) and it returns true if user has
control of the robot.


On May 11, 1:57 pm, Jason Brower  wrote:
> Peter and I are trying to implement a queuing feature in a webpage.
> Basically if the user is logged in, he can wait in line for getting to
> run a robot from a particular page.  I gave it my best shot and couldn't
> figure it out.
> We need it to be able to have one person access a page at a time and
> they can be in and out of that page for 5 minutes before someone else
> comes in.
> I think we could have a page that has a counter, it refreshes every 30
> seconds and redirects the page if their time is up.
> Please help as it's a real chance for web2py to shine in this school.
> After working with Peter I have come up with the following solution
> which I think is pretty close.
> 
> import time
> @auth.requires_login()
> def run_robot():
>     id = auth.user.id
>     user_in_queue = db(db.queue.users_id == id).select()
>     if len(user_in_queue):
>         if session.in_now:
>             users_in_queue = db().select(db.queue.ALL, orderby =
> db.queue.end_time)
>             last_time = 0
>             for person in users_in_queue:
>                 last_time = person.end_time
>             return dict(user_in_queue = user_in_queue)
>             if user_in_queue[0].end_time < time.time():
>                 response.flash = "you can still be here."
> return dict() #redirect(URL(r=request,c='default',f='index'))
>         else:
>             #redirect(URL(r=request,c='default',f='index'))
>     else:
>         users_in_queue = db().select(db.queue.ALL, orderby =
> db.queue.end_time)
>         last_time = 0
>         for person in users_in_queue:
>             last_time = users_in_queue.end_time
>         response.flash = last_time
>         session.time_to_wait = int(time.time())+(60*len(users_in_queue))
> current_time = time.time()
>         time_to_wait = (60*len(users_in_queue))
>         start_time = int(time.time())
>         end_time = int(session.time_to_wait + 60)
>         db.queue.insert(users_id = id, end_time = end_time,
> start_time=start_time) # we add that active user to the queue and add
> time to the current time to get the end time.
>     return dict(start_time = start_time, end_time = end_time, last_time
> = last_time)
> 


[web2py] Re: Routes.py on GAE

2010-05-11 Thread mdipierro
I just posted a new gluon.rewrite.py in trunk that should report more
details about your error.

Massimo


On May 11, 7:53 am, Chris S  wrote:
> The routes.py file that I am attempting to use is:
> ---
> routes_in = (('/favicon.ico', '/init/static/favicon.ico'),
>              ('/robots.txt', '/init/static/robots.txt'),
> )
> routes_out = ()
> ---
> I believe that is a direct copy and paste of the example from the
> online book.
>
> On May 10, 6:04 pm, mdipierro  wrote:
>
> > As far as I know it works well on GAE. The errors you get:
>
> > "Your routes.py has a syntax error. Please fix it before you restart"
>
> > indicates that there is an error in your routes.py.
> > If you post it we can help you isolate the problem.
>
> > Massimo
>
> > On May 10, 4:23 pm, Chris S  wrote:
>
> > > Does routes.py work on GAE?  I've recently deployed an app which used
> > > the 5-line routes.py from the book for routing robots.txt and
> > > favicon.icon.  I just wanted to get rid of that 100% error rate on
> > > those two files.  I recevied the following message.  Only after
> > > removing routes.py again did the app launch properly.
>
> > > begin error message
> > > #
> > > 05-10 01:18PM 34.771
> > > unable to import Rocket
>
> > > #
> > > E 05-10 01:18PM 34.774
> > > Your routes.py has a syntax error. Please fix it before you restart
> > > web2py
>
> > > #
> > > E 05-10 01:18PM 34.778
> > > : invalid syntax (, line 3)
> > > Traceback (most recent call last):
> > >   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> > > gaehandler.py", line 44, in 
> > >     import gluon.main
> > >   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> > > gluon/main.py", line 66, in 
> > >     rewrite.load()
> > >   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> > > gluon/rewrite.py", line 63, in load
> > >     raise e


[web2py] Re: Running a script with Google App Engine

2010-05-11 Thread howesc
yes, it applies to the dev environment as well.

i have not used bulk inserts yet, but they would have to run as a
controller that is accessible via URL.  (at least as far as i can
tell).  Even the bulkloader.py tool distributed with the SDK talks to
a particular app URL and does everything in 30 second chunks.

here is an example of an upgrade i had to do where i needed to add a
new field to the database, and make sure all existing records had a
default value for that field (because queries with filters on unset
values don't work on google app engine).  I ran it by hitting the URL,
and when it ran out of time it just queued itself to keep going.  if
you want to cron it look at 
http://code.google.com/appengine/docs/python/config/cron.html

i put the controller in default.py, so it was accessed at
.appspot.com/app/default/task.html


def task():
"""
today (19-mar-2010) we are going to use this to add
processed_audio
field to recordings
"""
return
from google.appengine.api.labs import taskqueue
from google.appengine.runtime import DeadlineExceededError
logging.info("in da task")

last_id = request.vars.id.split(".")[0]

rows = db((db.recording.created_time >=
last_id)).select(db.recording.media,
 
orderby=db.recording.created_time,
limitby=(0, 100))
try:
#update processed_audio
for r in rows:
media_ids = r['media'].split('|')
processed = False
if media_ids:
 processed=True
 
db(db.recording.id==r.id).update(processed_audio=processed)
last_id = r.created_time
except DeadlineExceededError:
logging.info("cutoff at %s" %repr(last_id))
taskqueue.add(url='/default/task', params={'id': last_id})
return

if len(rows) < 100:
logging.info("no more rows to process")
return

logging.info("finished at %s" %repr(last_id))
taskqueue.add(url='/default/task', params={'id': last_id})
return


good luck!

cfh

On May 10, 7:14 pm, Matthew  wrote:
> Does this apply to the dev environment as well? Just fire it up and
> run it via localhost?
>
> If that's the case, would you mind providing an example or the proper
> documentation link to help me get started?
>
> Also, since bulk inserts are now possible in 
> GAEhttp://groups.google.com/group/web2py/browse_thread/thread/93d3dad847...,
> does that mean they're only possible from within the application
> itself (not via script)?
>
> Thanks,
> Matthew
>
> On May 10, 7:04 pm, howesc  wrote:
>
> > everything on GAE must be called via a URL (it must be a controller/
> > function).  if you need to run it periodically look up how to do cron
> > on GAE and create your cron.yaml.
>
> > @auth.requires_membership() is your friend in this case to limit who
> > can call your controller. :)
>
> > i have several of these sorts of things running on GAE, and it seems
> > to work quite well.
>
> > On May 9, 7:14 pm, mdipierro  wrote:
>
> > > no
>
> > > On May 9, 8:33 pm, Matthew  wrote:
>
> > > > You can run a script with Postgres or MySQL using this syntax:
>
> > > >     python web2py.py -S myapp -M -R applications/myapp/modules/
> > > > myscript.py
>
> > > > Can a script be run in this way using App Engine as the datastore?


[web2py] hello

2010-05-11 Thread ciprian
i used this script to install web2py:
http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh

so i have everything in www-data
and everything works fine.

now..what do i have to install to make php work on the same folder? or
what do i have to config. i have a very old app writed on php so i
want to be able to add on the server the demo - because i am rewriting
my site from php to web2py.

any help would be very helpful for me!


[web2py] Re: Routes.py on GAE

2010-05-11 Thread mdipierro
Do you get this error only after deplyment or also locally with
dev_appserver?

On May 11, 7:53 am, Chris S  wrote:
> The routes.py file that I am attempting to use is:
> ---
> routes_in = (('/favicon.ico', '/init/static/favicon.ico'),
>              ('/robots.txt', '/init/static/robots.txt'),
> )
> routes_out = ()
> ---
> I believe that is a direct copy and paste of the example from the
> online book.
>
> On May 10, 6:04 pm, mdipierro  wrote:
>
> > As far as I know it works well on GAE. The errors you get:
>
> > "Your routes.py has a syntax error. Please fix it before you restart"
>
> > indicates that there is an error in your routes.py.
> > If you post it we can help you isolate the problem.
>
> > Massimo
>
> > On May 10, 4:23 pm, Chris S  wrote:
>
> > > Does routes.py work on GAE?  I've recently deployed an app which used
> > > the 5-line routes.py from the book for routing robots.txt and
> > > favicon.icon.  I just wanted to get rid of that 100% error rate on
> > > those two files.  I recevied the following message.  Only after
> > > removing routes.py again did the app launch properly.
>
> > > begin error message
> > > #
> > > 05-10 01:18PM 34.771
> > > unable to import Rocket
>
> > > #
> > > E 05-10 01:18PM 34.774
> > > Your routes.py has a syntax error. Please fix it before you restart
> > > web2py
>
> > > #
> > > E 05-10 01:18PM 34.778
> > > : invalid syntax (, line 3)
> > > Traceback (most recent call last):
> > >   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> > > gaehandler.py", line 44, in 
> > >     import gluon.main
> > >   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> > > gluon/main.py", line 66, in 
> > >     rewrite.load()
> > >   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> > > gluon/rewrite.py", line 63, in load
> > >     raise e


[web2py] Re: is row.update(name='someone') really works??

2010-05-11 Thread mdipierro
It is either

db(query).update(...)

or

for row in db(query).select(): row.update_record(...)


row.update(...) #WRONG BECUASE THIS IS PYTHON UPDATE METHOD

On May 11, 3:03 pm, Phyo Arkar  wrote:
> I did used Mercurial version Tagged 1.77.3 from googlecode. That is Same
> with release version 1.77.3 right?
>
> On Sat, May 8, 2010 at 10:10 PM, Thadeus Burgess wrote:
>
> > Looks like you are not running the latest version of web2py .
>
> > --
> > Thadeus
>
> > On Sat, May 8, 2010 at 4:34 PM, Eldr3D  wrote:
> > > Hello all
>
> > > i just back to web2py a few weeks ago and i am still learning all the
> > > new changes reading online official web2py book.
>
> > > currently i am using web2py DALs in a non web-application , so to
> > > parse and import data from text files into database (to update
> > > records).
>
> > > here is the example of what i am doing :
>
> > > from gluon.sql import DAL,SQLTable,SQLField,Field
> > > import os,time
> > > import glob
> > > db = DAL('mysql://r...@localhost/cds')
> > > i=0
> > > db.define_table('cdsdata',
> > >                Field('docID','string'),
> > >                Field('grpID','string'),
> > >                Field('author','string'),
> > >                Field('subject','string'),
> > >                Field('sentto','string'),
> > >                Field('cc','string'),
> > >                Field('bcc','string'),
> > >                Field('sentDate','string'),
> > >                Field('type','string'),
> > >                Field('extracted','text'),migrate=False)
>
> > > rows=db(db.cdsdata.id>0).select('extracted')
>
> > > for row in rows:
> > >    row.update(extracted=open("./exp/" + row.values()[0].values()[0]
> > > [-13:-1],'r').read())
> > >    i+=1
> > >    if i==1000:
> > >        time.sleep(0.5)
> > >        print "Updated Records : " + total
> > >        i=0
> > >        total+=1000
>
> > > db.commit()
> > > db.update()
>
> > > well it tries to update the rows but , they are not actually updated
> > > inside the database..
>
> > > also , is row.update_record() method is never existed? coz i cant call
> > > that function anymore..
>
> > > but what weird is when i try to do :
>
> > > db(db.cdsdata.id==1).update(extracted=" This is updated
> > > text!")
>
> > > it works flawlessly!
>
> > > So row.update is dosen't really work ?
> > > and row.update_record() never exist?
> > > :
>
> > > In [15]: row.update_record()
>
> > ---
> > > KeyError                                  Traceback (most recent call
> > > last)
>
> > > /home/v3ss/db_importer/ in ()
>
> > > /home/v3ss/db_importer/gluon/sql.pyc in __getattr__(self, key)
> > >    662
> > >    663     def __getattr__(self, key):
> > > --> 664         return dict.__getitem__(self,key)
> > >    665
> > >    666     def __setattr__(self, key, value):
>
> > > KeyError: 'update_record'


Re: [web2py] Adding a new domain

2010-05-11 Thread Alexandre Andrade
Please, don't read/use my previous email..., it is for another situation:
using php and web2py at same server.

Alexandre Andrade.



2010/5/11 Alexandre Andrade 

> I put  a example vhost file at
> http://alexandremas.blogspot.com/2010/02/como-configurar-web2py-e-php-no-mesmo.html
>
> (the original language is portuguese, but you can use the example)
>
> Alexandre Andrade
>
>
>
> 2010/5/11 Andrew Evans 
>
> Hello I am using web2py on my server and would like to set up a new
>> domain to add to it
>>
>> right now it sits at http://serv.cyber-samurai.de
>>
>> I am running apache + wsgi I have my additional domain pointed to the
>> server but I am unsure how to configure web2py how to use it.
>>
>> Do I create a new application with that domain?
>>
>> suggestions
>>
>> Thank You
>>
>
>
>
> --
> Atenciosamente
>
> --
> =
> Alexandre Andrade
> Hipercenter.com
>



-- 
Atenciosamente

-- 
=
Alexandre Andrade
Hipercenter.com


Re: [web2py] Adding a new domain

2010-05-11 Thread Alexandre Andrade
I put  a example vhost file at
http://alexandremas.blogspot.com/2010/02/como-configurar-web2py-e-php-no-mesmo.html

(the original language is portuguese, but you can use the example)

Alexandre Andrade



2010/5/11 Andrew Evans 

> Hello I am using web2py on my server and would like to set up a new
> domain to add to it
>
> right now it sits at http://serv.cyber-samurai.de
>
> I am running apache + wsgi I have my additional domain pointed to the
> server but I am unsure how to configure web2py how to use it.
>
> Do I create a new application with that domain?
>
> suggestions
>
> Thank You
>



-- 
Atenciosamente

-- 
=
Alexandre Andrade
Hipercenter.com


Re: [web2py] Re: SSL Error on windows

2010-05-11 Thread Miguel Lopes
On Tue, May 11, 2010 at 9:41 PM, mr.freeze  wrote:

> Do you have the win32 extension for Python installed?
> http://sourceforge.net/projects/pywin32/
>
>
No. Maybe that's he problem.
Tomorrow I'll re-test the thing with pywin32 installed.
Miguel


Re: [web2py] Re: Using LOAD from a controller?

2010-05-11 Thread Keith Edmunds
Sorry, Iceburg, I appreciate your attempt to help, but you've lost me
completely! Can you explain?

Thanks


[web2py] Re: SSL Error on windows

2010-05-11 Thread mr.freeze
Do you have the win32 extension for Python installed?
http://sourceforge.net/projects/pywin32/

On May 11, 3:33 pm, Miguel Lopes  wrote:
> On Tue, May 11, 2010 at 7:54 PM, mdipierro  wrote:
> > This is concerns me more:
>
> > WARNING:root:WEB2PY CRON: Disabled because no file locking
>
> > what os are you using?
>
> Windows XP I can check the flavour and service pack tomorrow.


Re: [web2py] Re: SSL Error on windows

2010-05-11 Thread Miguel Lopes
On Tue, May 11, 2010 at 7:54 PM, mdipierro  wrote:

> This is concerns me more:
>
> WARNING:root:WEB2PY CRON: Disabled because no file locking
>
> what os are you using?
>
>
Windows XP I can check the flavour and service pack tomorrow.


[web2py] Re: Using LOAD from a controller?

2010-05-11 Thread Iceberg
def function_A():
return {'something':'blah blah'}

def function_B():
return {another_thing}

then in function_A.html you can use:
{{=something}} {{=LOAD(URL(r=request,f='function_B'),ajax=True)}}

On May12, 4:16am, Keith Edmunds  wrote:
> I was to display a form using Ajax in response to a click on a link on the
> page. I have tried putting this in the view:
>
> New todo
> 
>
> with this in the controller:
>
> def new():
>
>     return = LOAD('todo','todo_form',ajax=True)
>
> def todo_form():
>     form = SQLFORM(db.tasks,fields=['priority','subject','duedate'])
>     if form.accepts(request.vars,session):
>         session.flash = 'record inserted'
>         redirect(URL(request.application,'default','index'))
>     return form
>
> ...but that doesn't work.
>
> I don't think I've fully understood how LOAD works - can someone point me
> in the right direction, please?


Re: [web2py] Using LOAD from a controller?

2010-05-11 Thread Keith Edmunds
On Tue, 11 May 2010 21:16:45 +0100, k...@midnighthax.com said:

> return = LOAD('todo','todo_form',ajax=True)

Typo in my mail: that is actually

return LOAD('todo','todo_form',ajax=True)


[web2py] Using LOAD from a controller?

2010-05-11 Thread Keith Edmunds
I was to display a form using Ajax in response to a click on a link on the
page. I have tried putting this in the view:

New todo


with this in the controller:

def new():

return = LOAD('todo','todo_form',ajax=True)

def todo_form():
form = SQLFORM(db.tasks,fields=['priority','subject','duedate'])
if form.accepts(request.vars,session):
session.flash = 'record inserted'
redirect(URL(request.application,'default','index'))
return form

...but that doesn't work.

I don't think I've fully understood how LOAD works - can someone point me
in the right direction, please?


[web2py] Re: Display Sum of values

2010-05-11 Thread greenpoise
This works. I need some guidance as to where to look because I am
going to be dealing with more calculations that includes
multiplications.


Thanks


dan

On May 11, 2:34 pm, mdipierro  wrote:
> I personally do not. The university I work for (DePaul Universty)
> offers this certificate 
> program:http://www.cdm.depaul.edu/ipd/Programs/Pages/WebDevelopmentwithPython...
> (as long as other programs on Java and Rails and more).
>
> I teach it. I may teach it in Fall but I am not sure yet.
>
> Massimo
>
> On May 11, 1:24 pm, greenpoise  wrote:
>
> > will try. Thanks.
>
> > ** Dont know if this is the appropriate place to ask for this but
> > looking around the group I saw a post about a class certificate
> > offering. Do you have an online class by any chance?
>
> > On May 11, 2:16 pm, mdipierro  wrote:
>
> > > First I would rewrite it as
>
> > > def view_totals():
> > >     rows = db().select(db.tableorder.ALL,
> > > db.tableorder.totalsale.sum(),groupby=db.tableorder.orderdate)
> > >     for row in rows: print
> > > row.tableorder.ordernumber,row[db.tableorder.totalsale.sum()]
> > >     return dict(rows=rows)
>
> > > 
> > > {{for row in rows:}}
> > > {{= row.tableorder.ordernumber}} > > td>{{=row[db.tableorder.totalsale.sum()]}}
> > > {{pass}}
> > > 
>
> > > On May 11, 12:37 pm, greenpoise  wrote:
>
> > > > I have this:
>
> > > > def view_totals():
> > > >     rows = db().select(db.tableorder.ALL, 'sum(tableorder.totalsale)',
> > > > groupby=db.tableorder.orderdate)
> > > >     for row in rows: print row.tableorder.ordernumber,
> > > > row._extra['sum(tableorder.totalsale)']
> > > >     return dict()
>
> > > > What would be my view to present my sum?


Re: [web2py] is row.update(name='someone') really works??

2010-05-11 Thread Phyo Arkar
I did used Mercurial version Tagged 1.77.3 from googlecode. That is Same
with release version 1.77.3 right?

On Sat, May 8, 2010 at 10:10 PM, Thadeus Burgess wrote:

> Looks like you are not running the latest version of web2py .
>
> --
> Thadeus
>
>
>
>
>
> On Sat, May 8, 2010 at 4:34 PM, Eldr3D  wrote:
> > Hello all
> >
> > i just back to web2py a few weeks ago and i am still learning all the
> > new changes reading online official web2py book.
> >
> > currently i am using web2py DALs in a non web-application , so to
> > parse and import data from text files into database (to update
> > records).
> >
> >
> > here is the example of what i am doing :
> >
> > from gluon.sql import DAL,SQLTable,SQLField,Field
> > import os,time
> > import glob
> > db = DAL('mysql://r...@localhost/cds')
> > i=0
> > db.define_table('cdsdata',
> >Field('docID','string'),
> >Field('grpID','string'),
> >Field('author','string'),
> >Field('subject','string'),
> >Field('sentto','string'),
> >Field('cc','string'),
> >Field('bcc','string'),
> >Field('sentDate','string'),
> >Field('type','string'),
> >Field('extracted','text'),migrate=False)
> >
> >
> > rows=db(db.cdsdata.id>0).select('extracted')
> >
> > for row in rows:
> >row.update(extracted=open("./exp/" + row.values()[0].values()[0]
> > [-13:-1],'r').read())
> >i+=1
> >if i==1000:
> >time.sleep(0.5)
> >print "Updated Records : " + total
> >i=0
> >total+=1000
> >
> > db.commit()
> > db.update()
> >
> >
> > well it tries to update the rows but , they are not actually updated
> > inside the database..
> >
> > also , is row.update_record() method is never existed? coz i cant call
> > that function anymore..
> >
> > but what weird is when i try to do :
> >
> > db(db.cdsdata.id==1).update(extracted=" This is updated
> > text!")
> >
> > it works flawlessly!
> >
> > So row.update is dosen't really work ?
> > and row.update_record() never exist?
> > :
> >
> >
> > In [15]: row.update_record()
> >
> ---
> > KeyError  Traceback (most recent call
> > last)
> >
> > /home/v3ss/db_importer/ in ()
> >
> > /home/v3ss/db_importer/gluon/sql.pyc in __getattr__(self, key)
> >662
> >663 def __getattr__(self, key):
> > --> 664 return dict.__getitem__(self,key)
> >665
> >666 def __setattr__(self, key, value):
> >
> > KeyError: 'update_record'
> >
> >
> >
>


Re: [web2py] is row.update(name='someone') really works??

2010-05-11 Thread Phyo Arkar
Yes i did use that way:

rows=db(db.cdsdata.id>0).select(db.cdsdata.id, db.cdsdata.extracted)


But why update_record giving Key error (That method is not found)..

On Sat, May 8, 2010 at 11:46 PM, Vasile Ermicioi  wrote:

> web2py is always backward compatible, you can use either row.update or
> row.update_record
> but if you use db(db.cdsdata.id>0).select('extracted') you can't use
> update_record because your rows didn't received an id from db
> so you ca use any of this
>
> rows=db(db.cdsdata.id>0).select()
> rows=db(db.cdsdata.id>0).select(db.cdsdata.ALL)
>
> or  just id and extracted if you are not going to use other fields
>
> rows=db(db.cdsdata.id>0).select(db.cdsdata.id, db.cdsdata.extracted)
>
>
>
>
>


Re: [web2py] Re: Review my web2py app: Radbox.me

2010-05-11 Thread Thadeus Burgess
This is great! You guys did such a nice job, many kudos!

--
Thadeus





On Tue, May 11, 2010 at 1:55 PM, b00m_chef  wrote:
> Great job!  I am happy to see web2py apps that don't just use the
> default admin interface design, and actually do their own.
>
>
>
> On May 11, 2:40 am, Adi  wrote:
>> I saw some discussions flying around about web2py applications and
>> users out there (http://groups.google.com/group/web2py/browse_thread/
>> thread/606b6e90744ab3b5)
>> and thought it would be a good time to talk about my application.
>>
>> Radbox (http://radbox.me) is a video bookmarking service. Its still a
>> very young product, but I believe its pretty good at what it does.
>>
>> Right now we're using web2py 1.77.3 for the application.
>>
>> It has quite a few interesting features from a web2py developer's
>> perspective:
>>
>> - custom auth_user table
>> - Facebook integration for sign-up and (very very soon) publish to
>> wall
>> - generic embedded video display using swfobject
>> - Twitter @anywhere integration (this is only in the view layer using
>> javascript)
>> - url rewrite using routes.py
>> - RSS feed (only for users, not visitors)
>> - Ajax "Like" and "Archive" implementation for every video
>>
>> Many other things are under development. I mentioned the above because
>> lots of questions in this group are asked about these features.
>>
>> Please take the app for a test drive, let me know your feedback and
>> questions on the implementation. My team and I are more than happy to
>> recommend web2py for full-blown professional web applications, and
>> we'll continue to bug this community (specially Massimo and Theadus)
>> every time we hit a rough patch. :)
>


[web2py] Letting one user access a particular page at a time (queuing)...

2010-05-11 Thread Jason Brower
Peter and I are trying to implement a queuing feature in a webpage.
Basically if the user is logged in, he can wait in line for getting to
run a robot from a particular page.  I gave it my best shot and couldn't
figure it out.
We need it to be able to have one person access a page at a time and
they can be in and out of that page for 5 minutes before someone else
comes in.
I think we could have a page that has a counter, it refreshes every 30
seconds and redirects the page if their time is up.
Please help as it's a real chance for web2py to shine in this school.
After working with Peter I have come up with the following solution
which I think is pretty close.

import time
@auth.requires_login()
def run_robot():
id = auth.user.id
user_in_queue = db(db.queue.users_id == id).select()
if len(user_in_queue):
if session.in_now:
users_in_queue = db().select(db.queue.ALL, orderby =
db.queue.end_time)
last_time = 0
for person in users_in_queue:
last_time = person.end_time
return dict(user_in_queue = user_in_queue)
if user_in_queue[0].end_time < time.time():
response.flash = "you can still be here."
return dict() #redirect(URL(r=request,c='default',f='index'))
else:
#redirect(URL(r=request,c='default',f='index'))
else:
users_in_queue = db().select(db.queue.ALL, orderby =
db.queue.end_time)
last_time = 0
for person in users_in_queue:
last_time = users_in_queue.end_time
response.flash = last_time
session.time_to_wait = int(time.time())+(60*len(users_in_queue))
current_time = time.time()
time_to_wait = (60*len(users_in_queue))
start_time = int(time.time())
end_time = int(session.time_to_wait + 60)
db.queue.insert(users_id = id, end_time = end_time,
start_time=start_time) # we add that active user to the queue and add
time to the current time to get the end time.
return dict(start_time = start_time, end_time = end_time, last_time
= last_time)




[web2py] Re: Review my web2py app: Radbox.me

2010-05-11 Thread b00m_chef
Great job!  I am happy to see web2py apps that don't just use the
default admin interface design, and actually do their own.



On May 11, 2:40 am, Adi  wrote:
> I saw some discussions flying around about web2py applications and
> users out there (http://groups.google.com/group/web2py/browse_thread/
> thread/606b6e90744ab3b5)
> and thought it would be a good time to talk about my application.
>
> Radbox (http://radbox.me) is a video bookmarking service. Its still a
> very young product, but I believe its pretty good at what it does.
>
> Right now we're using web2py 1.77.3 for the application.
>
> It has quite a few interesting features from a web2py developer's
> perspective:
>
> - custom auth_user table
> - Facebook integration for sign-up and (very very soon) publish to
> wall
> - generic embedded video display using swfobject
> - Twitter @anywhere integration (this is only in the view layer using
> javascript)
> - url rewrite using routes.py
> - RSS feed (only for users, not visitors)
> - Ajax "Like" and "Archive" implementation for every video
>
> Many other things are under development. I mentioned the above because
> lots of questions in this group are asked about these features.
>
> Please take the app for a test drive, let me know your feedback and
> questions on the implementation. My team and I are more than happy to
> recommend web2py for full-blown professional web applications, and
> we'll continue to bug this community (specially Massimo and Theadus)
> every time we hit a rough patch. :)


[web2py] Re: SSL Error on windows

2010-05-11 Thread mdipierro
This is concerns me more:

WARNING:root:WEB2PY CRON: Disabled because no file locking

what os are you using?

On May 11, 1:28 pm, Miguel Lopes  wrote:
> I followed thewww.web2py.com/AlterEgo/default/show/140in order to generate
> a self-certified ssl key using OpenSSL for 
> windows(http://www.slproweb.com/products/Win32OpenSSL.html)
>
> The certificates are in the web2py folder
>
> Running web2py I get this error:
>
> C:\Programas\web2py>c:\python26\python web2py.py -c server.crt -k server.key
> -a "" -i **.*.*.*** -p 8080
> WARNING:root:no file locking
> web2py Enterprise Web Framework
> Created by Massimo Di Pierro, Copyright 2007-2010
> Version 1.77.3 (2010-04-20 02:48:54)
> Database drivers available: SQLite3, PostgreSQL
> Starting hardcron...
> WARNING:root:WEB2PY CRON: Disabled because no file locking
> please visit:
>         http://**.*.*.***:8080
> use "kill -SIGTERM 396" to shutdown the web2py server
> WARNING:root:WEB2PY CRON: Disabled because no file locking
> ERROR:Rocket.Errors.ThreadPool:Traceback (most recent call last):
>   File "C:\Programas\web2py\gluon\rocket.py", line 300, in start
>     self._threadpool.queue.put((l.accept(),
>   File "c:\python26\lib\ssl.py", line 326, in accept
>     suppress_ragged_eofs=self.suppress_ragged_eofs),
>   File "c:\python26\lib\ssl.py", line 118, in __init__
>     self.do_handshake()
>   File "c:\python26\lib\ssl.py", line 293, in do_handshake
>     self._sslobj.do_handshake()
> SSLError: [Errno 1] _ssl.c:480: error:1407609C:SSL
> routines:SSL23_GET_CLIENT_HEL
> LO:http request
>
> Any ideas?
> Miguel


[web2py] Re: JqGrid Plugin

2010-05-11 Thread mdipierro
I think you should do this... in controllers/plugin_jqgrid.py function
data() contains

def f(value,fieldname):
r = table[fieldname].represent
if r: return r(value)
return value

replace it with

from gluon.html import xmlescape

def f(value,fieldname):
r = table[fieldname].represent
if r: value=r(value)
return xmlescape(value)

this is better than cgi.escape because it will allows you to use
helpers and embed, for example, a link.


On Mar 30, 1:40 am, parroit  wrote:
> Interesting, thank you. I will add autoencode parameters to
> the grid construnctor.
>
> I saw that setting the parameter to true will enable the encoding
> for all columns of the grid. Maybe, if we want to have some column
> with html data,
> it's better to encode the data in w2p?
> Massimo, you know an easy way to do so?
>
> Andrea
>
> On 28 Mar, 16:57, "ont.rif"  wrote:
>
> > :-)  same bug as 
> > forhttp://groups.google.ru/group/web2py/browse_thread/thread/96877110aa8...
> > I have found intresting feature 
> > forJqGrid3.5.2http://blogs.teamb.com/craigstuntz/2010/02/08/38548/
> > May be it is useful to add this option to this plugin ?
>
> > On 28 ÜÐà, 21:35, mdipierro  wrote:
>
> > > :-)
>
> > > On Mar 28, 4:04 am, parroit  wrote:
>
> > > > Thank you. Yes, I can merge with it.
> > > > I look at the existingjqgridplugin files.
> > > > I'll add the search feature and the parameters
> > > > for columns width, names etc...
>
> > > > I'll add a post here when I'll done with the work.
>
> > > > Bye
>
> > > > Andrea
>
> > > > On 28 Mar, 03:18, mdipierro  wrote:
>
> > > > > I looked at it and you did excellent work.
>
> > > > > I have one issue and one proposal.
>
> > > > > The issue is that plugin_editable_jqgrid.py exposes classes and
> > > > > methods that do not start with plugin_editable_jqgrid and that is a
> > > > > problem because can potentially conflict with other plugins.
>
> > > > > The proposal is that we merge it with the existingjqgridplugin.
>
> > > > > Can you take a first crack at merging them?
> > > > > I will be happy to do any required cleanup work and post it.
>
> > > > > Massimo
>
> > > > > On 27 Mar, 19:38, mdipierro  wrote:
>
> > > > > > I will look at it asap. Thank you!
>
> > > > > > Massimo
>
> > > > > > On 27 Mar, 11:51, parroit  wrote:
>
> > > > > > > Hi. I've developed a plugin to useJqGridwith inline editing and 
> > > > > > > json
> > > > > > > updates.
> > > > > > > I've published some help at this page:http://app.ebansoftware.net,
> > > > > > > but I think it be more useful
> > > > > > > to publish it also onhttp://www.web2py.com/plugins. What is the
> > > > > > > correct procedure
> > > > > > > to publish the plugin on that site?
>
> > > > > > > Thanks
>
> > > > > > > Andrea


[web2py] Re: JqGrid Plugin

2010-05-11 Thread flyboy
Hi - this sounds like just what I'm lookiing for. Any idea when you
hope to have it ready Andrea?

Thanks for your efforts - this looks a really cool plugin.

On Mar 30, 2:33 pm, mdipierro  wrote:
> For strings
>
> import cgi
> cgi.escape(string)
>
> On Mar 30, 1:40 am, parroit  wrote:
>
> > Interesting, thank you. I will add autoencode parameters to
> > the grid construnctor.
>
> > I saw that setting the parameter to true will enable the encoding
> > for all columns of the grid. Maybe, if we want to have some column
> > with html data,
> > it's better to encode the data in w2p?
> > Massimo, you know an easy way to do so?
>
> > Andrea
>
> > On 28 Mar, 16:57, "ont.rif"  wrote:
>
> > > :-)  same bug as 
> > > forhttp://groups.google.ru/group/web2py/browse_thread/thread/96877110aa8...
> > > I have found intresting feature 
> > > forJqGrid3.5.2http://blogs.teamb.com/craigstuntz/2010/02/08/38548/
> > > May be it is useful to add this option to this plugin ?
>
> > > On 28 ÜÐà, 21:35, mdipierro  wrote:
>
> > > > :-)
>
> > > > On Mar 28, 4:04 am, parroit  wrote:
>
> > > > > Thank you. Yes, I can merge with it.
> > > > > I look at the existingjqgridplugin files.
> > > > > I'll add the search feature and the parameters
> > > > > for columns width, names etc...
>
> > > > > I'll add a post here when I'll done with the work.
>
> > > > > Bye
>
> > > > > Andrea
>
> > > > > On 28 Mar, 03:18, mdipierro  wrote:
>
> > > > > > I looked at it and you did excellent work.
>
> > > > > > I have one issue and one proposal.
>
> > > > > > The issue is that plugin_editable_jqgrid.py exposes classes and
> > > > > > methods that do not start with plugin_editable_jqgrid and that is a
> > > > > > problem because can potentially conflict with other plugins.
>
> > > > > > The proposal is that we merge it with the existingjqgridplugin.
>
> > > > > > Can you take a first crack at merging them?
> > > > > > I will be happy to do any required cleanup work and post it.
>
> > > > > > Massimo
>
> > > > > > On 27 Mar, 19:38, mdipierro  wrote:
>
> > > > > > > I will look at it asap. Thank you!
>
> > > > > > > Massimo
>
> > > > > > > On 27 Mar, 11:51, parroit  wrote:
>
> > > > > > > > Hi. I've developed a plugin to useJqGridwith inline editing and 
> > > > > > > > json
> > > > > > > > updates.
> > > > > > > > I've published some help at this 
> > > > > > > > page:http://app.ebansoftware.net,
> > > > > > > > but I think it be more useful
> > > > > > > > to publish it also onhttp://www.web2py.com/plugins. What is the
> > > > > > > > correct procedure
> > > > > > > > to publish the plugin on that site?
>
> > > > > > > > Thanks
>
> > > > > > > > Andrea


Re: [web2py] Review my web2py app: Radbox.me

2010-05-11 Thread Miguel Lopes
Very cool.
Congratulations,
Miguel


[web2py] Re: Adding a new domain

2010-05-11 Thread mdipierro
You can used routes or virtual hosts in apache to map different
domains to different apps under the same web2py instance.

On May 11, 1:42 pm, Andrew Evans  wrote:
> Hello I am using web2py on my server and would like to set up a new
> domain to add to it
>
> right now it sits athttp://serv.cyber-samurai.de
>
> I am running apache + wsgi I have my additional domain pointed to the
> server but I am unsure how to configure web2py how to use it.
>
> Do I create a new application with that domain?
>
> suggestions
>
> Thank You


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

2010-05-11 Thread mdipierro
It does not hurt to post it and we can decide if we want to use for a
signature page. Can you say the name of the company?

On May 11, 1:36 pm, Miguel Lopes  wrote:
> On Mon, May 10, 2010 at 10:09 PM, mdipierro  wrote:
> > Anthony made some good points:
> >http://groups.google.com/group/web2py/msg/a40b27807edc8603
>
> > For now let's concentrate on one of them for now. If you have
> > developed software in web2py that you use internally in your company
> > but you cannot release it open source, would you let us know? Can you
> > tell us what is the software for? Could you provide a screenshot? Can
> > we quote the name of the company?
>
> > Massimo
>
> Presently I'm in the process of deploying a simple crm system in my company.
> In terms of layout it's very much of a Highrise clone. But the functionality
> is very very different since in an oportunity we track several would be
> purchasers who are bidding for the same project. Currently we also cover
> much less functionality as we are restricted to following opportunities,
> contacts, and their interactions.
>  I'm not sure if it is ok. But if it is I'll be happy to provide a
> screenshoot - although I'm pretty sure there is better work out there!
>
> Miguel


[web2py] Adding a new domain

2010-05-11 Thread Andrew Evans
Hello I am using web2py on my server and would like to set up a new
domain to add to it

right now it sits at http://serv.cyber-samurai.de

I am running apache + wsgi I have my additional domain pointed to the
server but I am unsure how to configure web2py how to use it.

Do I create a new application with that domain?

suggestions

Thank You


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

2010-05-11 Thread Miguel Lopes
On Mon, May 10, 2010 at 10:09 PM, mdipierro  wrote:

> Anthony made some good points:
> http://groups.google.com/group/web2py/msg/a40b27807edc8603
>
> For now let's concentrate on one of them for now. If you have
> developed software in web2py that you use internally in your company
> but you cannot release it open source, would you let us know? Can you
> tell us what is the software for? Could you provide a screenshot? Can
> we quote the name of the company?
>
> Massimo
>

Presently I'm in the process of deploying a simple crm system in my company.
In terms of layout it's very much of a Highrise clone. But the functionality
is very very different since in an oportunity we track several would be
purchasers who are bidding for the same project. Currently we also cover
much less functionality as we are restricted to following opportunities,
contacts, and their interactions.
 I'm not sure if it is ok. But if it is I'll be happy to provide a
screenshoot - although I'm pretty sure there is better work out there!

Miguel


[web2py] Re: Display Sum of values

2010-05-11 Thread mdipierro
I personally do not. The university I work for (DePaul Universty)
offers this certificate program:
http://www.cdm.depaul.edu/ipd/Programs/Pages/WebDevelopmentwithPython.aspx
(as long as other programs on Java and Rails and more).

I teach it. I may teach it in Fall but I am not sure yet.

Massimo

On May 11, 1:24 pm, greenpoise  wrote:
> will try. Thanks.
>
> ** Dont know if this is the appropriate place to ask for this but
> looking around the group I saw a post about a class certificate
> offering. Do you have an online class by any chance?
>
> On May 11, 2:16 pm, mdipierro  wrote:
>
> > First I would rewrite it as
>
> > def view_totals():
> >     rows = db().select(db.tableorder.ALL,
> > db.tableorder.totalsale.sum(),groupby=db.tableorder.orderdate)
> >     for row in rows: print
> > row.tableorder.ordernumber,row[db.tableorder.totalsale.sum()]
> >     return dict(rows=rows)
>
> > 
> > {{for row in rows:}}
> > {{= row.tableorder.ordernumber}} > td>{{=row[db.tableorder.totalsale.sum()]}}
> > {{pass}}
> > 
>
> > On May 11, 12:37 pm, greenpoise  wrote:
>
> > > I have this:
>
> > > def view_totals():
> > >     rows = db().select(db.tableorder.ALL, 'sum(tableorder.totalsale)',
> > > groupby=db.tableorder.orderdate)
> > >     for row in rows: print row.tableorder.ordernumber,
> > > row._extra['sum(tableorder.totalsale)']
> > >     return dict()
>
> > > What would be my view to present my sum?


[web2py] SSL Error on windows

2010-05-11 Thread Miguel Lopes
I followed the www.web2py.com/AlterEgo/default/show/140 in order to generate
a self-certified ssl key using OpenSSL for windows(
http://www.slproweb.com/products/Win32OpenSSL.html)

The certificates are in the web2py folder

Running web2py I get this error:

C:\Programas\web2py>c:\python26\python web2py.py -c server.crt -k server.key
-a "" -i **.*.*.*** -p 8080
WARNING:root:no file locking
web2py Enterprise Web Framework
Created by Massimo Di Pierro, Copyright 2007-2010
Version 1.77.3 (2010-04-20 02:48:54)
Database drivers available: SQLite3, PostgreSQL
Starting hardcron...
WARNING:root:WEB2PY CRON: Disabled because no file locking
please visit:
http://**.*.*.***:8080
use "kill -SIGTERM 396" to shutdown the web2py server
WARNING:root:WEB2PY CRON: Disabled because no file locking
ERROR:Rocket.Errors.ThreadPool:Traceback (most recent call last):
  File "C:\Programas\web2py\gluon\rocket.py", line 300, in start
self._threadpool.queue.put((l.accept(),
  File "c:\python26\lib\ssl.py", line 326, in accept
suppress_ragged_eofs=self.suppress_ragged_eofs),
  File "c:\python26\lib\ssl.py", line 118, in __init__
self.do_handshake()
  File "c:\python26\lib\ssl.py", line 293, in do_handshake
self._sslobj.do_handshake()
SSLError: [Errno 1] _ssl.c:480: error:1407609C:SSL
routines:SSL23_GET_CLIENT_HEL
LO:http request

Any ideas?
Miguel


[web2py] Re: Display Sum of values

2010-05-11 Thread greenpoise
will try. Thanks.

** Dont know if this is the appropriate place to ask for this but
looking around the group I saw a post about a class certificate
offering. Do you have an online class by any chance?



On May 11, 2:16 pm, mdipierro  wrote:
> First I would rewrite it as
>
> def view_totals():
>     rows = db().select(db.tableorder.ALL,
> db.tableorder.totalsale.sum(),groupby=db.tableorder.orderdate)
>     for row in rows: print
> row.tableorder.ordernumber,row[db.tableorder.totalsale.sum()]
>     return dict(rows=rows)
>
> 
> {{for row in rows:}}
> {{= row.tableorder.ordernumber}} td>{{=row[db.tableorder.totalsale.sum()]}}
> {{pass}}
> 
>
> On May 11, 12:37 pm, greenpoise  wrote:
>
> > I have this:
>
> > def view_totals():
> >     rows = db().select(db.tableorder.ALL, 'sum(tableorder.totalsale)',
> > groupby=db.tableorder.orderdate)
> >     for row in rows: print row.tableorder.ordernumber,
> > row._extra['sum(tableorder.totalsale)']
> >     return dict()
>
> > What would be my view to present my sum?


[web2py] Re: Catch and replace vars

2010-05-11 Thread Iceberg
Thanks for the tip, but there seems some more subtle difference
between form.accepts(..., onvalidation=callback) VS Field('bar',
compute=lambda r:r['foo']).

The latter will cause that field no longer showts up in SQLFORM,
because its default self.fields excludes all compute field. Is there
any reason for that?

Right now I still have to stick to my form.accepts(...,
onvalidation=callback) approach. :-/

Sincerely,
Iceberg

On May12, 1:30am, mdipierro  wrote:
> Yes but
>
>   Field('bar', compute=lambda r:r['foo'])
>
> not
>
>   Field('bar', compute=lambda r:r.foo)
>
> On May 11, 11:28 am, Iceberg  wrote:
>
>
>
> > I must miss the "compute" feature. Now I am picking it up. Would you
> > please confirm whether my understanding is correct?
>
> > The code:
> >         Field('bar', compute=lambda r:r.foo)
> > is an easier equivalent for:
> >         def callback(form): form.vars.bar = form.vars.foo
> >         form.accepts(..., onvalidation=callback)
> > and it only works before inserting or updating a record into db.
>
> > On the contrary, rows.setvirtualfields(...), only works when
> > retrieving records from db. (Detail 
> > inhttp://groups.google.com/group/web2py/browse_frm/thread/d93eee8cc2495c8c
> >  )
>
> > Is it right?
>
> > Regards,
> > iceberg
>
> > On May11, 10:23pm, mdipierro  wrote:
>
> > > I think you look for something like
>
> > > db.table.field_2.compute=lambda r: request.vars.field_1
>
> > > On May 11, 4:01 am, AsmanCom  wrote:
>
> > > > That would be a great solution, but i´ve to do this in model because i
> > > > am using the awesome JQGrid plugin (app.ebansoftware.net/
> > > > editable_jqgrid/).
> > > > The dilemma is:
> > > > - I need to do this in the model
> > > > - I can`t get the vars from table.field.default (self-evident)
> > > > - I need a working IS_IN_DB(db,'table.id','table.name') validator and
> > > > label (for the JQGrid plugin)
> > > > - I can´t add an aditional validator (because IS_IN_DB +label don´t
> > > > show up right, when combined with other validators)
> > > > - The form must be visible to the user, so i can´t go with
> > > > table.field.compute
>
> > > > So I think to implement this with Field default function is the right
> > > > approach?
> > > > But I need to catch the vars, compute someth. and Insert.
>
> > > > Any ideas?
>
> > > > On 10 Mai, 19:47, Iceberg  wrote:
>
> > > > > Model:
> > > > > db.define_table('table_1',
> > > > >                        Field('field_1'),
> > > > >                        Field('field_2')
> > > > >                        )
>
> > > > > Controller:
> > > > > def index():
> > > > >   def magic(form):
> > > > >     form.vars.field_2 = form.vars.field_1
> > > > >   form = SQLFORM(db.table_1)
> > > > >   if form.accepts(request.vars, onvalidation=magic):
> > > > >     pass # ok
> > > > >   return {'form': form}
>
> > > > > I did not test it. But it shows you the key of using onvalidation()
> > > > > trick.
>
> > > > > Regards,
> > > > > Iceberg
>
> > > > > On May11, 12:08am, AsmanCom  wrote:
>
> > > > > > Hi,
>
> > > > > > i want to do a simple task:
>
> > > > > > def function_1():
> > > > > >     var_field_1=request.vars.field_1
> > > > > >     if var_field_1:
> > > > > >         return var_field_1
>
> > > > > > db.define_table('table_1',
> > > > > >                        Field('field_1','string' ),
> > > > > >                        Field('field_2', default=function_1)
> > > > > >                        )
>
> > > > > > db.table_1.field_1.default='Autogenerated'
> > > > > > db.table_1.field_2.default='Autogenerated'
>
> > > > > > I want to catch default vars from field 1 and insert them in field_2
> > > > > > instead.
> > > > > > Is this possible?
>
> > > > > > ###becomes interesting when combined, with IS_IN_DB and the
> > > > > > get_or_create function###


[web2py] kubuntu web2py

2010-05-11 Thread mdipierro
https://wiki.kubuntu.org/Web2Py


[web2py] Re: Delete record without triggering validators?

2010-05-11 Thread mdipierro
Good point! Will do.

Massimo

On May 11, 1:08 pm, Iceberg  wrote:
> Hi Massimo,
>
> Right now validators are triggered even when a record is successfully
> being deleted. This can be annoying in case I am deleting old records
> as below:
>
> db.define_table('my_table',
>     Field('today', 'date',
>         requires=IS_DATE_IN_RANGE(minimum=request.now.date()),
>         default = request.now.date(),
>         )
>     )
>
> What if we drop all the form.errors content before line 923 in gluon/
> sqlhtml.py?
>     if requested_delete:
>         ..
>         self.form.errors = {} # to override unnecessary error message
>         return True
>
> Or a better way is to do delete before validators are called. Can you
> do that?
>
> Regards,
> Iceberg


[web2py] Re: Display Sum of values

2010-05-11 Thread mdipierro
First I would rewrite it as

def view_totals():
rows = db().select(db.tableorder.ALL,
db.tableorder.totalsale.sum(),groupby=db.tableorder.orderdate)
for row in rows: print
row.tableorder.ordernumber,row[db.tableorder.totalsale.sum()]
return dict(rows=rows)


{{for row in rows:}}
{{= row.tableorder.ordernumber}}{{=row[db.tableorder.totalsale.sum()]}}
{{pass}}


On May 11, 12:37 pm, greenpoise  wrote:
> I have this:
>
> def view_totals():
>     rows = db().select(db.tableorder.ALL, 'sum(tableorder.totalsale)',
> groupby=db.tableorder.orderdate)
>     for row in rows: print row.tableorder.ordernumber,
> row._extra['sum(tableorder.totalsale)']
>     return dict()
>
> What would be my view to present my sum?


[web2py] Delete record without triggering validators?

2010-05-11 Thread Iceberg
Hi Massimo,

Right now validators are triggered even when a record is successfully
being deleted. This can be annoying in case I am deleting old records
as below:

db.define_table('my_table',
Field('today', 'date',
requires=IS_DATE_IN_RANGE(minimum=request.now.date()),
default = request.now.date(),
)
)

What if we drop all the form.errors content before line 923 in gluon/
sqlhtml.py?
if requested_delete:
..
self.form.errors = {} # to override unnecessary error message
return True

Or a better way is to do delete before validators are called. Can you
do that?

Regards,
Iceberg


[web2py] Re: Review my web2py app: Radbox.me

2010-05-11 Thread Mengu
This is surely a great app. Congratulations. I wish you success like a
sea.


[web2py] Display Sum of values

2010-05-11 Thread greenpoise
I have this:

def view_totals():
rows = db().select(db.tableorder.ALL, 'sum(tableorder.totalsale)',
groupby=db.tableorder.orderdate)
for row in rows: print row.tableorder.ordernumber,
row._extra['sum(tableorder.totalsale)']
return dict()

What would be my view to present my sum?



[web2py] Re: Catch and replace vars

2010-05-11 Thread mdipierro
Yes but

  Field('bar', compute=lambda r:r['foo'])

not

  Field('bar', compute=lambda r:r.foo)

On May 11, 11:28 am, Iceberg  wrote:
> I must miss the "compute" feature. Now I am picking it up. Would you
> please confirm whether my understanding is correct?
>
> The code:
>         Field('bar', compute=lambda r:r.foo)
> is an easier equivalent for:
>         def callback(form): form.vars.bar = form.vars.foo
>         form.accepts(..., onvalidation=callback)
> and it only works before inserting or updating a record into db.
>
> On the contrary, rows.setvirtualfields(...), only works when
> retrieving records from db. (Detail 
> inhttp://groups.google.com/group/web2py/browse_frm/thread/d93eee8cc2495c8c
>  )
>
> Is it right?
>
> Regards,
> iceberg
>
> On May11, 10:23pm, mdipierro  wrote:
>
> > I think you look for something like
>
> > db.table.field_2.compute=lambda r: request.vars.field_1
>
> > On May 11, 4:01 am, AsmanCom  wrote:
>
> > > That would be a great solution, but i´ve to do this in model because i
> > > am using the awesome JQGrid plugin (app.ebansoftware.net/
> > > editable_jqgrid/).
> > > The dilemma is:
> > > - I need to do this in the model
> > > - I can`t get the vars from table.field.default (self-evident)
> > > - I need a working IS_IN_DB(db,'table.id','table.name') validator and
> > > label (for the JQGrid plugin)
> > > - I can´t add an aditional validator (because IS_IN_DB +label don´t
> > > show up right, when combined with other validators)
> > > - The form must be visible to the user, so i can´t go with
> > > table.field.compute
>
> > > So I think to implement this with Field default function is the right
> > > approach?
> > > But I need to catch the vars, compute someth. and Insert.
>
> > > Any ideas?
>
> > > On 10 Mai, 19:47, Iceberg  wrote:
>
> > > > Model:
> > > > db.define_table('table_1',
> > > >                        Field('field_1'),
> > > >                        Field('field_2')
> > > >                        )
>
> > > > Controller:
> > > > def index():
> > > >   def magic(form):
> > > >     form.vars.field_2 = form.vars.field_1
> > > >   form = SQLFORM(db.table_1)
> > > >   if form.accepts(request.vars, onvalidation=magic):
> > > >     pass # ok
> > > >   return {'form': form}
>
> > > > I did not test it. But it shows you the key of using onvalidation()
> > > > trick.
>
> > > > Regards,
> > > > Iceberg
>
> > > > On May11, 12:08am, AsmanCom  wrote:
>
> > > > > Hi,
>
> > > > > i want to do a simple task:
>
> > > > > def function_1():
> > > > >     var_field_1=request.vars.field_1
> > > > >     if var_field_1:
> > > > >         return var_field_1
>
> > > > > db.define_table('table_1',
> > > > >                        Field('field_1','string' ),
> > > > >                        Field('field_2', default=function_1)
> > > > >                        )
>
> > > > > db.table_1.field_1.default='Autogenerated'
> > > > > db.table_1.field_2.default='Autogenerated'
>
> > > > > I want to catch default vars from field 1 and insert them in field_2
> > > > > instead.
> > > > > Is this possible?
>
> > > > > ###becomes interesting when combined, with IS_IN_DB and the
> > > > > get_or_create function###


[web2py] Re: Catch and replace vars

2010-05-11 Thread Iceberg
I must miss the "compute" feature. Now I am picking it up. Would you
please confirm whether my understanding is correct?

The code:
Field('bar', compute=lambda r:r.foo)
is an easier equivalent for:
def callback(form): form.vars.bar = form.vars.foo
form.accepts(..., onvalidation=callback)
and it only works before inserting or updating a record into db.

On the contrary, rows.setvirtualfields(...), only works when
retrieving records from db. (Detail in
http://groups.google.com/group/web2py/browse_frm/thread/d93eee8cc2495c8c
 )

Is it right?

Regards,
iceberg


On May11, 10:23pm, mdipierro  wrote:
> I think you look for something like
>
> db.table.field_2.compute=lambda r: request.vars.field_1
>
> On May 11, 4:01 am, AsmanCom  wrote:
>
>
>
> > That would be a great solution, but i´ve to do this in model because i
> > am using the awesome JQGrid plugin (app.ebansoftware.net/
> > editable_jqgrid/).
> > The dilemma is:
> > - I need to do this in the model
> > - I can`t get the vars from table.field.default (self-evident)
> > - I need a working IS_IN_DB(db,'table.id','table.name') validator and
> > label (for the JQGrid plugin)
> > - I can´t add an aditional validator (because IS_IN_DB +label don´t
> > show up right, when combined with other validators)
> > - The form must be visible to the user, so i can´t go with
> > table.field.compute
>
> > So I think to implement this with Field default function is the right
> > approach?
> > But I need to catch the vars, compute someth. and Insert.
>
> > Any ideas?
>
> > On 10 Mai, 19:47, Iceberg  wrote:
>
> > > Model:
> > > db.define_table('table_1',
> > >                        Field('field_1'),
> > >                        Field('field_2')
> > >                        )
>
> > > Controller:
> > > def index():
> > >   def magic(form):
> > >     form.vars.field_2 = form.vars.field_1
> > >   form = SQLFORM(db.table_1)
> > >   if form.accepts(request.vars, onvalidation=magic):
> > >     pass # ok
> > >   return {'form': form}
>
> > > I did not test it. But it shows you the key of using onvalidation()
> > > trick.
>
> > > Regards,
> > > Iceberg
>
> > > On May11, 12:08am, AsmanCom  wrote:
>
> > > > Hi,
>
> > > > i want to do a simple task:
>
> > > > def function_1():
> > > >     var_field_1=request.vars.field_1
> > > >     if var_field_1:
> > > >         return var_field_1
>
> > > > db.define_table('table_1',
> > > >                        Field('field_1','string' ),
> > > >                        Field('field_2', default=function_1)
> > > >                        )
>
> > > > db.table_1.field_1.default='Autogenerated'
> > > > db.table_1.field_2.default='Autogenerated'
>
> > > > I want to catch default vars from field 1 and insert them in field_2
> > > > instead.
> > > > Is this possible?
>
> > > > ###becomes interesting when combined, with IS_IN_DB and the
> > > > get_or_create function###


[web2py] Re: Review my web2py app: Radbox.me

2010-05-11 Thread Adi
I sure will... and I read your thread again - I started playing with
web2py since the very early releases and coming from a j2ee
background, the reduction in effort for creating a good application is
amazing. :)

Having said that, there are hundreds of web frameworks out there, and
web2py is still very very young; the best way to evaluate a framework
is to actually use it or watch it in action on a public app like ours.
The framework makes development so fast developing an app will be
faster than posting a thread. :)

On May 11, 6:33 pm, Anthony  wrote:
> Now that's what I'm talking about (http://groups.google.com/group/
> web2py/browse_frm/thread/9f653dcf0493593d)! Very nice work.
>
> If you're willing, maybe mention web2py on the "Credits" page.
>
> On May 11, 5:40 am, Adi  wrote:
>
>
>
> > I saw some discussions flying around about web2py applications and
> > users out there (http://groups.google.com/group/web2py/browse_thread/
> > thread/606b6e90744ab3b5)
> > and thought it would be a good time to talk about my application.
>
> > Radbox (http://radbox.me) is a video bookmarking service. Its still a
> > very young product, but I believe its pretty good at what it does.
>
> > Right now we're using web2py 1.77.3 for the application.
>
> > It has quite a few interesting features from a web2py developer's
> > perspective:
>
> > - custom auth_user table
> > - Facebook integration for sign-up and (very very soon) publish to
> > wall
> > - generic embedded video display using swfobject
> > - Twitter @anywhere integration (this is only in the view layer using
> > javascript)
> > - url rewrite using routes.py
> > - RSS feed (only for users, not visitors)
> > - Ajax "Like" and "Archive" implementation for every video
>
> > Many other things are under development. I mentioned the above because
> > lots of questions in this group are asked about these features.
>
> > Please take the app for a test drive, let me know your feedback and
> > questions on the implementation. My team and I are more than happy to
> > recommend web2py for full-blown professional web applications, and
> > we'll continue to bug this community (specially Massimo and Theadus)
> > every time we hit a rough patch. :)


[web2py] Re: Review my web2py app: Radbox.me

2010-05-11 Thread mdipierro
very nice indeed!

On May 11, 4:40 am, Adi  wrote:
> I saw some discussions flying around about web2py applications and
> users out there (http://groups.google.com/group/web2py/browse_thread/
> thread/606b6e90744ab3b5)
> and thought it would be a good time to talk about my application.
>
> Radbox (http://radbox.me) is a video bookmarking service. Its still a
> very young product, but I believe its pretty good at what it does.
>
> Right now we're using web2py 1.77.3 for the application.
>
> It has quite a few interesting features from a web2py developer's
> perspective:
>
> - custom auth_user table
> - Facebook integration for sign-up and (very very soon) publish to
> wall
> - generic embedded video display using swfobject
> - Twitter @anywhere integration (this is only in the view layer using
> javascript)
> - url rewrite using routes.py
> - RSS feed (only for users, not visitors)
> - Ajax "Like" and "Archive" implementation for every video
>
> Many other things are under development. I mentioned the above because
> lots of questions in this group are asked about these features.
>
> Please take the app for a test drive, let me know your feedback and
> questions on the implementation. My team and I are more than happy to
> recommend web2py for full-blown professional web applications, and
> we'll continue to bug this community (specially Massimo and Theadus)
> every time we hit a rough patch. :)


[web2py] Re: left outer join problem on db2

2010-05-11 Thread mdipierro
Thank you. will look into it.

Massimo


On May 11, 6:31 am, Alexey Nezhdanov  wrote:
> Hi.
> I've come across another subtle problem with web2py's DAL running over IBM
> DB2 database.
> DB2 requires the left table to immidiatedly preceed the 'left outer join'
> keyword.
> IOW:
> select * from a, b left outer join c on c.a_id=a.id
> is incorrect. Correct form is:
> select * from b, a left outer join c on c.a_id=a.id
> it looks moronish enough, but alas, we have to live with it.
>
> I have modified my local copy of web2py to satisfy this requirement.
> Please note that this sample can not be copypasted into web2py's sql.py as
> is because of full_table_name wrapper that I added to solve another problem
> - schemas support. But replacing 'full_table_name(db, t)' with just 't'
> should work just fine.
>
>             join = attributes['left']
>             command = self._db._translator['left join']
>             if not isinstance(join, (tuple, list)):
>                 join = [join]
>             joint = [t._tablename for t in join if not isinstance(t,
>                      SQLJoin)]
>             joinon = [t for t in join if isinstance(t, SQLJoin)]
>             tables_to_merge={}
>
> [tables_to_merge.update(dict.fromkeys(parse_tablenames(str(t.query for t
> in joinon]
>             joinont = [t.table._tablename for t in joinon]
>             [tables_to_merge.pop(t) for t in joinont if t in
> tables_to_merge]
>             important_tablenames = joint + joinont + tables_to_merge.keys()
>             excluded = [t for t in tablenames if not t in
> important_tablenames ]
>             sql_t = ', '.join([full_table_name(self._db, t) for t in
> excluded + tables_to_merge.keys()])
>             if joint:
>                 sql_t += ' %s %s' % (command, ',
> '.join([full_table_name(self._db, t) for t in joint]))
>             for t in joinon:
>                 sql_t += ' %s %s' % (command, str(t))
>
> Regards
> Alexey


[web2py] Re: Feature Request: Text Based Log Viewer

2010-05-11 Thread mdipierro
They are just python pickles.

On May 11, 5:35 am, Jason Brower  wrote:
> I would like to not have them available online at all.  I want to be
> able to see the logs from web2py's error folder in a nice way.  Right
> now I get this...(attatched).  They look like pickles to me. I want to
> be able to read them with a text based system. (Like when I ssh into my
> server to see the issues in the application.
> ---
> Best Regards,
> Jason Brower
>
> On Mon, 2010-05-10 at 21:56 -0700, mdipierro wrote:
> > are you talking about apache error log, httpserver.log, tickets of
> > console logs?
> > In the first case we have two apps for that:
>
> >http://web2py.com/appliances/default/show/14
> >http://web2py.com/appliances/default/show/27
>
> > I think the second is better.
>
> > On May 10, 11:06 pm, Jason Brower  wrote:
> > > When I get errors in my logs I have to scour through the error folder
> > > for the issues.  It would be so totally awsome if I were able to see the
> > > errors parse and looking snazzy in a texted based (console) error log
> > > viewer.  That way I can easily see the errors and what line they are on.
> > > Unless there is a better way. :)
> > > Best Regards,
> > > Jason Brower
>
>
>
>  P viewer. That way I can easily see the errors and what line they are on.8
> 12KViewDownload


[web2py] Re: Catch and replace vars

2010-05-11 Thread mdipierro
I think you look for something like

db.table.field_2.compute=lambda r: request.vars.field_1


On May 11, 4:01 am, AsmanCom  wrote:
> That would be a great solution, but i´ve to do this in model because i
> am using the awesome JQGrid plugin (app.ebansoftware.net/
> editable_jqgrid/).
> The dilemma is:
> - I need to do this in the model
> - I can`t get the vars from table.field.default (self-evident)
> - I need a working IS_IN_DB(db,'table.id','table.name') validator and
> label (for the JQGrid plugin)
> - I can´t add an aditional validator (because IS_IN_DB +label don´t
> show up right, when combined with other validators)
> - The form must be visible to the user, so i can´t go with
> table.field.compute
>
> So I think to implement this with Field default function is the right
> approach?
> But I need to catch the vars, compute someth. and Insert.
>
> Any ideas?
>
> On 10 Mai, 19:47, Iceberg  wrote:
>
> > Model:
> > db.define_table('table_1',
> >                        Field('field_1'),
> >                        Field('field_2')
> >                        )
>
> > Controller:
> > def index():
> >   def magic(form):
> >     form.vars.field_2 = form.vars.field_1
> >   form = SQLFORM(db.table_1)
> >   if form.accepts(request.vars, onvalidation=magic):
> >     pass # ok
> >   return {'form': form}
>
> > I did not test it. But it shows you the key of using onvalidation()
> > trick.
>
> > Regards,
> > Iceberg
>
> > On May11, 12:08am, AsmanCom  wrote:
>
> > > Hi,
>
> > > i want to do a simple task:
>
> > > def function_1():
> > >     var_field_1=request.vars.field_1
> > >     if var_field_1:
> > >         return var_field_1
>
> > > db.define_table('table_1',
> > >                        Field('field_1','string' ),
> > >                        Field('field_2', default=function_1)
> > >                        )
>
> > > db.table_1.field_1.default='Autogenerated'
> > > db.table_1.field_2.default='Autogenerated'
>
> > > I want to catch default vars from field 1 and insert them in field_2
> > > instead.
> > > Is this possible?
>
> > > ###becomes interesting when combined, with IS_IN_DB and the
> > > get_or_create function###


[web2py] Re: Review my web2py app: Radbox.me

2010-05-11 Thread mr.freeze
Excellent! Sign-up was smooth, everything worked well and the site
looks great.

On May 11, 4:40 am, Adi  wrote:
> I saw some discussions flying around about web2py applications and
> users out there (http://groups.google.com/group/web2py/browse_thread/
> thread/606b6e90744ab3b5)
> and thought it would be a good time to talk about my application.
>
> Radbox (http://radbox.me) is a video bookmarking service. Its still a
> very young product, but I believe its pretty good at what it does.
>
> Right now we're using web2py 1.77.3 for the application.
>
> It has quite a few interesting features from a web2py developer's
> perspective:
>
> - custom auth_user table
> - Facebook integration for sign-up and (very very soon) publish to
> wall
> - generic embedded video display using swfobject
> - Twitter @anywhere integration (this is only in the view layer using
> javascript)
> - url rewrite using routes.py
> - RSS feed (only for users, not visitors)
> - Ajax "Like" and "Archive" implementation for every video
>
> Many other things are under development. I mentioned the above because
> lots of questions in this group are asked about these features.
>
> Please take the app for a test drive, let me know your feedback and
> questions on the implementation. My team and I are more than happy to
> recommend web2py for full-blown professional web applications, and
> we'll continue to bug this community (specially Massimo and Theadus)
> every time we hit a rough patch. :)


[web2py] Re: Review my web2py app: Radbox.me

2010-05-11 Thread Anthony
Now that's what I'm talking about (http://groups.google.com/group/
web2py/browse_frm/thread/9f653dcf0493593d)! Very nice work.

If you're willing, maybe mention web2py on the "Credits" page.


On May 11, 5:40 am, Adi  wrote:
> I saw some discussions flying around about web2py applications and
> users out there (http://groups.google.com/group/web2py/browse_thread/
> thread/606b6e90744ab3b5)
> and thought it would be a good time to talk about my application.
>
> Radbox (http://radbox.me) is a video bookmarking service. Its still a
> very young product, but I believe its pretty good at what it does.
>
> Right now we're using web2py 1.77.3 for the application.
>
> It has quite a few interesting features from a web2py developer's
> perspective:
>
> - custom auth_user table
> - Facebook integration for sign-up and (very very soon) publish to
> wall
> - generic embedded video display using swfobject
> - Twitter @anywhere integration (this is only in the view layer using
> javascript)
> - url rewrite using routes.py
> - RSS feed (only for users, not visitors)
> - Ajax "Like" and "Archive" implementation for every video
>
> Many other things are under development. I mentioned the above because
> lots of questions in this group are asked about these features.
>
> Please take the app for a test drive, let me know your feedback and
> questions on the implementation. My team and I are more than happy to
> recommend web2py for full-blown professional web applications, and
> we'll continue to bug this community (specially Massimo and Theadus)
> every time we hit a rough patch. :)


[web2py] Re: Calculation error

2010-05-11 Thread greenpoise
I had round after float. Thanks!

On May 10, 11:42 pm, mdipierro  wrote:
> it is a good idea but somebody has to implement that. It would be in
> the new DAL, not current DAL, and it is not clear it is supported by
> all backends. Were you doing to provide a list of databases that
> support the double quotes with examples?
>
> On May 10, 10:00 pm, Álvaro Justen  wrote:
>
> > On Sun, May 9, 2010 at 00:38, mdipierro  wrote:
> > > There are two problems:
> > > 1)  order is reserved keyword.
>
> > Yes but about the quotes that I suggested? :-)
>
> > > 2) decimal types are treated as string internally and there for
> > > compute should be
>
> > > db.order.tipgranted.compute=lambda r:
> > > float(r['totalsale'])*float(r['tipvalue'])
>
> > > or better
>
> > > db.order.tipgranted.compute=lambda r:
> > > decimal.Decimal(r['totalsale'])*decimal.Decimal(r['tipvalue'])
>
> > > On May 8, 10:00 pm, greenpoise  wrote:
> > >> Model:
>
> > >> db.define_table('order',
> > >>     Field('employee',db.person),
> > >>     Field('tablenumber'),
> > >>     Field('ordernumber'),
> > >>     Field('orderdate','date'),
> > >>     Field('totalsale', 'decimal(10,2)'),
> > >>     Field('tipgranted', 'decimal(10,2)',default=None, update=None,
> > >> readable=False),
> > >>     Field('tipvalue','decimal(10,2)',default='0.15'),)
>
> > >> @auth.requires_login()
> > >> def show_orders():
> > >>     db.order.tipgranted.compute=lambda r:
> > >> r['totalsale']*r['tipvalue']
> > >>     form=crud.create(db.order)
>
> > >> orders=db(db.order.employee==employee.id).select(orderby=db.order.ordernumber)
> > >>     return dict(employee=employee,orders=orders,form=form)
>
> > >> thanks
>
> > >> On May 8, 10:54 pm, mdipierro  wrote:
>
> > >> > Can you show us the model and the action that triggers this?
>
> > >> > On May 8, 9:49 pm, greenpoise  wrote:
>
> > >> > > Can someone help me. I am trying to do a simplecalculationof fields.
> > >> > > Fields are defined as decimal in db.py and here is thecalculation:
>
> > >> > >     db.order.tipgranted.compute=lambda r: 
> > >> > > r['totalsale']*r['tipvalue']
>
> > >> > > error: TypeError: can't multiply sequence by non-int of type 'float'
>
> > --
> > Álvaro Justen - Turicas
> >  http://blog.justen.eng.br/
> >  21 9898-0141


[web2py] Re: Review my web2py app: Radbox.me

2010-05-11 Thread greenpoise
Great stuff.




On May 11, 8:25 am, cjrh  wrote:
> On May 11, 11:40 am, Adi  wrote:
>
> > Radbox (http://radbox.me) is a video bookmarking service. Its still a
> > very young product, but I believe its pretty good at what it does.
>
> Cool!


Re: [web2py] performance issue- multiple db connection

2010-05-11 Thread Timothy Farrell
When you create your model, there is a "pools" parameter that defaults 
to 10.  This means that the one web2py process will use a pool of 10 
connections on that one database.  It leaves the connections open even 
after the request is served so that they can serve the next connection 
without having to reconnect to the database.


-tim

On 5/11/2010 3:58 AM, vihang wrote:

Hello,

I am trying to understand the possible performance setback if I try to
open multiple db connections. Is there some mechanism in web2py which
would optimizes the number of open connections to the database?

Vihang
   




[web2py] Re: Routes.py on GAE

2010-05-11 Thread Chris S
The routes.py file that I am attempting to use is:
---
routes_in = (('/favicon.ico', '/init/static/favicon.ico'),
 ('/robots.txt', '/init/static/robots.txt'),
)
routes_out = ()
---
I believe that is a direct copy and paste of the example from the
online book.


On May 10, 6:04 pm, mdipierro  wrote:
> As far as I know it works well on GAE. The errors you get:
>
> "Your routes.py has a syntax error. Please fix it before you restart"
>
> indicates that there is an error in your routes.py.
> If you post it we can help you isolate the problem.
>
> Massimo
>
> On May 10, 4:23 pm, Chris S  wrote:
>
> > Does routes.py work on GAE?  I've recently deployed an app which used
> > the 5-line routes.py from the book for routing robots.txt and
> > favicon.icon.  I just wanted to get rid of that 100% error rate on
> > those two files.  I recevied the following message.  Only after
> > removing routes.py again did the app launch properly.
>
> > begin error message
> > #
> > 05-10 01:18PM 34.771
> > unable to import Rocket
>
> > #
> > E 05-10 01:18PM 34.774
> > Your routes.py has a syntax error. Please fix it before you restart
> > web2py
>
> > #
> > E 05-10 01:18PM 34.778
> > : invalid syntax (, line 3)
> > Traceback (most recent call last):
> >   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> > gaehandler.py", line 44, in 
> >     import gluon.main
> >   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> > gluon/main.py", line 66, in 
> >     rewrite.load()
> >   File "/base/data/home/apps/rms-solutions/beta.341858638445092536/
> > gluon/rewrite.py", line 63, in load
> >     raise e
>
>


[web2py] Re: Review my web2py app: Radbox.me

2010-05-11 Thread cjrh
On May 11, 11:40 am, Adi  wrote:
> Radbox (http://radbox.me) is a video bookmarking service. Its still a
> very young product, but I believe its pretty good at what it does.

Cool!


[web2py] bug in attributes check in _select

2010-05-11 Thread Alexey Nezhdanov
Hello. There is a bug in these lines:

if [key for key in attributes if not key
 in valid_attributes]:
raise SyntaxError, 'invalid select attribute: %s' % key

At the moment of raise the 'key' variable holds last ispected value which is
not neccessarily incorrect.
The correct way will be something like:
offenders = [key for key in attributes if not key in valid_attributes]
if offenders: raise SyntaxError, 'invalid select attributes: %s'%((',
'.join(offenders)))

If same pattern was used elsewhere in the code then this bug is duplicated
in other places.

Regards
Alexey


[web2py] left outer join problem on db2

2010-05-11 Thread Alexey Nezhdanov
Hi.
I've come across another subtle problem with web2py's DAL running over IBM
DB2 database.
DB2 requires the left table to immidiatedly preceed the 'left outer join'
keyword.
IOW:
select * from a, b left outer join c on c.a_id=a.id
is incorrect. Correct form is:
select * from b, a left outer join c on c.a_id=a.id
it looks moronish enough, but alas, we have to live with it.

I have modified my local copy of web2py to satisfy this requirement.
Please note that this sample can not be copypasted into web2py's sql.py as
is because of full_table_name wrapper that I added to solve another problem
- schemas support. But replacing 'full_table_name(db, t)' with just 't'
should work just fine.

join = attributes['left']
command = self._db._translator['left join']
if not isinstance(join, (tuple, list)):
join = [join]
joint = [t._tablename for t in join if not isinstance(t,
 SQLJoin)]
joinon = [t for t in join if isinstance(t, SQLJoin)]
tables_to_merge={}

[tables_to_merge.update(dict.fromkeys(parse_tablenames(str(t.query for t
in joinon]
joinont = [t.table._tablename for t in joinon]
[tables_to_merge.pop(t) for t in joinont if t in
tables_to_merge]
important_tablenames = joint + joinont + tables_to_merge.keys()
excluded = [t for t in tablenames if not t in
important_tablenames ]
sql_t = ', '.join([full_table_name(self._db, t) for t in
excluded + tables_to_merge.keys()])
if joint:
sql_t += ' %s %s' % (command, ',
'.join([full_table_name(self._db, t) for t in joint]))
for t in joinon:
sql_t += ' %s %s' % (command, str(t))

Regards
Alexey


Re: [web2py] Re: Feature Request: Text Based Log Viewer

2010-05-11 Thread Jason Brower
I would like to not have them available online at all.  I want to be
able to see the logs from web2py's error folder in a nice way.  Right
now I get this...(attatched).  They look like pickles to me. I want to
be able to read them with a text based system. (Like when I ssh into my
server to see the issues in the application.
---
Best Regards,
Jason Brower
On Mon, 2010-05-10 at 21:56 -0700, mdipierro wrote: 
> are you talking about apache error log, httpserver.log, tickets of
> console logs?
> In the first case we have two apps for that:
> 
> http://web2py.com/appliances/default/show/14
> http://web2py.com/appliances/default/show/27
> 
> I think the second is better.
> 
> On May 10, 11:06 pm, Jason Brower  wrote:
> > When I get errors in my logs I have to scour through the error folder
> > for the issues.  It would be so totally awsome if I were able to see the
> > errors parse and looking snazzy in a texted based (console) error log
> > viewer.  That way I can easily see the errors and what line they are on.
> > Unless there is a better way. :)
> > Best Regards,
> > Jason Brower

(dp1
S'output'
p2
S''
sS'layer'
p3
S'/home/encompass/Programming/Web 
Pages/web2py/applications/2hand/views/default/table_test.html'
p4
sS'code'
p5
S'response.write(\'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>\\nhttp://www.w3.org/1999/xhtml"\\n  
xml:lang="\',escape=False)\nresponse.write(T.accepted_language or 
\'en\')\nresponse.write(\'">\\n  \\n
\',escape=False)\nresponse.write(response.title or 
\'response.title\')\nresponse.write(\'\\n  \\n  \\n  \\n  \\n  \\n  
\',escape=False)\nresponse.files.insert(0,URL(r=request,c=\'static\',f=\'jquery.js\'))\nresponse.files.insert(1,URL(r=request,c=\'static\',f=\'calendar.css\'))\nresponse.files.insert(2,URL(r=request,c=\'static\',f=\'calendar.js\'))\nresponse.files.insert(3,URL(r=request,c=\'static\',f=\'ui.jquery.js\'))\nfor
 _item in response.meta or []:\nresponse.write(\'\\n \',escape=False)\npass\nfor _k,_file in 
enumerate(response.files or []):\nif _file in response.files[:_k]:\n
continue\nelif _file[-4:].lower()==\'.css\':\nresponse.write(\'\\n  
   \',escape=False)\nelif _file[-3:].lower()==\'.js\':\n
response.write(\'\\n \',escape=False)\npass\n
pass\nresponse.write(\'\\n