[web2py] Re: problem (?) with SQLTABLE linkto

2010-05-26 Thread Peter Etchells
linkto can be customised, according to the source:
 eg like
def linkto_table(id, type, ref):
  return URL(r=request, c='default',  f='%s_show'%type,
args=[id])

comment in sqlhtml.py:

Simple linkto example::

rows = db.select(db.sometable.ALL)
table = SQLTABLE(rows, linkto='someurl')

This will link rows[id] to .../sometable/value_of_id

More advanced linkto example::

def mylink(field, type, ref):
return URL(r=request, args=[field])

rows = db.select(db.sometable.ALL)
table = SQLTABLE(rows, linkto=mylink)

This will link rows[id] to
current_app/current_controlle/current_function/value_of_id


[web2py] Re: web2py Conference Management System

2010-05-26 Thread Yarko Tymciurak
Mariano -

Thank you - I hadn't seen that you made a clone.

FYI for others:  you can the list of clones at:
http://code.google.com/p/web2conf/source/clones

I will look over this in June, and look at merging back (there are
things in the base web2conf that need cleanup, updates - which looks
like Mariano made many).

- Yarko

On May 26, 2:32 pm, Mariano Reingart  wrote:
> On Wed, May 26, 2010 at 2:19 PM, Yarko Tymciurak
>
>  wrote:
>
> > On May 26, 9:23 am, KR  wrote:
> >> Hello,
>
> >> There is a Vimeo screencast (http://www.vimeo.com/1838049) about a
> >> web2py Conference Management System. Does anybody know wher I can
> >> download the soource code of that ?
>
> > You can get the version used at PyCon-2010 at code.google.com/p/
> > web2conf
>
> > There is also an older version, which was modified for FLISOL-2010
> > I'll have to find that (eventually, that should be merged back to
> > web2conf).
>
> You can found them in flisol 2010 and pyday branches of my web2conf clone:
>
> http://code.google.com/r/reingart-web2conf/
>
> Flisol:http://code.google.com/r/reingart-web2conf/source/browse/?r=1d551738b...
>
> PyDay:http://code.google.com/r/reingart-web2conf/source/browse/?r=0776772cb...
>
> Running 
> sites:http://www.institutopascal.edu.ar/flisol2010?lang=eshttp://www.pyday.com.ar/rafaela2010?lang=es
>
> Sorry, I didn't have time to generalize them and merge back to the
> web2conf trunk.
>
> > Right now, web2conf needs a few updates and refactorings (typically,
> > during the course of a registration cycle, things are fixed, added,
> > etc. and should be re-visited, cleaned).   For example this web2conf
> > is based on an older version of web2py.
>
> I would be cleaning up some things, if there are any plans, please let me 
> know.
>
> I'm thinking of:
>  * Spearate default.py into talks.py, registration.py statics.py, etc.
>  * Finish talk reviewing/voting
>  * Eliminate some T2 stuff
>  * Rewrite PDF generation (badge and attendance certificate) using
> PyFPDF (removing dependencies like dabo)
>  * Speed-up, caching, cleanup, easier configuration, etc.
>
> Best regards,
>
> Mariano 
> Reingarthttp://www.web2py.com.arhttp://www.sistemasagiles.com.arhttp://reingart.blogspot.com


[web2py] Re: Production releases

2010-05-26 Thread GoldenTiger

Ok, really I did not explain very well

Software testing has different levels of testing
http://en.wikipedia.org/wiki/Software_testing#Testing_levels

Some vulnerabilities in Top 10 OWASP depends on other elections like
webserver or O.S.
Frameworks can't avoid this point, but can protect itself against
possible intrussions.

For example, web2py doesn`t list static folders by default, but an
apache misconfiguration allows listing folders.

I will mail you a more specific example

Others vulns, for example XSS, depends completelly on web2py, and
programmer has all responsability (for this reason xss is the 1º at
owasp)
And scope of SQL injections depends on database

Anyway as soon as I complete my actual job, I will start Fuzzing
Testing against Web2py running as is, on local server.
Fuzzing testing is easy thanks to fuzzing software
http://en.wikipedia.org/wiki/Fuzz_testing
Everyone can use fuzzers to find bugs.
Thanks to web2py ticket system, testing will be easier if possible,
because all errors will be logged
I will take necessary decisions. I will send you results



On 25 mayo, 05:25, mdipierro  wrote:
> I do not know the answer to those questions. I can only say that at
> least you should test the features we claim (sql injection protection,
> xss protection, cross site request forgery protection, and the auth
> mechanism). The rest really depends on the tools and time you have
> available. Perhaps other users have more to say. I appreciate your
> interest in this.
>
> Massimo
>
> On May 24, 10:19 pm, GoldenTiger  wrote:
>
> > Great!! really I 've already planned doing it because i have personal
> > projects that I decided doing it with web2py, instead of django.
> > so for my part I feel better being gratefull with you by all
> > knowledge, by now i got a good paid job by urgent webs, and web2py do
> > it easy anf funny
>
> > My friend's company is a group of 12 hackers about 30 years old , who
> > really enjoy with this. I think theirs strengths are remote testing of
> > linux servers and web applications, the company is on Madrid (Spain),
> > but generally they spends most of his time along auditing systems in
> > another sites of Europe
>
> > I 'll talk with them soon, and I say you
> > you could for example prepare a dedicated server with web2py and
> > probing diferrent server, os, bd, or apps .
> > you goes coding and you want to test. You should be say the level at
> > you want web2py be tested. net level? bruteforce alowed? local access?
> > transport level? application?  if you use ubuntu, you could want
> > testing web2py at ubuntu, or web2py at ubuntu and cherry, and decide
> > if you are included or not in that
>
> > The other way I know of testing an app is undestanding how components
> > are conected, and undestanding the consistency of the logic . Really
> > this is my preffered one ^^ It's not necessary to hack, just imagine
>
> > On 22 mayo, 16:31, mdipierro  wrote:
>
> > > I am very much interested in this. We may even find a couple of $100
> > > to pay for some security testing of web2py. Let me know what we need
> > > to do.
>
> > > Massimo
>
> > > On May 22, 8:53 am, GoldenTiger  wrote:
>
> > > > Well, I have been working for years as security auditor and etichal
> > > > hacking. Last years I decided focusing at more creative works and I
> > > > started personal projects.
> > > > I can do tests against web2py, no problem, but first I want to
> > > > understand the framework as well as possible.
> > > > a friend of mine who auditsbanksweb and networks is interested in
> > > > python frameworks as I said him, so they could be a good help
> > > > In my opinion, the most important thing in secure software is the
> > > > design and the logic, ( microsoft declared some windows desing flaws
> > > > as a not possible solution)
> > > > since web2py was designed 100% before implemention, I can say that
> > > > web2py is probably one of the most consistent frameworks today
> > > > :D


[web2py] Re: Newbie question on self-submitting form

2010-05-26 Thread NoNoNo
Hi Massimo,

Thanks for the reply. I tried your codes and the Previous and Next
works well, however the self-submitting form is still not functioning.
Input any page number and submit, still on the current page.
I'm not sure about the mechanism how the progrom respond to a form
submission, because you mentioned actions are not needed. Now the case
is, there is no response. Which part of code is supposed to receive
and process the submitted content?  I also tried to move input form
clause from VIEW to CONTROLLER to see if it would work, and it didn't.

BTW, for this line:
> messages=db(db.whoelse.id>0).select(orderby=~db.whoelse.created_on,limitby=­limitby)
an error was raise saying 'invalid sytax' which pionts to 'l' after
'='. After inserting a space inbetween, it's ok.



[web2py] Re: apache proxy error

2010-05-26 Thread Graham Dumpleton


On May 27, 1:10 pm, Richard  wrote:
> On May 26, 9:58 pm, Graham Dumpleton 
> wrote:
>
>
>
>
>
> > On May 26, 3:26 pm, Richard  wrote:
>
> > > Occasionally after heavily using my web2py app I get:
>
> > > """
> > > Proxy Error
>
> > > The proxy server received an invalid response from an upstream server.
> > > The proxy server could not handle the request GET /.
>
> > > Reason: Error reading from remote server
> > > """
>
> > What is generating that? If you are using Apache/mod_wsgi the proxy
> > module isn't involved.
>
> > Is that error from a front end proxy server.
>
> I installed web2py with this script on 
> webfaction:http://wiki.webfaction.com/wiki/Web2py-LatestSource
>
> which uses "Python 2.5 along with Apache + mod_wsgi v2.5"
>
> > > The apache server is still running but the app won't work until I
> > > reset apache.
> > > These are the common errors from the Apache log:
>
> > >  server reached MaxClients setting, consider raising the MaxClients
> > > setting
>
> > Which means Apache and/or mod_wsgi daemon mode isn't configured with
> > enough processes/threads to handle the concurrent load you are
> > getting.
>
> hmm, it's just me and I am not making concurrent requests. However
> each serial request I make returns ~1MB of data.
>
> > >  mod_wsgi (pid=20021): Exception occurred processing WSGI script '/
> > > apachewsgi/web2py/wsgihandler.py'.
>
> > >  IOError: client connection closed
>
> > Means that client connection got dropped. This can occur when
> > impatient user pressed reload on page before it returns response, or
> > leaves page via link before returns response.
> > > Any ideas?
> > > Not sure if the problem is with web2py or Apache configuration.
>
> > Not really enough information as don't know what MPM you are using,
> > how you configured the MPM, how you are using mod_wsgi, how you
> > configured it etc etc.
>
> what does MPM stand for?
> None of these looked relevant:http://en.wikipedia.org/wiki/MPM

It is the last one, which is undocumented. See:

  http://httpd.apache.org/docs/2.2/mpm.html

Graham

> > If a restart is required, could be that your Python code isn't
> > multithread safe and you are experiencing thread deadlocks thereby
> > using up threads and locking out new requests.
>
> hopefully not - I just have a web2py controller returning data from a
> sqlite database.
>
> I have had trouble with webfaction lately so am going to try running
> the same app on slicehost and see what happens.
>
> Richard


Re: [web2py] Re: Planet web2py

2010-05-26 Thread Mariano Reingart
On Wed, May 26, 2010 at 11:15 PM, mdipierro  wrote:
> How do you define "web2py-planet"?

A site that read feeds about web2py, publish them in a single webpage,
and provides a new feed where all entries are included:

http://en.wikipedia.org/wiki/Planet_(software)

Although it is mainly used to aggregate blog feeds, another sources
can be used, like googlecode/launchpad project feeds, news sites, etc.

Look at Python Web Planets:

http://planet.python.org/

Maybe a web2py planet-like site including english, portugues, spanish
feeds (of developers and users) would be useful.

Best regards,


Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com


Re: [web2py] Planet web2py

2010-05-26 Thread Alexandre Andrade
>or, is
>there any repository for web2py related application/plugins/slices?)

yes. The web2py.com has a place for applications (appliances)

http://web2py.com/appliances

Just send it to Massimo:

mdipie...@cs.depaul.edu




2010/5/26 Mariano Reingart 

> I'm working with rss2 and feedparser, reached a simple and minimal
> web2py based planet.
>
> See working examples at:
>
> http://www.web2py.com.ar/planet/
> http://planeta.arpug.com.ar/
>
> Uploaded web2py slice at:
>
> http://web2pyslices.com/main/slices/take_slice/82
>
>
>
> It would be nice to have a real web2py planet (even better with
> multiple languages support).
> I remember some discussions about that here, but I don't know the current
> state.
> I can help with the code, hosting, etc.
>
> Best regards,
>
> Mariano Reingart
> http://www.web2py.com.ar
> http://www.sistemasagiles.com.ar
> http://reingart.blogspot.com
>



-- 
Atenciosamente

-- 
=
Alexandre Andrade
Hipercenter.com


[web2py] Re: apache proxy error

2010-05-26 Thread Richard
On May 26, 9:58 pm, Graham Dumpleton 
wrote:
> On May 26, 3:26 pm, Richard  wrote:
>
> > Occasionally after heavily using my web2py app I get:
>
> > """
> > Proxy Error
>
> > The proxy server received an invalid response from an upstream server.
> > The proxy server could not handle the request GET /.
>
> > Reason: Error reading from remote server
> > """
>
> What is generating that? If you are using Apache/mod_wsgi the proxy
> module isn't involved.
>
> Is that error from a front end proxy server.

I installed web2py with this script on webfaction:
http://wiki.webfaction.com/wiki/Web2py-LatestSource

which uses "Python 2.5 along with Apache + mod_wsgi v2.5"


> > The apache server is still running but the app won't work until I
> > reset apache.
> > These are the common errors from the Apache log:
>
> >  server reached MaxClients setting, consider raising the MaxClients
> > setting
>
> Which means Apache and/or mod_wsgi daemon mode isn't configured with
> enough processes/threads to handle the concurrent load you are
> getting.

hmm, it's just me and I am not making concurrent requests. However
each serial request I make returns ~1MB of data.


> >  mod_wsgi (pid=20021): Exception occurred processing WSGI script '/
> > apachewsgi/web2py/wsgihandler.py'.
>
> >  IOError: client connection closed
>
> Means that client connection got dropped. This can occur when
> impatient user pressed reload on page before it returns response, or
> leaves page via link before returns response.
> > Any ideas?
> > Not sure if the problem is with web2py or Apache configuration.
>
> Not really enough information as don't know what MPM you are using,
> how you configured the MPM, how you are using mod_wsgi, how you
> configured it etc etc.

what does MPM stand for?
None of these looked relevant: http://en.wikipedia.org/wiki/MPM


> If a restart is required, could be that your Python code isn't
> multithread safe and you are experiencing thread deadlocks thereby
> using up threads and locking out new requests.

hopefully not - I just have a web2py controller returning data from a
sqlite database.

I have had trouble with webfaction lately so am going to try running
the same app on slicehost and see what happens.

Richard


Re: [web2py] Re: Changes in Development environment

2010-05-26 Thread Alexandre Andrade
Well, if it don't get problems with new tables/fields (migrating), its is
the solution I was looking for.

I just sugest separate the db connections config out of db.py in models,
creating a file 0db_config.py (or similar), to be preserved.
Usually, the settings of database connection(s) are diferent between local
an production environments, and haven't  to be overwritten.


-- 
Atenciosamente

-- 
=
Alexandre Andrade
Hipercenter.com

2010/5/26 mdipierro 

> How about a flag when replacing an app via admin that preserves the
> content of databases/ sessions/ errors/ uploads/ cache/ ?
>
>
> On May 26, 1:08 pm, greenpoise  wrote:
> > Hmmm..I see. Tough stuff. I wonder if there is room for improvement in
> > that area for web2py. Something that is transparent between the
> > developer and the production site.
> >
> > Thanks
> >
> > Dan
> >
> > On May 26, 1:28 pm, Yarko Tymciurak 
> > wrote:
> >
> > > On May 26, 11:53 am, greenpoise  wrote:
> >
> > > > Oh no, I am not developing where the live data resides. But when I
> > > > make changes to my application on my development environment, how do
> I
> > > > transfer/update those changes on my production site?
> >
> > > You have to work out a procedure that works with your production
> > > environment.
> >
> > > Typically, you will want a way to easily "undo" is anything goes
> > > wrong:   I use hg on my production site (and include things like the
> > > databases files - i.e. table migrations - in that versioning).
> >
> > > Then, you will want to work out a cut-over procedure:   if you make
> > > changes to modules, you will typically need to restart the web2py
> > > server;  otherwise, you can push changes to a running site (!).You
> > > will probably want a staging area somewhere - either locally, or on
> > > your production site - where you will have some way to ensure the
> > > correct connection strings, etc. for your production site, before
> > > pushing out to it.
> >
> > > You could run your changes on your production server in a "beta"
> > > server (to make sure the environment doesn't affect anything, and that
> > > you have removed all your debug info, and that the correct connection
> > > string changes are in effect - I like to have mine automatically
> > > change on environment).
> >
> > > Then you need some way to move the files over to the production
> > > server, and finally the production instance.   I use rsync, but you
> > > could use a graphical system, something life filezilla.
> >
> > > Basically, you have to work out your deployment procedure, and
> > > recovery paths.
> >
> > > Regards,
> > > - Yarko
> >
> > > > On May 26, 12:36 pm, Thadeus Burgess  wrote:
> >
> > > > > You probably don't want to develop on your live data.
> >
> > > > > To be able to migrate data the DAL includes two functions..
> >
> > > > > db.export_to_csv_file(open('/path.csv', 'w'))
> > > > > db.import_from_csv_file(open('/path.csv', 'r'))
> >
> > > > > So you can export your data, and then stick it on the server and
> > > > > re-import it. This also has the advantage that you can use
> something
> > > > > like PostgreSQL on your production machine.
> >
> > > > > --
> > > > > Thadeus
> >
> > > > > On Wed, May 26, 2010 at 9:39 AM, greenpoise <
> danel.sega...@gmail.com> wrote:
> > > > > > I have web2py production and my development environment. How
> would I
> > > > > > go for leaving the data intact in my production?  Is there a way?
> What
> > > > > > I did is I packedAll the project and took it to my production but
> I
> > > > > > will keep working on it on my development environment. Is this
> how it
> > > > > > should be done?
> >
> > > > > > Thanks
>


[web2py] Re: A basic problem about threading and time consuming function...

2010-05-26 Thread Allard
I won't have time to work out a async proof of concept at this time. I
hope to get this after some more real world profiling with my web2py
app though. To give you an idea of how an async web framework could
feel as natural in programming style as web2py (eg. no call backs all
over the place), have a look at Concurrence documentation if you're
interested:
http://opensource.hyves.org/concurrence/index.html
To implement async for web2py is probably for the most part
straightforward (monkey patching all the IO). The trouble will be with
external libraries that block and can't be monkey patched. For example
db drivers. Maybe those blocking calls are best dealt with in a thread
pool and queue.

The idea of Comet is to keep the connection open to the client and
flow data as it becomes available:
http://en.wikipedia.org/wiki/Comet_%28programming%29
It saves the overhead of a client polling at intervals and
establishing the connection each time. In a thread per connection
model you would need to keep a thread available per client. A thread
per client can get expensive quickly and does not scale nicely. After
a few hundred connections most servers slow down dramatically because
of thread context switching. See also:
http://www.kegel.com/c10k.html

For most web apps a thread per connection (from a threadpool) won't be
a problem but for for things like Ajax email applications or chat / IM
it does get troublesome.

On May 25, 10:59 pm, mdipierro  wrote:
> On May 25, 9:24 pm, Allard  wrote:
>
> > Comet is a nice way to get this done but I wonder how to implement
> > comet efficiently in web2py.
>
> I have never used comet but I do not see any major problem
>
> > Massimo, does web2py use a threadpool
> > under the hood? For comet you would then quickly run out of threads.
>
> The web server creates a thread pool. for stand alone web2py that
> would be Rocket.
> You do not run out of them any more than any other web app.
>
>
>
> > If you'd try to do this with a thread per connection things would get
> > out of hand pretty quickly so the best way is doing the work
> > asynchronously like Orbited. Alternatives would be using one of the
> > contemporary Python asynchronous libraries. These libraries provide
> > monkey patching of synchronous calls like your url fetching. Some
> > suggestions:
>
> > Gevent: now with support of Postgress, probably the fastest out there
> > Eventlet: used at Lindenlab / Second Life
> > Concurrence: with handy async mysql interface
> > Tornado: full async webserver in Python
>
> > Massimo: what do you think of an asynchronous model for web2py? It'd
> > be great to to have asynchronous capabilities. I am writing an app
> > that will require quite a bit of client initiated background
> > processing (sending emails, resizing images) which I would rather hand
> > off to a green thread and not block one the web2py threads. Curious
> > about your thoughts.
>
> I do not think we can use async IO with web2py. async IO as far as I
> understand would require a different programming style.
> Anyway, if you have a working proof of concept I would like to see it.
>
> Massimo
>
>
>
> > BTW - my first post here. Started to use for web2py for a community
> > site and enjoy working in it a lot! Great work.
>
> > On May 25, 9:39 pm, Candid  wrote:
>
> > > Well, actually there is a way for the server to trigger an action in
> > > the browser. It's called comet. Of course under the hood it's
> > > implemented on top of http, so it's browser who initiates request, but
> > > from the developer perspective it looks like there is dual channel
> > > connection between the browser and the server, and they both can send
> > > messages to each other asynchronously. There are several
> > > implementation of comet technology. I've used Orbited (http://
> > > orbited.org/) and it worked quite well for me.
>
> > > On May 25, 9:00 pm, mdipierro  wrote:
>
> > > > I would use a background process that does the work and adds the items
> > > > to a database table. The index function would periodically refresh or
> > > > pull an updated list via ajax from the database table. there is no way
> > > > for te server to trigger an action in the browser unless 1) the
> > > > browser initiates it or 2) the client code embeds an ajax http server.
> > > > I would stay away from 1 and 2 and
> > > > use reload of ajax.
>
> > > > On May 25, 5:33 pm, Giuseppe Luca Scrofani 
> > > > wrote:
>
> > > > > Hi all, as promised I'm here to prove you are patient and nice :)
> > > > > I' have to make this little app where there is a function that read
> > > > > the html content of several pages of another website (like a spider)
> > > > > and if a specified keyword is found the app refresh a page where there
> > > > > is the growing list of "match".
> > > > > Now, the spider part is already coded, is called search(), it uses
> > > > > twill to log in the target site, read the html of a list of pages,
> > > > > perform some searching procedures and keep a

[web2py] Re: MySQLdb - problem with Lock wait timeout exceeded; try restarting transaction

2010-05-26 Thread mdipierro
Can you describe the error? Do you get wrong sorting? That would be
known bug in the plugin is you have two windows displaying the same
elements.

On May 26, 2:20 pm, RobertVa  wrote:
> Today I encountered unusual error, while ajax sorting list thru jquery
> sortable interface and at the same time reading data from table, where
> sorting took place in a new browser window.
>
> Does this have to do with connection pooling and transactions?
>
> Here is function for sorting items, called thru ajax call:
>
> def sort():
>     #save sort order of all sites
>     data = request.vars.st
>     for idx in range(len(data)):
>         db(db.site.id == int(data[idx])).update(sort_order=idx)
>         #db.site[int(data[idx])] = dict(sort_order=idx)
>     #return ok result
>     response.headers['Content-Type']='text/plain'
>     return "Saved!"
>
> This is function for showing all data from database:
>
> def show():
>     sites = db().select(db.site.ALL, orderby=db.site.sort_order)
>     rs = []
>     sitecount = 1
>     #setup date range for today
>     today =
> datetime.datetime(request.now.year,request.now.month,request.now.day)
>     tomorrow = today + datetime.timedelta(days=1)
>     for site in sites:
>         news = db((db.site_news.site_id ==
> site.id)&(db.site_news.news_date>=today)&(db.site_news.news_date orderby=~db.site_news.news_date)
>         entries = []
>         for item in news:
>             entries.append({'title': item.title, 'link': item.link,
> 'summary': item.get('content', ''), 'hash': item.item_hash, 'id':
> item.id})
>         rs.append({'name': site.name, 'link': site.site_link,
> 'entries': entries, 'id': site.id})
>     return dict(sites=rs)


Re: [web2py] A quick question for everyone - generating a random code 'onvalidation'

2010-05-26 Thread Mr admin
OK here's an example of counting matching records with web2py syntax.

SQL version
   select count(*) from tbbooks where id = 1 group by id;

Note!  if you don't add the GROUP BY clause,  you'll get a count
of 1 record... even if there a NO MATCHES probably NOT what you intended
to do.
The GROUP BY clause give you an "Empty Set" for non-matching search results

web2py version
 matches = db(db.tbbooks.id == 1).count()


On Wed, May 26, 2010 at 2:44 PM, scausten  wrote:

> I'm adding files content to my database with the following code being
> called onvalidation when the form is submitted. It really simply
> generates a 6-digit alphanumeric code as an identifier for the file:
>
> codes = db().select(db.products.code)   # Grabs all the existing codes
> from the database
> while not form.vars.code:
>code = "".join([random.sample(string.ascii_lowercase
> +string.digits, 1)[0] for i in range(6)])  # Creates a code
>if not code in codes:  # If its unique...
>form.vars.code = code   # ...add it into the form vars
>
> It works fine at the moment, but I'm hoping to have several hundred
> thousand files potentially, and I'm worried that the database call to
> pull all existing codes will become a serious bottleneck. The code
> needs to be random and not sequential.
>
> Does anyone have any ideas on how I can do this more elegantly?
>


[web2py] Re: Possible typo in \web2py\gluon\contrib\gql.py

2010-05-26 Thread mdipierro
Oops. Fixing the first problem in trunk.

The second error indicates that db.table.id is a very special field on
GAE therefore you can do

query = db.table.id>0
query = db.table.id==value

but you cannot use it any other query like

db.table.id < 10
db.table.id > 5
db.table.id != 7



On May 26, 9:03 pm, NoNoNo  wrote:
> I was running an app in GAE dev server, an error was encountered while
> hit some function. According to the ticket, the error is :
> NameError: global name 'RuntumeError' is not defined
>
> I assume it would be RuntimeError. Open the the gql.py and corrected
> it. This error disappeared. However, there is another error saying :
> RuntimeError: (field.id  value) is not supported on GAE
>
> Have no idea what this means. Any reply is welcome. Thanks.


[web2py] Re: Planet web2py

2010-05-26 Thread mdipierro
How do you define "web2py-planet"?

On May 26, 2:54 pm, Mariano Reingart  wrote:
> On Wed, May 26, 2010 at 8:09 AM, Álvaro Justen  wrote:
>
> > What do you think on creating a public repository on BitBucket.org or
> > GitHub.org? So we can collaborate with you sending patches, tracking
> > issues etc.
>
> I've created a repository on google code (I don't use bb or git by now):
>
> http://code.google.com/p/planet-web2py/
>
> Let me know if you need access to it.
>
> Best regards,
>
> Mariano 
> Reingarthttp://www.web2py.com.arhttp://www.sistemasagiles.com.arhttp://reingart.blogspot.com


[web2py] Re: Possible Typo in C:\Program Files\Google\google_appengine\web2py\gluon\contrib\gql.py

2010-05-26 Thread NoNoNo
Sorry for the re-submission. Something wrong with my connection, got a
failure when submit.
Someone plz delete duplicated posts.


[web2py] Re: Changes in Development environment

2010-05-26 Thread mdipierro
How about a flag when replacing an app via admin that preserves the
content of databases/ sessions/ errors/ uploads/ cache/ ?


On May 26, 1:08 pm, greenpoise  wrote:
> Hmmm..I see. Tough stuff. I wonder if there is room for improvement in
> that area for web2py. Something that is transparent between the
> developer and the production site.
>
> Thanks
>
> Dan
>
> On May 26, 1:28 pm, Yarko Tymciurak 
> wrote:
>
> > On May 26, 11:53 am, greenpoise  wrote:
>
> > > Oh no, I am not developing where the live data resides. But when I
> > > make changes to my application on my development environment, how do I
> > > transfer/update those changes on my production site?
>
> > You have to work out a procedure that works with your production
> > environment.
>
> > Typically, you will want a way to easily "undo" is anything goes
> > wrong:   I use hg on my production site (and include things like the
> > databases files - i.e. table migrations - in that versioning).
>
> > Then, you will want to work out a cut-over procedure:   if you make
> > changes to modules, you will typically need to restart the web2py
> > server;  otherwise, you can push changes to a running site (!).    You
> > will probably want a staging area somewhere - either locally, or on
> > your production site - where you will have some way to ensure the
> > correct connection strings, etc. for your production site, before
> > pushing out to it.
>
> > You could run your changes on your production server in a "beta"
> > server (to make sure the environment doesn't affect anything, and that
> > you have removed all your debug info, and that the correct connection
> > string changes are in effect - I like to have mine automatically
> > change on environment).
>
> > Then you need some way to move the files over to the production
> > server, and finally the production instance.   I use rsync, but you
> > could use a graphical system, something life filezilla.
>
> > Basically, you have to work out your deployment procedure, and
> > recovery paths.
>
> > Regards,
> > - Yarko
>
> > > On May 26, 12:36 pm, Thadeus Burgess  wrote:
>
> > > > You probably don't want to develop on your live data.
>
> > > > To be able to migrate data the DAL includes two functions..
>
> > > > db.export_to_csv_file(open('/path.csv', 'w'))
> > > > db.import_from_csv_file(open('/path.csv', 'r'))
>
> > > > So you can export your data, and then stick it on the server and
> > > > re-import it. This also has the advantage that you can use something
> > > > like PostgreSQL on your production machine.
>
> > > > --
> > > > Thadeus
>
> > > > On Wed, May 26, 2010 at 9:39 AM, greenpoise  
> > > > wrote:
> > > > > I have web2py production and my development environment. How would I
> > > > > go for leaving the data intact in my production?  Is there a way? What
> > > > > I did is I packedAll the project and took it to my production but I
> > > > > will keep working on it on my development environment. Is this how it
> > > > > should be done?
>
> > > > > Thanks


[web2py] Re: MySQLdb connect() issues

2010-05-26 Thread mdipierro
Thanks for testing dal.py and reporting this. I will upload your fix
in trunk.

On May 26, 9:37 am, Evan  wrote:
> Hey all,
>
> I hit an issue in the MySQLAdapter class trying to establish a
> database connection. It seems the "password" keyword argument in
> connect() should be "passwd"? The python-mysql docs support 
> this:http://mysql-python.sourceforge.net/MySQLdb.html#mysqldb
>
> If this is an issue of different versions of MySQLdb using different
> keyword arguments and a newer version does indeed use "password" then
> please ignore (I'm running python2.5). Otherwise, should this be
> changed?
>
> Thanks,
>
> Evan


[web2py] Possible Typo in C:\Program Files\Google\google_appengine\web2py\gluon\contrib\gql.py

2010-05-26 Thread NoNoNo
I was running an app in GAE dev server, an error was encountered while
hit some function. According to the ticket, the error is :
NameError: global name 'RuntumeError' is not defined

I assume it would be RuntimeError. Open the the gql.py and corrected
it. This error disappeared. However, there is another error saying :
RuntimeError: (field.id  value) is not supported on GAE

Have no idea what this means. Any reply is welcome. Thanks.


[web2py] Re: Anybody going to PyCon?

2010-05-26 Thread mdipierro
I'd love to see some slides of this.

On May 26, 9:25 am, JC11  wrote:
> I sang the praises of web2py at Euro-Python last spring.  My talk was
> not about web2py or web frameworks but about a (very corporate)
> application written with web2py.
>
> Perhaps more talk of what has been built with web2py rather than
> framework comparisons and moaning is the way to go ?
>
> John C.


[web2py] Possible Typo in C:\Program Files\Google\google_appengine\web2py\gluon\contrib\gql.py

2010-05-26 Thread NoNoNo
I was running an app in GAE dev server, an error was encountered while
hit some function. According to the ticket, the error is :
NameError: global name 'RuntumeError' is not defined

I assume it would be RuntimeError. Open the the gql.py and corrected
it. This error disappeared. However, there is another error saying :
RuntimeError: (field.id  value) is not supported on GAE

Have no idea what this means. Any reply is welcome. Thanks.


[web2py] Re: Multiselect Plugin not saving values in database.

2010-05-26 Thread mdipierro
It works when I use it so I am not sure. Can you isolate the problem?
Can you provide a simpler model/controller to reproduce the problem?

On May 26, 9:22 am, ggivler  wrote:
> Tried the reference thing but that doesn't work. I am still not sure
> why your code does not put the values in the database, just the
> separators so I get field with "|||" in them. But I can handle that in
> the routine below and update record. That will let me read it back
> out, I know this is a hack but it will get me one step closer to my
> goal which is a finished product.
>
> The problem I believe comes from the jquery multiselect code, it
> renames the dropdown to add a "[]" at the end, and this causes Python
> a world of problems. Mr. Freeze had a solution so I used his, if you
> call the request.vars dictionary with dictionary syntax having an name
> with "[]" tacked on the end is not a problem.
>
> As I said, I sort of had to hack a solution, I borrowed some stuff
> from mr. freeze's multiselect solution in web2pyslices
>
>         if request.vars['testcase_test_testtypeids[]'] is not None:
>             if len(request.vars['testcase_test_testtypeids[]']) > 0:
>                 for testtypeid in
> request.vars['testcase_test_testtypeids[]']:
>
> db.testcase_testtypes.insert(testcaseid=insertid,testtypeid=testtypeid,recordvalid='T')
>                     print db._lastsql
>
> See the problem I have is the the testtype table is basically just a
> source table to tell the page what values to display. Then I have a
> many to many relationship between testcases and testtypes.
>
> On May 25, 9:02 pm, mdipierro  wrote:
>
> > Not sure but this is a problem I see
>
> > db.testcase_test.testtypeids.requires = IS_IN_DB(testtypes,
> > 'testtype.id', 'testtype.name',multiple=True)
>
> > implies db.testcase_test.testtypeids stored the texttype.id therefore
> > it should be of type reference to db.testtype and not type 'string'
>
> > On May 25, 4:47 pm, ggivler  wrote:
>
> > > I am using the multiselect plugin read and save data from a
> > > crud.create or crude.update form and it just is not working, it seems
> > > to see that there are values there as the field is filled with a "|"
> > > for each option selected. I am not sure what is happening and what I
> > > am doing wrong. Any help would be appreciated.
> > > If I manually fill data into the database and load it using
> > > crud.update(db.testcase_test, testcase_id) it selects the correct
> > > options. I am sure I am missing something stupid and anyone who wants
> > > to point it out would be greatly appreciated.
>
> > > Here is the database table
>
> > > db.define_table('testtype',
> > > Field('name', 'string', length=45),
> > > Field('description', 'text'),
> > > Field('recordvalid', 'boolean'),
> > > migrate=False)
>
> > > db.define_table('testcase_test',
> > > Field('structure', 'string', length=1024,writable=False),
> > > Field('name', 'string', length=255),
> > > Field('description', 'text', length=255),
> > > Field('testmodeid', db.testmode,
> > > requires=IS_IN_DB(db,'testmode.id','testmode.name')),
> > > Field('testtoolid', db.testtool,
> > > requires=IS_IN_DB(db,'testtool.id','testtool.name')),
> > > Field('inputconfigblobid', db.inputblob,
> > > requires=IS_IN_DB(db,'inputblob.id', 'inputblib.localfilename')),
> > > Field('requirementsid', db.requirements,
> > > requires=IS_IN_DB(db,'requirements.id','requirements.name')),
> > > Field('productid',writable=True),
> > > Field('environmentid',writable=True),
> > > Field('commandline', 'string', length=255),
> > > Field('resulttypeid', db.resultstype,
> > > requires=IS_IN_DB(db,'resultstype.id', 'resultstype.resulttype')),
> > > Field('resultunitsid', db.resultunits,
> > > requires=IS_IN_DB(db,'resultunits.id', 'resultunits.unit')),
> > > Field('lowlimit', 'string', length=255),
> > > Field('highlimit', 'string', length=255),
> > > Field('estexectime', 'time'),
> > > Field('lastexectime', 'time', writable=False),
> > > Field('priority','integer',default=-1),
> > > Field('default_priority', 'integer', default=-1),
> > > Field('seqnum', 'integer',default=-1),
> > > Field('testtypeids', 'string'),
> > > migrate=True)
> > > db.testcase_test.structure.label = 'Test Stuite Structure'
> > > db.testcase_test.testmodeid.label = 'Test Mode'
> > > db.testcase_test.testtoolid.label = 'Test Tool'
> > > db.testcase_test.inputconfigblobid.label = 'Test Case Input Config
> > > File'
> > > db.testcase_test.requirementsid.label = 'Test Case Requirements'
> > > db.testcase_test.productid.label = 'Product'
> > > db.testcase_test.commandline.label = 'Test Case Commandline'
> > > db.testcase_test.resulttypeid.label = 'Result Type'
> > > db.testcase_test.resultunitsid.label = 'Result Units'
> > > db.testcase_test.lowlimit.label = 'Low Limit'
> > > db.testcase_test.highlimit.label = 'High Limit'
> > > db.testcase_test.estexectime.label = 'Estimated Execution Time'
> > > db.testcase_test.lastexectime.label = 'Last Execution Time'
> > > db.testca

[web2py] Re: Newbie question on self-submitting form

2010-05-26 Thread mdipierro
The problem is that form should be before select. Anyway you do not
need to actions.

I suggest the following changes:

def index():
items_page=20
page_no=int(request.args(0) or 0)
limitby=(items_page*page_no,items_page*page_no+items_page+1)
#notice + 1
form=crud.create(db.whoelse,next=URL(r=request),message='Your
message is posted')
 
messages=db(db.whoelse.id>0).select(orderby=~db.whoelse.created_on,limitby=limitby)
prev = (page>0) and URL(r=request,args=page_no-1)
next = (len(messages)==items_page+1) and URL(r=request,args=page_no
+1)
return dict(messages=messages[:items_page], entries=entries,
form=form,page=page_no,prev=prev,next=next)

and corresponding view part:
--
{{=form}}
{{=messages}}
{{if prev:}}previous{{pass}}
{{if next:}}previous{{next}}

--

On May 26, 3:12 am, NoNoNo  wrote:
> Hi,
>
> I'm quite new to web2py and currently building a simple application: a
> message board, listing latest 20 messages by index(). For earlier
> messages, there is a  self-submitting form to enter page number (20
> message each page) to go to, and after submitting the form, redirects
> to that page. Here is the question on the self-submitting form:
> nothing changed (always showing the 1st page) whatever number is input
> into the form. Controller as follows:
>
> def index():
>     page_no=1
>     entries=db(db.whoelse.id > 0).count()
>     messages=db((db.whoelse.id>(entries-20)) &
> (db.whoelse.id<=entries)).select(db.whoelse.ALL,
> orderby=~db.whoelse.created_on)
>
>     if request.vars.page_no:
>         if request.vars.page_no>(entries/20+1):
>             redirect(URL(r=request, f='index'))
>         else:
>             redirect(URL(r=request, f='gotopage')
>     form=crud.create(db.whoelse,
> next=URL(r=request,args=1),message='Your message is posted')
>     return dict(messages=messages, entries=entries,
> form=form,page=page_no)
>
> def gotopage():
>     entries=db(db.whoelse.id > 0).count()
>     messages=db((db.whoelse.id>(entries-request.vars.page_no*20)) &
> (db.whoelse.id<=((entries-
> (request.vars.page_no-1)*20.select(db.whoelse.ALL,
> orderby=~db.whoelse.created_on)
>
>     form=crud.create(db.whoelse,
> next=URL(r=request,args=1),message='Your message is posted')
>     return dict(messages=messages, entries=entries, form=form,
> page=request.vars.page_no)
> --
> and corresponding view part:
>  {{=page}}/{{=entries/20+1}} PagesGo to
> page:   h5>
> --
>
> Any reply will be appreciated.
>
> Spring


[web2py] Possible typo in \web2py\gluon\contrib\gql.py

2010-05-26 Thread NoNoNo
I was running an app in GAE dev server, an error was encountered while
hit some function. According to the ticket, the error is :
NameError: global name 'RuntumeError' is not defined

I assume it would be RuntimeError. Open the the gql.py and corrected
it. This error disappeared. However, there is another error saying :
RuntimeError: (field.id  value) is not supported on GAE

Have no idea what this means. Any reply is welcome. Thanks.


Re: [web2py] postgresql connection problem

2010-05-26 Thread Thadeus Burgess
Try

postgres://w2p:passw...@localhost:5432/w2p

--
Thadeus





On Wed, May 26, 2010 at 5:17 PM, Julius Minka  wrote:
> This is virtual server with centos 5.5 in internet.
> I have successfully instaled web2py with Apache and mod_wsgi based
> mainly on instructions from
> http://web2py.com/AlterEgo/default/show/239 and
> http://web2py.com/AlterEgo/default/show/240
>
> Probably last step is missing.
> I am getting this error when accessing site from internet:
> RuntimeError: Failure to connect to DB. Tried 5 times
>
> when I start it from command line, it shows support for PostgreSQL:
> python2.6 web2py/web2py.py -i xx.xx.xx.xx -p  -a password
>
> web2py Enterprise Web Framework
> Created by Massimo Di Pierro, Copyright 2007-2010
> Version 1.78.3 (2010-05-17 21:59:39)
> Database drivers available: PostgreSQL
> Starting hardcron...
> WARNING:root:GUI not available because Tk library is not installed
> please visit:
>        http://..
>
>
> I can verify access from command line:
> psql -U w2p -d w2p -h 127.0.0.1 -p 5432
> Password for user w2p:
> Welcome to psql 8.1.21, the PostgreSQL interactive terminal.
>
> Type:  \copyright for distribution terms
>       \h for help with SQL commands
>       \? for help with psql commands
>       \g or terminate with semicolon to execute query
>       \q to quit
>
> w2p=# \q
>
> It works.
>
>
> In ... web2py/applications/welcome/models/db.py
> db = DAL('postgres://w2p:passw...@127.0.0.1:5432/w2p')
>
> What could be the problem? I have no further idea how to verify the
> reason for failure of connection.
>
> Julius
>
>
>


[web2py] Re: scripts/setup-web2py-ubuntu.sh and web2py.ubuntu.sh incompatible?

2010-05-26 Thread Christopher Steel
Hi Doug,

For local development setup-web2py-ubuntu.sh is probably the way you
want to go.

I have not used the other script, web2py-ubuntu.sh but it appears to
be startup (init.d) script for Debian based Linux servers. In other
words it allows you to automatically start Web2py on bootup of a
(production) server and to stop start, and restart Web2py as a service
or daemon.

It looks to me like the reference to /usr/lib/web2py refers to the
daemon directory and not web2py itself. It may be that you would need
to set a Web2py path and/or install it using the Debian packaging
system as the script does not appear to include any web2py path info.

I know that someone in the group was working on a Debian installer for
Web2py but I am not sure if it was ever completed. I suspect that most
developers just install it using the first script mentioned because
this gives you the very latest version of Web2py and everything is
located in one directory.

Cheers,

Chris




On May 26, 12:11 pm, Doug Warren  wrote:
> Hi,
>
> I'm setting up a new dev environment for some users under Ubuntu 10 and I
> notice that the two supplied scripts in the scripts dir for dealing with
> Ubuntu seem to not be compatible...  setup-web2py uses a 'www-data'
> directory with an install path in /home/www-data among other things.
> web2py.ubuntu.sh assumes an install path of /usr/lib/web2py and an installed
> user of web2py.  Any thoughts of combining these?


[web2py] postgresql connection problem

2010-05-26 Thread Julius Minka
This is virtual server with centos 5.5 in internet.
I have successfully instaled web2py with Apache and mod_wsgi based
mainly on instructions from 
http://web2py.com/AlterEgo/default/show/239 and 
http://web2py.com/AlterEgo/default/show/240

Probably last step is missing.
I am getting this error when accessing site from internet:
RuntimeError: Failure to connect to DB. Tried 5 times

when I start it from command line, it shows support for PostgreSQL:
python2.6 web2py/web2py.py -i xx.xx.xx.xx -p  -a password

web2py Enterprise Web Framework
Created by Massimo Di Pierro, Copyright 2007-2010
Version 1.78.3 (2010-05-17 21:59:39)
Database drivers available: PostgreSQL
Starting hardcron...
WARNING:root:GUI not available because Tk library is not installed
please visit:
http://..


I can verify access from command line:
psql -U w2p -d w2p -h 127.0.0.1 -p 5432
Password for user w2p: 
Welcome to psql 8.1.21, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
   \h for help with SQL commands
   \? for help with psql commands
   \g or terminate with semicolon to execute query
   \q to quit

w2p=# \q

It works.


In ... web2py/applications/welcome/models/db.py
db = DAL('postgres://w2p:passw...@127.0.0.1:5432/w2p')

What could be the problem? I have no further idea how to verify the
reason for failure of connection.

Julius




[web2py] Re: Top 3 web2py features

2010-05-26 Thread weheh
1) One language -- python (other systems have multiple languages or
non-standard languages such as Ruby)

2) Batteries included:
  - built-in authentication and security against various hacks
  - built-in admin interface
  - built-in json, xml, rss, screen-scraper ... interfaces/facilities
  - built-in CRUD

3) DAL
  - write once, run on virtually any database

All this with performance, simplicity, consistency and scalability


[web2py] Re: A quick question for everyone - generating a random code 'onvalidation'

2010-05-26 Thread NetAdmin
Sort of like this
mysql> select id from tbbooks where id = 8;
Empty set (0.00 sec)

mysql> select id from tbbooks where id = 1;
++
| id |
++
|  1 |
++
1 row in set (0.00 sec)


On May 26, 2:44 pm, scausten  wrote:
> I'm adding files content to my database with the following code being
> called onvalidation when the form is submitted. It really simply
> generates a 6-digit alphanumeric code as an identifier for the file:
>
> codes = db().select(db.products.code)   # Grabs all the existing codes
> from the database
> while not form.vars.code:
>     code = "".join([random.sample(string.ascii_lowercase
> +string.digits, 1)[0] for i in range(6)])  # Creates a code
>     if not code in codes:  # If its unique...
>         form.vars.code = code   # ...add it into the form vars
>
> It works fine at the moment, but I'm hoping to have several hundred
> thousand files potentially, and I'm worried that the database call to
> pull all existing codes will become a serious bottleneck. The code
> needs to be random and not sequential.
>
> Does anyone have any ideas on how I can do this more elegantly?


[web2py] Re: A quick question for everyone - generating a random code 'onvalidation'

2010-05-26 Thread NetAdmin

Instead of
codes = db().select(db.products.code)   # Grabs all the existing
codes

how about something like,
  # generate random code
  code = generatecode()
  # look to see if a matching code is in the table
  select stored_code from table where stored_code =code
  #  if no code is returned... then the code is unique

Sorry but I didn't have time to convert pseudocode to web2py syntax


On May 26, 2:44 pm, scausten  wrote:
> I'm adding files content to my database with the following code being
> called onvalidation when the form is submitted. It really simply
> generates a 6-digit alphanumeric code as an identifier for the file:
>
> codes = db().select(db.products.code)   # Grabs all the existing codes
> from the database
> while not form.vars.code:
>     code = "".join([random.sample(string.ascii_lowercase
> +string.digits, 1)[0] for i in range(6)])  # Creates a code
>     if not code in codes:  # If its unique...
>         form.vars.code = code   # ...add it into the form vars
>
> It works fine at the moment, but I'm hoping to have several hundred
> thousand files potentially, and I'm worried that the database call to
> pull all existing codes will become a serious bottleneck. The code
> needs to be random and not sequential.
>
> Does anyone have any ideas on how I can do this more elegantly?


Re: [web2py] Planet web2py

2010-05-26 Thread Mariano Reingart
On Wed, May 26, 2010 at 8:09 AM, Álvaro Justen  wrote:
>
> What do you think on creating a public repository on BitBucket.org or
> GitHub.org? So we can collaborate with you sending patches, tracking
> issues etc.

I've created a repository on google code (I don't use bb or git by now):

http://code.google.com/p/planet-web2py/

Let me know if you need access to it.

Best regards,

Mariano Reingart
http://www.web2py.com.ar
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com


[web2py] A quick question for everyone - generating a random code 'onvalidation'

2010-05-26 Thread scausten
I'm adding files content to my database with the following code being
called onvalidation when the form is submitted. It really simply
generates a 6-digit alphanumeric code as an identifier for the file:

codes = db().select(db.products.code)   # Grabs all the existing codes
from the database
while not form.vars.code:
code = "".join([random.sample(string.ascii_lowercase
+string.digits, 1)[0] for i in range(6)])  # Creates a code
if not code in codes:  # If its unique...
form.vars.code = code   # ...add it into the form vars

It works fine at the moment, but I'm hoping to have several hundred
thousand files potentially, and I'm worried that the database call to
pull all existing codes will become a serious bottleneck. The code
needs to be random and not sequential.

Does anyone have any ideas on how I can do this more elegantly?


Re: [web2py] Re: web2py Conference Management System

2010-05-26 Thread Mariano Reingart
On Wed, May 26, 2010 at 2:19 PM, Yarko Tymciurak
 wrote:
>
> On May 26, 9:23 am, KR  wrote:
>> Hello,
>>
>> There is a Vimeo screencast (http://www.vimeo.com/1838049) about a
>> web2py Conference Management System. Does anybody know wher I can
>> download the soource code of that ?
>
> You can get the version used at PyCon-2010 at code.google.com/p/
> web2conf
>
> There is also an older version, which was modified for FLISOL-2010
> I'll have to find that (eventually, that should be merged back to
> web2conf).

You can found them in flisol 2010 and pyday branches of my web2conf clone:

http://code.google.com/r/reingart-web2conf/

Flisol:
http://code.google.com/r/reingart-web2conf/source/browse/?r=1d551738bb21f301618a8e26c878ed0e65b02900

PyDay:
http://code.google.com/r/reingart-web2conf/source/browse/?r=0776772cbeb976031d791c4a35d3f809d80b0764

Running sites:
http://www.institutopascal.edu.ar/flisol2010?lang=es
http://www.pyday.com.ar/rafaela2010?lang=es

Sorry, I didn't have time to generalize them and merge back to the
web2conf trunk.

> Right now, web2conf needs a few updates and refactorings (typically,
> during the course of a registration cycle, things are fixed, added,
> etc. and should be re-visited, cleaned).   For example this web2conf
> is based on an older version of web2py.

I would be cleaning up some things, if there are any plans, please let me know.

I'm thinking of:
 * Spearate default.py into talks.py, registration.py statics.py, etc.
 * Finish talk reviewing/voting
 * Eliminate some T2 stuff
 * Rewrite PDF generation (badge and attendance certificate) using
PyFPDF (removing dependencies like dabo)
 * Speed-up, caching, cleanup, easier configuration, etc.

Best regards,

Mariano Reingart
http://www.web2py.com.ar
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com


[web2py] MySQLdb - problem with Lock wait timeout exceeded; try restarting transaction

2010-05-26 Thread RobertVa
Today I encountered unusual error, while ajax sorting list thru jquery
sortable interface and at the same time reading data from table, where
sorting took place in a new browser window.

Does this have to do with connection pooling and transactions?

Here is function for sorting items, called thru ajax call:

def sort():
#save sort order of all sites
data = request.vars.st
for idx in range(len(data)):
db(db.site.id == int(data[idx])).update(sort_order=idx)
#db.site[int(data[idx])] = dict(sort_order=idx)
#return ok result
response.headers['Content-Type']='text/plain'
return "Saved!"

This is function for showing all data from database:

def show():
sites = db().select(db.site.ALL, orderby=db.site.sort_order)
rs = []
sitecount = 1
#setup date range for today
today =
datetime.datetime(request.now.year,request.now.month,request.now.day)
tomorrow = today + datetime.timedelta(days=1)
for site in sites:
news = db((db.site_news.site_id ==
site.id)&(db.site_news.news_date>=today)&(db.site_news.news_date

[web2py] Re: Changes in Development environment

2010-05-26 Thread Yarko Tymciurak
On May 26, 1:40 pm, Yarko Tymciurak 
wrote:
> also consider:
>
> of the 3 places:  development, staging / final testing, and
> deployment,
>
> some people stage by migrating / merging their existing site to a
> staging site, and then take their current deployment site "down" and
> deploy the staging site --- this is the kind of thing you _might_ want
> to do if you were (for example) to upgrade a major version of web2py -
> to ensure you don't have old files that might get in the way around
> any more.
>
> The operation you are doing really has a significant impact on how
> you'll want to do things.

whereas, with web2py incremental development (adding tables, adding
controller functions, adding views)  are such that your users will
never likely even notice that you upgraded -  it will just be added
while the system is running...

>
> On May 26, 1:34 pm, Yarko Tymciurak 
> wrote:
>
> > On May 26, 1:08 pm, greenpoise  wrote:
>
> > > Hmmm..I see. Tough stuff. I wonder if there is room for improvement in
> > > that area for web2py. Something that is transparent between the
> > > developer and the production site.
>
> > Generally there are too many variables that depend on the target site
> > (although there might be some plugin you could make to help _your_
> > particular situation, it's less likely that it would be worth the
> > effort to make it more generally useful but think about it - maybe
> > you'll show me to be wrong!).
>
> > If you draw a diagram of the places, and their constraints that are
> > involved in deployment, you'll see what's involved.
>
> > Some tools take your local machine development environment, and push
> > it directly to a "production" site.   This was a workable concept for
> > static HTML page sites,   but I don't know of anyone that does that
> > with dynamic sites.
>
> > You have:
> > - a development "spot"
> > - a deployed-context  test "spot" (e.g. on your server, with your db
> > server)
> > - and you have a "live" site - which you decide to either take down
> > (consider migrate=False, and you make changes to tables - something
> > has to be done)  or keep running (and not take away from users
>
> > Some things (reports, migrations) you can do most easily with a web2py
> > shell;   some with a file transfer / sync tool;   some most easily
> > through the web2py admin interface (I don't use it on a production
> > site, except in case of trouble or very unusual circumstances).
>
> > The list gets rather large rather quickly.   And how you want to
> > handle it depends on your audience and their site (I'd handle a blog
> > differently than a conference registration site, with thousands of
> > users ... and dollars exchanging!)
>
> > Regards,
> > - Yarko
>
> > > Thanks
>
> > > Dan
>
> > > On May 26, 1:28 pm, Yarko Tymciurak 
> > > wrote:
>
> > > > On May 26, 11:53 am, greenpoise  wrote:
>
> > > > > Oh no, I am not developing where the live data resides. But when I
> > > > > make changes to my application on my development environment, how do I
> > > > > transfer/update those changes on my production site?
>
> > > > You have to work out a procedure that works with your production
> > > > environment.
>
> > > > Typically, you will want a way to easily "undo" is anything goes
> > > > wrong:   I use hg on my production site (and include things like the
> > > > databases files - i.e. table migrations - in that versioning).
>
> > > > Then, you will want to work out a cut-over procedure:   if you make
> > > > changes to modules, you will typically need to restart the web2py
> > > > server;  otherwise, you can push changes to a running site (!).    You
> > > > will probably want a staging area somewhere - either locally, or on
> > > > your production site - where you will have some way to ensure the
> > > > correct connection strings, etc. for your production site, before
> > > > pushing out to it.
>
> > > > You could run your changes on your production server in a "beta"
> > > > server (to make sure the environment doesn't affect anything, and that
> > > > you have removed all your debug info, and that the correct connection
> > > > string changes are in effect - I like to have mine automatically
> > > > change on environment).
>
> > > > Then you need some way to move the files over to the production
> > > > server, and finally the production instance.   I use rsync, but you
> > > > could use a graphical system, something life filezilla.
>
> > > > Basically, you have to work out your deployment procedure, and
> > > > recovery paths.
>
> > > > Regards,
> > > > - Yarko
>
> > > > > On May 26, 12:36 pm, Thadeus Burgess  wrote:
>
> > > > > > You probably don't want to develop on your live data.
>
> > > > > > To be able to migrate data the DAL includes two functions..
>
> > > > > > db.export_to_csv_file(open('/path.csv', 'w'))
> > > > > > db.import_from_csv_file(open('/path.csv', 'r'))
>
> > > > > > So you can export your data, and then stick it on the server and
> > > > > > re-import i

[web2py] Re: Changes in Development environment

2010-05-26 Thread Yarko Tymciurak
also consider:

of the 3 places:  development, staging / final testing, and
deployment,

some people stage by migrating / merging their existing site to a
staging site, and then take their current deployment site "down" and
deploy the staging site --- this is the kind of thing you _might_ want
to do if you were (for example) to upgrade a major version of web2py -
to ensure you don't have old files that might get in the way around
any more.

The operation you are doing really has a significant impact on how
you'll want to do things.



On May 26, 1:34 pm, Yarko Tymciurak 
wrote:
> On May 26, 1:08 pm, greenpoise  wrote:
>
> > Hmmm..I see. Tough stuff. I wonder if there is room for improvement in
> > that area for web2py. Something that is transparent between the
> > developer and the production site.
>
> Generally there are too many variables that depend on the target site
> (although there might be some plugin you could make to help _your_
> particular situation, it's less likely that it would be worth the
> effort to make it more generally useful but think about it - maybe
> you'll show me to be wrong!).
>
> If you draw a diagram of the places, and their constraints that are
> involved in deployment, you'll see what's involved.
>
> Some tools take your local machine development environment, and push
> it directly to a "production" site.   This was a workable concept for
> static HTML page sites,   but I don't know of anyone that does that
> with dynamic sites.
>
> You have:
> - a development "spot"
> - a deployed-context  test "spot" (e.g. on your server, with your db
> server)
> - and you have a "live" site - which you decide to either take down
> (consider migrate=False, and you make changes to tables - something
> has to be done)  or keep running (and not take away from users
>
> Some things (reports, migrations) you can do most easily with a web2py
> shell;   some with a file transfer / sync tool;   some most easily
> through the web2py admin interface (I don't use it on a production
> site, except in case of trouble or very unusual circumstances).
>
> The list gets rather large rather quickly.   And how you want to
> handle it depends on your audience and their site (I'd handle a blog
> differently than a conference registration site, with thousands of
> users ... and dollars exchanging!)
>
> Regards,
> - Yarko
>
>
>
> > Thanks
>
> > Dan
>
> > On May 26, 1:28 pm, Yarko Tymciurak 
> > wrote:
>
> > > On May 26, 11:53 am, greenpoise  wrote:
>
> > > > Oh no, I am not developing where the live data resides. But when I
> > > > make changes to my application on my development environment, how do I
> > > > transfer/update those changes on my production site?
>
> > > You have to work out a procedure that works with your production
> > > environment.
>
> > > Typically, you will want a way to easily "undo" is anything goes
> > > wrong:   I use hg on my production site (and include things like the
> > > databases files - i.e. table migrations - in that versioning).
>
> > > Then, you will want to work out a cut-over procedure:   if you make
> > > changes to modules, you will typically need to restart the web2py
> > > server;  otherwise, you can push changes to a running site (!).    You
> > > will probably want a staging area somewhere - either locally, or on
> > > your production site - where you will have some way to ensure the
> > > correct connection strings, etc. for your production site, before
> > > pushing out to it.
>
> > > You could run your changes on your production server in a "beta"
> > > server (to make sure the environment doesn't affect anything, and that
> > > you have removed all your debug info, and that the correct connection
> > > string changes are in effect - I like to have mine automatically
> > > change on environment).
>
> > > Then you need some way to move the files over to the production
> > > server, and finally the production instance.   I use rsync, but you
> > > could use a graphical system, something life filezilla.
>
> > > Basically, you have to work out your deployment procedure, and
> > > recovery paths.
>
> > > Regards,
> > > - Yarko
>
> > > > On May 26, 12:36 pm, Thadeus Burgess  wrote:
>
> > > > > You probably don't want to develop on your live data.
>
> > > > > To be able to migrate data the DAL includes two functions..
>
> > > > > db.export_to_csv_file(open('/path.csv', 'w'))
> > > > > db.import_from_csv_file(open('/path.csv', 'r'))
>
> > > > > So you can export your data, and then stick it on the server and
> > > > > re-import it. This also has the advantage that you can use something
> > > > > like PostgreSQL on your production machine.
>
> > > > > --
> > > > > Thadeus
>
> > > > > On Wed, May 26, 2010 at 9:39 AM, greenpoise  
> > > > > wrote:
> > > > > > I have web2py production and my development environment. How would I
> > > > > > go for leaving the data intact in my production?  Is there a way? 
> > > > > > What
> > > > > > I did is I packedAll the project and to

[web2py] Re: Changes in Development environment

2010-05-26 Thread Yarko Tymciurak

On May 26, 1:08 pm, greenpoise  wrote:
> Hmmm..I see. Tough stuff. I wonder if there is room for improvement in
> that area for web2py. Something that is transparent between the
> developer and the production site.

Generally there are too many variables that depend on the target site
(although there might be some plugin you could make to help _your_
particular situation, it's less likely that it would be worth the
effort to make it more generally useful but think about it - maybe
you'll show me to be wrong!).

If you draw a diagram of the places, and their constraints that are
involved in deployment, you'll see what's involved.

Some tools take your local machine development environment, and push
it directly to a "production" site.   This was a workable concept for
static HTML page sites,   but I don't know of anyone that does that
with dynamic sites.

You have:
- a development "spot"
- a deployed-context  test "spot" (e.g. on your server, with your db
server)
- and you have a "live" site - which you decide to either take down
(consider migrate=False, and you make changes to tables - something
has to be done)  or keep running (and not take away from users

Some things (reports, migrations) you can do most easily with a web2py
shell;   some with a file transfer / sync tool;   some most easily
through the web2py admin interface (I don't use it on a production
site, except in case of trouble or very unusual circumstances).

The list gets rather large rather quickly.   And how you want to
handle it depends on your audience and their site (I'd handle a blog
differently than a conference registration site, with thousands of
users ... and dollars exchanging!)

Regards,
- Yarko
>
> Thanks
>
> Dan
>
> On May 26, 1:28 pm, Yarko Tymciurak 
> wrote:
>
> > On May 26, 11:53 am, greenpoise  wrote:
>
> > > Oh no, I am not developing where the live data resides. But when I
> > > make changes to my application on my development environment, how do I
> > > transfer/update those changes on my production site?
>
> > You have to work out a procedure that works with your production
> > environment.
>
> > Typically, you will want a way to easily "undo" is anything goes
> > wrong:   I use hg on my production site (and include things like the
> > databases files - i.e. table migrations - in that versioning).
>
> > Then, you will want to work out a cut-over procedure:   if you make
> > changes to modules, you will typically need to restart the web2py
> > server;  otherwise, you can push changes to a running site (!).    You
> > will probably want a staging area somewhere - either locally, or on
> > your production site - where you will have some way to ensure the
> > correct connection strings, etc. for your production site, before
> > pushing out to it.
>
> > You could run your changes on your production server in a "beta"
> > server (to make sure the environment doesn't affect anything, and that
> > you have removed all your debug info, and that the correct connection
> > string changes are in effect - I like to have mine automatically
> > change on environment).
>
> > Then you need some way to move the files over to the production
> > server, and finally the production instance.   I use rsync, but you
> > could use a graphical system, something life filezilla.
>
> > Basically, you have to work out your deployment procedure, and
> > recovery paths.
>
> > Regards,
> > - Yarko
>
> > > On May 26, 12:36 pm, Thadeus Burgess  wrote:
>
> > > > You probably don't want to develop on your live data.
>
> > > > To be able to migrate data the DAL includes two functions..
>
> > > > db.export_to_csv_file(open('/path.csv', 'w'))
> > > > db.import_from_csv_file(open('/path.csv', 'r'))
>
> > > > So you can export your data, and then stick it on the server and
> > > > re-import it. This also has the advantage that you can use something
> > > > like PostgreSQL on your production machine.
>
> > > > --
> > > > Thadeus
>
> > > > On Wed, May 26, 2010 at 9:39 AM, greenpoise  
> > > > wrote:
> > > > > I have web2py production and my development environment. How would I
> > > > > go for leaving the data intact in my production?  Is there a way? What
> > > > > I did is I packedAll the project and took it to my production but I
> > > > > will keep working on it on my development environment. Is this how it
> > > > > should be done?
>
> > > > > Thanks


[web2py] Re: Changes in Development environment

2010-05-26 Thread greenpoise
Hmmm..I see. Tough stuff. I wonder if there is room for improvement in
that area for web2py. Something that is transparent between the
developer and the production site.


Thanks

Dan

On May 26, 1:28 pm, Yarko Tymciurak 
wrote:
> On May 26, 11:53 am, greenpoise  wrote:
>
> > Oh no, I am not developing where the live data resides. But when I
> > make changes to my application on my development environment, how do I
> > transfer/update those changes on my production site?
>
> You have to work out a procedure that works with your production
> environment.
>
> Typically, you will want a way to easily "undo" is anything goes
> wrong:   I use hg on my production site (and include things like the
> databases files - i.e. table migrations - in that versioning).
>
> Then, you will want to work out a cut-over procedure:   if you make
> changes to modules, you will typically need to restart the web2py
> server;  otherwise, you can push changes to a running site (!).    You
> will probably want a staging area somewhere - either locally, or on
> your production site - where you will have some way to ensure the
> correct connection strings, etc. for your production site, before
> pushing out to it.
>
> You could run your changes on your production server in a "beta"
> server (to make sure the environment doesn't affect anything, and that
> you have removed all your debug info, and that the correct connection
> string changes are in effect - I like to have mine automatically
> change on environment).
>
> Then you need some way to move the files over to the production
> server, and finally the production instance.   I use rsync, but you
> could use a graphical system, something life filezilla.
>
> Basically, you have to work out your deployment procedure, and
> recovery paths.
>
> Regards,
> - Yarko
>
>
>
> > On May 26, 12:36 pm, Thadeus Burgess  wrote:
>
> > > You probably don't want to develop on your live data.
>
> > > To be able to migrate data the DAL includes two functions..
>
> > > db.export_to_csv_file(open('/path.csv', 'w'))
> > > db.import_from_csv_file(open('/path.csv', 'r'))
>
> > > So you can export your data, and then stick it on the server and
> > > re-import it. This also has the advantage that you can use something
> > > like PostgreSQL on your production machine.
>
> > > --
> > > Thadeus
>
> > > On Wed, May 26, 2010 at 9:39 AM, greenpoise  
> > > wrote:
> > > > I have web2py production and my development environment. How would I
> > > > go for leaving the data intact in my production?  Is there a way? What
> > > > I did is I packedAll the project and took it to my production but I
> > > > will keep working on it on my development environment. Is this how it
> > > > should be done?
>
> > > > Thanks


[web2py] Re: Changes in Development environment

2010-05-26 Thread Yarko Tymciurak
On May 26, 11:53 am, greenpoise  wrote:
> Oh no, I am not developing where the live data resides. But when I
> make changes to my application on my development environment, how do I
> transfer/update those changes on my production site?

You have to work out a procedure that works with your production
environment.

Typically, you will want a way to easily "undo" is anything goes
wrong:   I use hg on my production site (and include things like the
databases files - i.e. table migrations - in that versioning).

Then, you will want to work out a cut-over procedure:   if you make
changes to modules, you will typically need to restart the web2py
server;  otherwise, you can push changes to a running site (!).You
will probably want a staging area somewhere - either locally, or on
your production site - where you will have some way to ensure the
correct connection strings, etc. for your production site, before
pushing out to it.

You could run your changes on your production server in a "beta"
server (to make sure the environment doesn't affect anything, and that
you have removed all your debug info, and that the correct connection
string changes are in effect - I like to have mine automatically
change on environment).

Then you need some way to move the files over to the production
server, and finally the production instance.   I use rsync, but you
could use a graphical system, something life filezilla.

Basically, you have to work out your deployment procedure, and
recovery paths.

Regards,
- Yarko
>
> On May 26, 12:36 pm, Thadeus Burgess  wrote:
>
> > You probably don't want to develop on your live data.
>
> > To be able to migrate data the DAL includes two functions..
>
> > db.export_to_csv_file(open('/path.csv', 'w'))
> > db.import_from_csv_file(open('/path.csv', 'r'))
>
> > So you can export your data, and then stick it on the server and
> > re-import it. This also has the advantage that you can use something
> > like PostgreSQL on your production machine.
>
> > --
> > Thadeus
>
> > On Wed, May 26, 2010 at 9:39 AM, greenpoise  wrote:
> > > I have web2py production and my development environment. How would I
> > > go for leaving the data intact in my production?  Is there a way? What
> > > I did is I packedAll the project and took it to my production but I
> > > will keep working on it on my development environment. Is this how it
> > > should be done?
>
> > > Thanks


[web2py] Re: web2py Conference Management System

2010-05-26 Thread Yarko Tymciurak

On May 26, 9:23 am, KR  wrote:
> Hello,
>
> There is a Vimeo screencast (http://www.vimeo.com/1838049) about a
> web2py Conference Management System. Does anybody know wher I can
> download the soource code of that ?

You can get the version used at PyCon-2010 at code.google.com/p/
web2conf

There is also an older version, which was modified for FLISOL-2010
I'll have to find that (eventually, that should be merged back to
web2conf).

Right now, web2conf needs a few updates and refactorings (typically,
during the course of a registration cycle, things are fixed, added,
etc. and should be re-visited, cleaned).   For example this web2conf
is based on an older version of web2py.

Regards,
- Yarko


[web2py] Re: Changes in Development environment

2010-05-26 Thread greenpoise
Oh no, I am not developing where the live data resides. But when I
make changes to my application on my development environment, how do I
transfer/update those changes on my production site?



On May 26, 12:36 pm, Thadeus Burgess  wrote:
> You probably don't want to develop on your live data.
>
> To be able to migrate data the DAL includes two functions..
>
> db.export_to_csv_file(open('/path.csv', 'w'))
> db.import_from_csv_file(open('/path.csv', 'r'))
>
> So you can export your data, and then stick it on the server and
> re-import it. This also has the advantage that you can use something
> like PostgreSQL on your production machine.
>
> --
> Thadeus
>
> On Wed, May 26, 2010 at 9:39 AM, greenpoise  wrote:
> > I have web2py production and my development environment. How would I
> > go for leaving the data intact in my production?  Is there a way? What
> > I did is I packedAll the project and took it to my production but I
> > will keep working on it on my development environment. Is this how it
> > should be done?
>
> > Thanks


Re: [web2py] Changes in Development environment

2010-05-26 Thread Thadeus Burgess
You probably don't want to develop on your live data.

To be able to migrate data the DAL includes two functions..

db.export_to_csv_file(open('/path.csv', 'w'))
db.import_from_csv_file(open('/path.csv', 'r'))

So you can export your data, and then stick it on the server and
re-import it. This also has the advantage that you can use something
like PostgreSQL on your production machine.

--
Thadeus





On Wed, May 26, 2010 at 9:39 AM, greenpoise  wrote:
> I have web2py production and my development environment. How would I
> go for leaving the data intact in my production?  Is there a way? What
> I did is I packedAll the project and took it to my production but I
> will keep working on it on my development environment. Is this how it
> should be done?
>
>
> Thanks
>


[web2py] Re: web2py Database issues

2010-05-26 Thread Yarko Tymciurak

On May 26, 4:15 am, Neveen Adel  wrote:
> Hello,
>
>  i have a problem in the creation of new database
>
> I wrote my design into db.py :
>
> and then i run my application the tables was created only in
> "appadmin", but when i show tables into mysql it displayed an empty
> set.
>
> then any update in the tables it cause
> "
> ProgrammingError: (1146, "Table 'MLD.user' doesn't exist")
> "

Did you make a db connection to your mysql database in your models?
(see example connection strings at 
http://www.web2py.com/book/default/section/6/2)
If you used the default database connection, then with appadmin you
would have created
an sqlite database for you.

>
> so any one have any idea what is the problem?
>
> The second issue :
>
> i have a table and i want to make a relation to itself?
>
> as :
>
> db.define_table("location_unit)",
... looks like a typo; this should be:
  db.define_table("location_unit",
>       SQLField("name", "string", notnull=True),
>       SQLField("parentLocation", db.location_unit),

...use Field in favor of SQLField  (but either works);  this should
be:

   Field("parentLocation", "reference location_unit"),

see http://www.web2py.com/book/default/section/6/13 for more
information.

Regards,
- Yarko
>       )
> it cause "
>     return dict.__getitem__(self,key)
>      KeyError: 'location_unit'
> "
>
> Please could any one help me ??
>
> Thanks


[web2py] scripts/setup-web2py-ubuntu.sh and web2py.ubuntu.sh incompatible?

2010-05-26 Thread Doug Warren
Hi,

I'm setting up a new dev environment for some users under Ubuntu 10 and I
notice that the two supplied scripts in the scripts dir for dealing with
Ubuntu seem to not be compatible...  setup-web2py uses a 'www-data'
directory with an install path in /home/www-data among other things.
web2py.ubuntu.sh assumes an install path of /usr/lib/web2py and an installed
user of web2py.  Any thoughts of combining these?


[web2py] web2py Conference Management System

2010-05-26 Thread KR
Hello,

There is a Vimeo screencast (http://www.vimeo.com/1838049) about a
web2py Conference Management System. Does anybody know wher I can
download the soource code of that ?


[web2py] MySQLdb connect() issues

2010-05-26 Thread Evan
Hey all,

I hit an issue in the MySQLAdapter class trying to establish a
database connection. It seems the "password" keyword argument in
connect() should be "passwd"? The python-mysql docs support this:
http://mysql-python.sourceforge.net/MySQLdb.html#mysqldb

If this is an issue of different versions of MySQLdb using different
keyword arguments and a newer version does indeed use "password" then
please ignore (I'm running python2.5). Otherwise, should this be
changed?

Thanks,

Evan


[web2py] Changes in Development environment

2010-05-26 Thread greenpoise
I have web2py production and my development environment. How would I
go for leaving the data intact in my production?  Is there a way? What
I did is I packedAll the project and took it to my production but I
will keep working on it on my development environment. Is this how it
should be done?


Thanks


[web2py] Re: Anybody going to PyCon?

2010-05-26 Thread JC11
I sang the praises of web2py at Euro-Python last spring.  My talk was
not about web2py or web frameworks but about a (very corporate)
application written with web2py.

Perhaps more talk of what has been built with web2py rather than
framework comparisons and moaning is the way to go ?

John C.


[web2py] Re: Multiselect Plugin not saving values in database.

2010-05-26 Thread ggivler
Tried the reference thing but that doesn't work. I am still not sure
why your code does not put the values in the database, just the
separators so I get field with "|||" in them. But I can handle that in
the routine below and update record. That will let me read it back
out, I know this is a hack but it will get me one step closer to my
goal which is a finished product.

The problem I believe comes from the jquery multiselect code, it
renames the dropdown to add a "[]" at the end, and this causes Python
a world of problems. Mr. Freeze had a solution so I used his, if you
call the request.vars dictionary with dictionary syntax having an name
with "[]" tacked on the end is not a problem.

As I said, I sort of had to hack a solution, I borrowed some stuff
from mr. freeze's multiselect solution in web2pyslices

if request.vars['testcase_test_testtypeids[]'] is not None:
if len(request.vars['testcase_test_testtypeids[]']) > 0:
for testtypeid in
request.vars['testcase_test_testtypeids[]']:
 
db.testcase_testtypes.insert(testcaseid=insertid,testtypeid=testtypeid,recordvalid='T')
print db._lastsql

See the problem I have is the the testtype table is basically just a
source table to tell the page what values to display. Then I have a
many to many relationship between testcases and testtypes.



On May 25, 9:02 pm, mdipierro  wrote:
> Not sure but this is a problem I see
>
> db.testcase_test.testtypeids.requires = IS_IN_DB(testtypes,
> 'testtype.id', 'testtype.name',multiple=True)
>
> implies db.testcase_test.testtypeids stored the texttype.id therefore
> it should be of type reference to db.testtype and not type 'string'
>
> On May 25, 4:47 pm, ggivler  wrote:
>
>
>
> > I am using the multiselect plugin read and save data from a
> > crud.create or crude.update form and it just is not working, it seems
> > to see that there are values there as the field is filled with a "|"
> > for each option selected. I am not sure what is happening and what I
> > am doing wrong. Any help would be appreciated.
> > If I manually fill data into the database and load it using
> > crud.update(db.testcase_test, testcase_id) it selects the correct
> > options. I am sure I am missing something stupid and anyone who wants
> > to point it out would be greatly appreciated.
>
> > Here is the database table
>
> > db.define_table('testtype',
> > Field('name', 'string', length=45),
> > Field('description', 'text'),
> > Field('recordvalid', 'boolean'),
> > migrate=False)
>
> > db.define_table('testcase_test',
> > Field('structure', 'string', length=1024,writable=False),
> > Field('name', 'string', length=255),
> > Field('description', 'text', length=255),
> > Field('testmodeid', db.testmode,
> > requires=IS_IN_DB(db,'testmode.id','testmode.name')),
> > Field('testtoolid', db.testtool,
> > requires=IS_IN_DB(db,'testtool.id','testtool.name')),
> > Field('inputconfigblobid', db.inputblob,
> > requires=IS_IN_DB(db,'inputblob.id', 'inputblib.localfilename')),
> > Field('requirementsid', db.requirements,
> > requires=IS_IN_DB(db,'requirements.id','requirements.name')),
> > Field('productid',writable=True),
> > Field('environmentid',writable=True),
> > Field('commandline', 'string', length=255),
> > Field('resulttypeid', db.resultstype,
> > requires=IS_IN_DB(db,'resultstype.id', 'resultstype.resulttype')),
> > Field('resultunitsid', db.resultunits,
> > requires=IS_IN_DB(db,'resultunits.id', 'resultunits.unit')),
> > Field('lowlimit', 'string', length=255),
> > Field('highlimit', 'string', length=255),
> > Field('estexectime', 'time'),
> > Field('lastexectime', 'time', writable=False),
> > Field('priority','integer',default=-1),
> > Field('default_priority', 'integer', default=-1),
> > Field('seqnum', 'integer',default=-1),
> > Field('testtypeids', 'string'),
> > migrate=True)
> > db.testcase_test.structure.label = 'Test Stuite Structure'
> > db.testcase_test.testmodeid.label = 'Test Mode'
> > db.testcase_test.testtoolid.label = 'Test Tool'
> > db.testcase_test.inputconfigblobid.label = 'Test Case Input Config
> > File'
> > db.testcase_test.requirementsid.label = 'Test Case Requirements'
> > db.testcase_test.productid.label = 'Product'
> > db.testcase_test.commandline.label = 'Test Case Commandline'
> > db.testcase_test.resulttypeid.label = 'Result Type'
> > db.testcase_test.resultunitsid.label = 'Result Units'
> > db.testcase_test.lowlimit.label = 'Low Limit'
> > db.testcase_test.highlimit.label = 'High Limit'
> > db.testcase_test.estexectime.label = 'Estimated Execution Time'
> > db.testcase_test.lastexectime.label = 'Last Execution Time'
> > db.testcase_test.seqnum.label = 'Sequence Number'
> > db.testcase_test.testtypeids.label = 'Test Types'
> > products = db(db.testsuite.parentid==-1)
> > db.testcase_test.productid.requires = IS_IN_DB(products,
> > 'testsuite.id', 'testsuite.name')
> > environments = db(db.testenvironment.recordvalid=='T')
> > db.testcase_test.environmentid.requires = IS_IN_D

Re: [web2py] Re: Anybody going to PyCon?

2010-05-26 Thread Zoom.Quiet
i'll goto PyCon Asia Pacific :
http://pycon.sit.rp.sg/conference-1
make the speech of:
35.   PythoniCamp -  Try to Train Practical Pythoners Fast



On Sun, Jan 17, 2010 at 16:47, mdipierro  wrote:
> Of course. I have not given up on them. ;-)
>
> On Jan 17, 1:12 am, mikech  wrote:
>> Well, maybe next year.  Massimo, do try again.
>>
>> On Jan 16, 4:30 pm, John Heenan  wrote:
>>
>> > On Jan 16, 5:33 pm, mdipierro  wrote:
>>
>> > > Back to PyCon. Rejecting all web2py talks for 3 years in a row is not
>> > > a fluke. We do have more users that some of the projects that will be
>> > > talked about at PyCon 2010.
>> > > Just check 
>> > > this:http://www.google.com/trends?q=repoze%2C+web2py&ctab=0&geo=all&date=a...
>> > > Yet there will be a 4hrs tutorial on repoze. Notice that I am not
>> > > complaining about Repoze, that is actually one of the subjects I am
>> > > interested in, but people are entitled to ask, without blaming anyone:
>> > > why not web2py?
>>
>> > I risk being labelled as an irrelevant 'social scientist' type by this
>> > posting, but what have I got to lose by taking this risk? It might
>> > provide some insight.
>>
>> > With regard to web2py being voted out in the cold at PyCon and Django
>> > being warmly welcomed, there may be a lot more subtlety than many
>> > realise. I personally prefer web2py over Django for a few simple
>> > 'common sense' reasons, namely the web2py beats Django hands down for
>> > elegance, coherency and for want of some better words, far less
>> > irritation.
>>
>> > PyCon really has very little practical use. Whatever PyCon achieves
>> > can be accomplished much more efficiently with other means. PyCon is
>> > essentially a religious celebration for those whose life is consumed
>> > by Python, with Guido van Rossum at the top of the hierarchy as Pope
>> > (or dictator).  PyCon tells everyone that Python is a important,
>> > provides an opportunity for devotional hero worship, a reinforcement
>> > of community and reinforcement of place within a hierarchy (known as
>> > networking).
>>
>> > Essentially Massimo is being told he is not wanted as part of the
>> > community by a democratic voting process. This has nothing to do with
>> > the merits of web2py. We can look elsewhere for an explanation.
>>
>> > So why would the this community not want to welcome Massimo and why
>> > would they risk compromising themselves by rejecting web2py or only
>> > allowing web2py a very marginal participation?
>>
>> > To me the biggest turn off about web2py has nothing to do with the
>> > merits of web2py. It has to do with the coupling of web2py to an
>> > academic environment. I suspect if web2py could shake off this
>> > association, web2py might find itself less alienated. This is ironic
>> > because web2py espouses the opposite of what many come to associate
>> > with academic tainting, namely impractical academically politicised
>> > snobberies, hierarchies and verbiage. Linux has a classic example of a
>> > clash with academia that the Linux hierarchy forever continue to milk.
>>
>> > Python nearly evaporated like many other wannabes. Guido was
>> > apparently going nowhere. It was the corporate world, not the academic
>> > world that has made Python such a success and the best example of this
>> > is Google. In fact Google in effect subsidises the ongoing development
>> > of Python through employing Guido and allowing him to spend much of
>> > his employee time working on developing Python as a language.
>>
>> > Initially I was incredibly suspicious of web2py because of the
>> > academic taint. I even went to the extent of examining Massimo's
>> > academic profile. Sure enough there is evidence of academic snobbery.
>> > Massimo lists web2py as a hobby academic pursuit and a teaching tool.
>> > He lists his academic pursuit as sub atomic physics. Web2py comes
>> > across as an embarrassment to Massimo in an academic context.
>>
>> > Python is replacing C as the 'de facto' teaching language in IT
>> > courses. Python has an incredibly strong presence in academic number
>> > crunching and modelling (NumPy and SciPy for example). But Python does
>> > not belong to academia and clearly the Python community does not
>> > welcome academia. This is understandable. Why would a strong thriving
>> > community wish to risk.academia muscling in its achievements and risk
>> > having credit and control wrested away?  Contrary to the images
>> > portrayed by academic Computer Science departments as powerhouses of
>> > innovation, the phenomenal achievements in IT have had next to nothing
>> > to do with academia. Academia has always played catch-up in IT, never
>> > a leading role. It can be argued that web2py is starting to take a
>> > leading role as a web framework. But web frameworks would hardly be
>> > considered to be an academic sub discipline.  After all web2py is
>> > merely regarded as a teaching tool in an academic context.
>>
>> > By the way I will not be attending PyCon 20

[web2py] Nice web plugin, like jQZoom

2010-05-26 Thread KMax
http://www.professorcloud.com/mainsite/cloud-zoom.htm

Looks great.


[web2py] Re: web2py hosting - least intervention required

2010-05-26 Thread greenpoise
Thanks for the replies. Just saw the limitations of GAE in the book.

Dan

On May 26, 1:35 am, Richard  wrote:
> I currently use Webfaction, Slicehost, and Google App Engine.
>
> Webfaction is cheap and relatively easy, but slow lately. Good support
> in forums from admins.
> Slicehost is FAST, but you have to do everything yourself. Haven't
> used their support yet.
> GAE is the easiest to deploy with because no configuration required.
> But the platform has limitations so isn't always practical. Good
> support in forums from other users.
>
> I recommend GAE unless you have special requirements, like a c based
> library.
>
> Richard
>
> On May 25, 10:10 am, greenpoise  wrote:
>
> > I am looking for web2py hosting. I have seen most posts of webfaction.
> > I just want to make sure that what I pick requires the least of my
> > intervention to get it going. Leads?
>
> > THanks in Advance


[web2py] Re: web2py hosting - least intervention required

2010-05-26 Thread greenpoise
Thanks for all the replies. Is there a list of GAE limitations?


Thanks


On May 26, 1:35 am, Richard  wrote:
> I currently use Webfaction, Slicehost, and Google App Engine.
>
> Webfaction is cheap and relatively easy, but slow lately. Good support
> in forums from admins.
> Slicehost is FAST, but you have to do everything yourself. Haven't
> used their support yet.
> GAE is the easiest to deploy with because no configuration required.
> But the platform has limitations so isn't always practical. Good
> support in forums from other users.
>
> I recommend GAE unless you have special requirements, like a c based
> library.
>
> Richard
>
> On May 25, 10:10 am, greenpoise  wrote:
>
> > I am looking for web2py hosting. I have seen most posts of webfaction.
> > I just want to make sure that what I pick requires the least of my
> > intervention to get it going. Leads?
>
> > THanks in Advance


[web2py] Newbie question on self-submitting form

2010-05-26 Thread NoNoNo
Hi,

I'm quite new to web2py and currently building a simple application: a
message board, listing latest 20 messages by index(). For earlier
messages, there is a  self-submitting form to enter page number (20
message each page) to go to, and after submitting the form, redirects
to that page. Here is the question on the self-submitting form:
nothing changed (always showing the 1st page) whatever number is input
into the form. Controller as follows:

def index():
page_no=1
entries=db(db.whoelse.id > 0).count()
messages=db((db.whoelse.id>(entries-20)) &
(db.whoelse.id<=entries)).select(db.whoelse.ALL,
orderby=~db.whoelse.created_on)

if request.vars.page_no:
if request.vars.page_no>(entries/20+1):
redirect(URL(r=request, f='index'))
else:
redirect(URL(r=request, f='gotopage')
form=crud.create(db.whoelse,
next=URL(r=request,args=1),message='Your message is posted')
return dict(messages=messages, entries=entries,
form=form,page=page_no)

def gotopage():
entries=db(db.whoelse.id > 0).count()
messages=db((db.whoelse.id>(entries-request.vars.page_no*20)) &
(db.whoelse.id<=((entries-
(request.vars.page_no-1)*20.select(db.whoelse.ALL,
orderby=~db.whoelse.created_on)

form=crud.create(db.whoelse,
next=URL(r=request,args=1),message='Your message is posted')
return dict(messages=messages, entries=entries, form=form,
page=request.vars.page_no)
--
and corresponding view part:
 {{=page}}/{{=entries/20+1}} PagesGo to
page:  
--

Any reply will be appreciated.

Spring


[web2py] Re: web2py Database issues

2010-05-26 Thread Candid
On your second question, you should use alternate notation:

 db.define_table("location_unit)",
       SQLField("name", "string", notnull=True),
       SQLField("parentLocation", "reference location_unit"),
       )

See http://web2py.com/book/default/section/6/13 for details.

As for your first question, please show us you model code.

On May 26, 5:15 am, Neveen Adel  wrote:
> Hello,
>
>  i have a problem in the creation of new database
>
> I wrote my design into db.py :
>
> and then i run my application the tables was created only in
> "appadmin", but when i show tables into mysql it displayed an empty
> set.
>
> then any update in the tables it cause
> "
> ProgrammingError: (1146, "Table 'MLD.user' doesn't exist")
> "
>
> so any one have any idea what is the problem?
>
> The second issue :
>
> i have a table and i want to make a relation to itself?
>
> as :
>
> db.define_table("location_unit)",
>       SQLField("name", "string", notnull=True),
>       SQLField("parentLocation", db.location_unit),
>       )
> it cause "
>     return dict.__getitem__(self,key)
>      KeyError: 'location_unit'
> "
>
> Please could any one help me ??
>
> Thanks


[web2py] Re: apache proxy error

2010-05-26 Thread Graham Dumpleton


On May 26, 3:26 pm, Richard  wrote:
> Occasionally after heavily using my web2py app I get:
>
> """
> Proxy Error
>
> The proxy server received an invalid response from an upstream server.
> The proxy server could not handle the request GET /.
>
> Reason: Error reading from remote server
> """

What is generating that? If you are using Apache/mod_wsgi the proxy
module isn't involved.

Is that error from a front end proxy server.

> The apache server is still running but the app won't work until I
> reset apache.
> These are the common errors from the Apache log:
>
>  server reached MaxClients setting, consider raising the MaxClients
> setting

Which means Apache and/or mod_wsgi daemon mode isn't configured with
enough processes/threads to handle the concurrent load you are
getting.

>  mod_wsgi (pid=20021): Exception occurred processing WSGI script '/
> apachewsgi/web2py/wsgihandler.py'.
>
>  IOError: client connection closed

Means that client connection got dropped. This can occur when
impatient user pressed reload on page before it returns response, or
leaves page via link before returns response.

> Any ideas?
> Not sure if the problem is with web2py or Apache configuration.

Not really enough information as don't know what MPM you are using,
how you configured the MPM, how you are using mod_wsgi, how you
configured it etc etc.

If a restart is required, could be that your Python code isn't
multithread safe and you are experiencing thread deadlocks thereby
using up threads and locking out new requests.

Graham


Re: [web2py] Planet web2py

2010-05-26 Thread Álvaro Justen
On Wed, May 26, 2010 at 01:58, Mariano Reingart  wrote:
> I'm working with rss2 and feedparser, reached a simple and minimal
> web2py based planet.
>
> See working examples at:
>
> http://www.web2py.com.ar/planet/
> http://planeta.arpug.com.ar/
>
> Uploaded web2py slice at:
>
> http://web2pyslices.com/main/slices/take_slice/82
>
> (anyone knows how to attach a file (app.w2p) to the slice? or, is
> there any repository for web2py related application/plugins/slices?)

Hi Mariano,
thanks for that! I was thinking on creating a planet in web2py to use
here in Brazil.

> It would be nice to have a real web2py planet (even better with
> multiple languages support).
> I remember some discussions about that here, but I don't know the current 
> state.
> I can help with the code, hosting, etc.

What do you think on creating a public repository on BitBucket.org or
GitHub.org? So we can collaborate with you sending patches, tracking
issues etc.

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


[web2py] web2py Database issues

2010-05-26 Thread Neveen Adel
Hello,

 i have a problem in the creation of new database

I wrote my design into db.py :

and then i run my application the tables was created only in
"appadmin", but when i show tables into mysql it displayed an empty
set.

then any update in the tables it cause
"
ProgrammingError: (1146, "Table 'MLD.user' doesn't exist")
"

so any one have any idea what is the problem?

The second issue :

i have a table and i want to make a relation to itself?

as :

db.define_table("location_unit)",
  SQLField("name", "string", notnull=True),
  SQLField("parentLocation", db.location_unit),
  )
it cause "
return dict.__getitem__(self,key)
 KeyError: 'location_unit'
"

Please could any one help me ??

Thanks