Re: [web2py] Re: Install in hostgator

2011-05-16 Thread Syed Mushtaq
Hi ,
I followed http://web2pyslices.com/main/slices/take_slice/76 to run web2py
on hostmonstor , I believe it should be a similar setup for hostgator .

You can check my sample site at http://web2py.igurukul.net/newsfeed

Thanks
-Syed

On Sun, May 15, 2011 at 12:59 AM, pepe_eloy  wrote:

> Hello!
>
> do you think hostgator is a bad hosting provider? I've development
> joomla applications and they works well and the support system is very
> good.
>
> pity that site hostgator.web2py.es doesn't works to learn how deploy
> my application
>
> Anybody has another answer?
>
> Thanks


Re: [web2py] Re: Two questions: one about markmin and one about SQLFORM

2011-05-16 Thread Tom Atkins
Two spaces at the end of a line makes a new line in Markdown... would it be
possible to have the same behavior in Markmin?

On 17 May 2011 04:09, Bruno Rocha  wrote:

> On Mon, May 16, 2011 at 11:34 PM, JayShaffstall wrote:
>
>> Just enough of rain
>> To bring the smell of silk
>> From umbrellas
>>
>
>
> You can do that in this way:
>
> --- Create a custom markmin dictionary ---
>
> customtags = dict(
>  br=lambda n:''*int(n),
>
>  template=lambda code:gluon.template.render(code,context=globals()),
>  )
>
>
> --- Yout markup ---
> markup = """
> Just enough of rain ``1``:br
> To bring the smell of silk ``1``:br
> From Umbrellas ``1``:br
> """
>
> --- alternative markup ---
> markup = """
> Just enough of rain :template
> To bring the smell of silk :template
> From Umbrellas :template
> """
>
> --- rendering ---
>
> {{=MARKMIN(markup, customtags)}}
>
>
>
>
>


[web2py] Re: Cubrid?

2011-05-16 Thread CUBRID RDBMS
All right, I will start replying one by one.

1) Organizations tips: at cubrid.org there are two search engines, one
of which is a subset of the other.

a) cubrid.org search - 
http://www.cubrid.org/?vid=&mid=home&act=IS&is_keyword=AUTO_INCREMENT
It has quite advanced search engine powered by nLucene. You can search
anything there, including all manuals, tutorials, and cubrid.org
pages.

b) Search in CUBRID Manual -
http://www.cubrid.org/?vid=&mid=manual40&category=&search_target=title_content&search_keyword=AUTO_INCREMENT&act=dispXedocsSearchResults&x=0&y=0
All manuals at cubrid.org can be searched separately and filtered by
versions. This is the same search engine, just results are filtered to
CUBRID Manual for specific version, thus a subset of cubrid.org
search.

2) As you might already know last week we have released a new version
of CUBRID 8.4.0 which has about 90% SQL syntax compatibility with
MySQL. So almost everything, including statements, data types and
implicit type conversions are the same in CUBRID. Anyway, here are the
exact answer for your questions.

AUTO_INCREMENT - http://www.cubrid.org/manual/840/en/AUTO_INCREMENT%20Clause
Just like you do in MySQL, for example:
- CREATE TABLE t (i int AUTO_INCREMENT);
- CREATE TABLE ss (id INT AUTO_INCREMENT NOT NULL PRIMARY KEY, text
VARCHAR(32));

3) LAST_INSERT_ID() - 
http://www.cubrid.org/manual/840/en/LAST_INSERT_ID%20Function
Just like in MySQL:
INSERT into ss VALUES(’cubrid’);
SELECT LAST_INSERT_ID(); // should return the last value of an ID if
it has an auto_increment constraint.

All the common operators and functions in CUBRID must be the
identical. If not, just lookup the manual. If that doesn't help, I am
always here.

4) Like I said in CUBRID 8.4.0 SQL syntax is almost identical to that
of MySQL. In this release we focused on two important aspects. One is
index enhancement (the reason of x2 faster performance), the other is
MySQL Compatibility phase II.

5) What do you mean by "If I write the adapter"? If you mean CUBRID
Python API, then we already have it. But I suppose you mean a new
CUBRID DB Layer for Web2py. In that case, of course. I can probably
dedicate a separate developer who can assist you in getting acquainted
with CUBRID and DBL development. Just let me know what you want.

Esen.

On May 17, 12:11 pm, Massimo Di Pierro 
wrote:
> Hello Esen,
>
> it should be very easy for us to suport cubrid and I like the support
> for sequence types. But we need some information that is not in the
> online manual (at least I could not find it).
>
> How do I define a table with an autoincrement integer field?
> How do I get the 'id' of the last inserted record?
> Is the SQL syntax closer to MySQL, PostgreSQL, MSSQL or other?
>
> If I write the adapter, would you help me run the tests?
>
> Massimo
>
> On May 16, 8:37 pm, CUBRID RDBMS  wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I work at the CUBRID DBMS Project. I will be glad to respond to your
> > questions, if you any particular.
>
> > In general, CUBRID is an open source relational database management
> > system available on Linux and Windows platforms. CUBRID Manager, its
> > most powerful database administration tool, is also available for Mac
> > OS X. There are all kinds of programming APIs, including for Python.
> > In fact, this or coming week we will update our Python API as a result
> > of a new CUBRID 8.4.0 release, which will be more stable and will
> > introduce new features available in the new database release.
>
> > Users can install CUBRID Python API directly from PYPI (http://
> > pypi.python.org/pypi/CUBRID-Python) which also distributes its source
> > code.
> > Other information about the driver, including the API manual, can be
> > found on its official page athttp://www.cubrid.org/python_programming.
>
> > For the support, users can post their issues on the CUBRID Python
> > forum athttp://forum.cubrid.org/viewforum.php?f=28.
>
> > If you have any question or suggestions, or would like to contribute
> > in API development/documentaion, or have any other thought, feel free
> > to contact me. I will be glad to hear from you.
>
> > Best Regards,
> > Esen Sagynov.
> > CUBRID Project 
> > Manager.http://www.cubrid.org/http://twitter.com/cubridhttp://facebook.com/cu...
>
> > On May 17, 6:48 am, mikech  wrote:
>
> > > Has anyone come across this DB?  Seems like it might be big in Korea.  The
> > > screen shots of the manager app looks interesting.
>
> > >http://www.cubrid.org/home


[web2py] Re: HELP: how do I subclass the Auth class and add additional fields to the login form?

2011-05-16 Thread pbreit
You could make them readable=False, writable=False
http://web2py.com/book/default/chapter/06#Record-Representation

Or customize the form. I have customized all of the forms in my app ( 
http://pricetack.com ):
http://web2py.com/book/default/chapter/07#Custom-forms


[web2py] Re: HELP: how do I subclass the Auth class and add additional fields to the login form?

2011-05-16 Thread Pystar
I need to add some fields to my auth form and remove some, but in
customizing auth, there is a caveat that no fields can be removed only
added to, but I do not need most of the default fields. How do I go
about this?
>
>
>
>
>
>
>
> On Monday, May 16, 2011 5:41:29 PM UTC-4, Pystar wrote:
> > Hi guys,
>
> > I would like to know how to subclass the Auth class and add additional
> > fields to the login form.
> > thanks


[web2py] Re: auth.get_or_create_user() does not validate data

2011-05-16 Thread howesc
fair enough.  thanks for the clarification.  i'll validate before i call the 
method.

cfh


Re: [web2py] Re: Cubrid?

2011-05-16 Thread Bruno Rocha
Esen,

I would like to know whats the grand key features of Cubrid over Mysql or
Postgres, I am interested in this project but I have a simple question "why
should I use Cubrid instead of Mysql or Postgres ?"



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


[web2py] Re: auth.get_or_create_user() does not validate data

2011-05-16 Thread Massimo Di Pierro
It is a feature. validators apply to forms, not database access.

On May 16, 9:42 pm, howesc  wrote:
> is it a bug or a feature that when i call get_or_create_user that the
> field's validators are not called when creating a new user?  I have a place
> where i would like them to be, but i'm not sure if that should be my
> responsibility before i call get_or_create_user(), or if i should expect
> get_or_create_user() to do that.
>
> thanks for the feedback,
>
> christian


[web2py] Re: Cubrid?

2011-05-16 Thread Massimo Di Pierro
Hello Esen,

it should be very easy for us to suport cubrid and I like the support
for sequence types. But we need some information that is not in the
online manual (at least I could not find it).

How do I define a table with an autoincrement integer field?
How do I get the 'id' of the last inserted record?
Is the SQL syntax closer to MySQL, PostgreSQL, MSSQL or other?

If I write the adapter, would you help me run the tests?

Massimo

On May 16, 8:37 pm, CUBRID RDBMS  wrote:
> Hi,
>
> I work at the CUBRID DBMS Project. I will be glad to respond to your
> questions, if you any particular.
>
> In general, CUBRID is an open source relational database management
> system available on Linux and Windows platforms. CUBRID Manager, its
> most powerful database administration tool, is also available for Mac
> OS X. There are all kinds of programming APIs, including for Python.
> In fact, this or coming week we will update our Python API as a result
> of a new CUBRID 8.4.0 release, which will be more stable and will
> introduce new features available in the new database release.
>
> Users can install CUBRID Python API directly from PYPI (http://
> pypi.python.org/pypi/CUBRID-Python) which also distributes its source
> code.
> Other information about the driver, including the API manual, can be
> found on its official page athttp://www.cubrid.org/python_programming.
>
> For the support, users can post their issues on the CUBRID Python
> forum athttp://forum.cubrid.org/viewforum.php?f=28.
>
> If you have any question or suggestions, or would like to contribute
> in API development/documentaion, or have any other thought, feel free
> to contact me. I will be glad to hear from you.
>
> Best Regards,
> Esen Sagynov.
> CUBRID Project 
> Manager.http://www.cubrid.org/http://twitter.com/cubridhttp://facebook.com/cubrid
>
> On May 17, 6:48 am, mikech  wrote:
>
>
>
>
>
>
>
> > Has anyone come across this DB?  Seems like it might be big in Korea.  The
> > screen shots of the manager app looks interesting.
>
> >http://www.cubrid.org/home


Re: [web2py] Re: Two questions: one about markmin and one about SQLFORM

2011-05-16 Thread Bruno Rocha
On Mon, May 16, 2011 at 11:34 PM, JayShaffstall wrote:

> Just enough of rain
> To bring the smell of silk
> From umbrellas
>


You can do that in this way:

--- Create a custom markmin dictionary ---

customtags = dict(
 br=lambda n:''*int(n),

 template=lambda code:gluon.template.render(code,context=globals()),
 )


--- Yout markup ---
markup = """
Just enough of rain ``1``:br
To bring the smell of silk ``1``:br
>From Umbrellas ``1``:br
"""

--- alternative markup ---
markup = """
Just enough of rain :template
To bring the smell of silk :template
>From Umbrellas :template
"""

--- rendering ---

{{=MARKMIN(markup, customtags)}}


[web2py] Re: Cubrid?

2011-05-16 Thread CUBRID RDBMS
Hi,

I work at the CUBRID DBMS Project. I will be glad to respond to your
questions, if you any particular.

In general, CUBRID is an open source relational database management
system available on Linux and Windows platforms. CUBRID Manager, its
most powerful database administration tool, is also available for Mac
OS X. There are all kinds of programming APIs, including for Python.
In fact, this or coming week we will update our Python API as a result
of a new CUBRID 8.4.0 release, which will be more stable and will
introduce new features available in the new database release.

Users can install CUBRID Python API directly from PYPI (http://
pypi.python.org/pypi/CUBRID-Python) which also distributes its source
code.
Other information about the driver, including the API manual, can be
found on its official page at http://www.cubrid.org/python_programming.

For the support, users can post their issues on the CUBRID Python
forum at http://forum.cubrid.org/viewforum.php?f=28.

If you have any question or suggestions, or would like to contribute
in API development/documentaion, or have any other thought, feel free
to contact me. I will be glad to hear from you.

Best Regards,
Esen Sagynov.
CUBRID Project Manager.
http://www.cubrid.org/
http://twitter.com/cubrid
http://facebook.com/cubrid

On May 17, 6:48 am, mikech  wrote:
> Has anyone come across this DB?  Seems like it might be big in Korea.  The
> screen shots of the manager app looks interesting.
>
> http://www.cubrid.org/home


[web2py] auth.get_or_create_user() does not validate data

2011-05-16 Thread howesc
is it a bug or a feature that when i call get_or_create_user that the 
field's validators are not called when creating a new user?  I have a place 
where i would like them to be, but i'm not sure if that should be my 
responsibility before i call get_or_create_user(), or if i should expect 
get_or_create_user() to do that.

thanks for the feedback,

christian


[web2py] Re: Two questions: one about markmin and one about SQLFORM

2011-05-16 Thread Anthony
On Monday, May 16, 2011 10:34:11 PM UTC-4, JayShaffstall wrote: 
>
> On May 16, 4:30 pm, Massimo Di Pierro  
> wrote: 
> > form=SQLFORM(...) 
> > form.element('textarea')['_rows'] = random.randint(10,20) 
>
> Thanks!  I'll give that a try tomorrow.

 
Yes, check out 
http://web2py.com/book/default/chapter/05#Server-side-DOM-and-Parsing -- a 
SQLFORM is a web2py HTML helper object, so all that stuff applies to forms. 
See also http://web2pyslices.com/main/slices/take_slice/43.
 
Anthony


[web2py] Re: Two questions: one about markmin and one about SQLFORM

2011-05-16 Thread JayShaffstall
On May 16, 4:30 pm, Massimo Di Pierro 
wrote:
> form=SQLFORM(...)
> form.element('textarea')['_rows'] = random.randint(10,20)

Thanks!  I'll give that a try tomorrow.

> In markmin there are no line breaks. Just paragraphs. You have to set
> the distance between paragraphs in CSS.

That only works if you want all single spacing, right?  I have the
situation where I want normal double spacing between paragraphs, but
inside a paragraph I want some line breaks.  Picture an English haiku
inside a paragraph.  I'd expect the HTML for it to look like this:

Just enough of rain
To bring the smell of silk
>From umbrellas

Can I accomplish that in markmin?


[web2py] Re: Possible bug: Login redirect on an extension copies the extension

2011-05-16 Thread Anthony
I think you should be able to do this:
 
auth.settings.login_url=URL('user.html', args='login')
 
 
By default, Auth.url() just passes through the extension of the original 
request. That can be useful for login-protected components because it will 
call 'user.load' instead of 'user.html' if the component was loaded with a 
.load extension.
 
Anthony
 

On Monday, May 16, 2011 8:22:53 PM UTC-4, Chris wrote:

> Hey, quick question: One of my controllers has a request that uses the 
> @auth.requires_login handler. 
>
> Problem is, when I go there and use an extension (examples: /init/ 
> default/dothis.json, /init/default/dothis.txt), I get redirected to 
> the extension version of the login page by default (/init/default/ 
> user.json/login) 
>
> It looks like the login_url is set in tools.py:831: 
>
> self.settings.login_url = self.url('user', args='login') 
>
> Is there any simple way to override this so that I get /init/default/ 
> user/login instead of /init/default/user.json/login?



Re: [web2py] Recaptcha goes missing after a day

2011-05-16 Thread Bruno Rocha
What version of web2py are you using?

Massimo solved an issue with recaptcha, so if you have old version you need
to update or change the recaptcha API url in your your code.

For me it is working now:
http://www.web2pyslices.com/main/default/user/register
--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]



On Mon, May 16, 2011 at 10:34 PM, Arbie Samong  wrote:

> Anybody experienced enabling recaptcha via:
> recaptcha = Recaptcha(request, recaptcha_public_key,
> recaptcha_private_key)
> auth.settings.register_captcha = recaptcha
>
> And after creating the keys it works for a day. Next day the recaptcha
> frame is gone.
>
> What I do is to check on the generated html and there's a link to the
> recaptcha site in https, something line:
> https://api-secure.recaptcha.net/challenge?k=some_very_long_string
> and after going there in the browser the recaptcha frame in my app
> would work again. It will, of course, stop working the next day.
>
> So I'm wondering if this is web2py issue or that with recpatcha? It
> happens both on my local machine and on GAE.
>
> Thanks,
> Arbie
>


[web2py] Recaptcha goes missing after a day

2011-05-16 Thread Arbie Samong
Anybody experienced enabling recaptcha via:
recaptcha = Recaptcha(request, recaptcha_public_key,
recaptcha_private_key)
auth.settings.register_captcha = recaptcha

And after creating the keys it works for a day. Next day the recaptcha
frame is gone.

What I do is to check on the generated html and there's a link to the
recaptcha site in https, something line:
https://api-secure.recaptcha.net/challenge?k=some_very_long_string
and after going there in the browser the recaptcha frame in my app
would work again. It will, of course, stop working the next day.

So I'm wondering if this is web2py issue or that with recpatcha? It
happens both on my local machine and on GAE.

Thanks,
Arbie


[web2py] Need advice on Cron in production

2011-05-16 Thread pbreit
I'm still struggling with how to deploy cron in production.

I currently have a crontab on my production server set up with:

0-59/1 * * * * cd /var/web2py && python web2py.py -C -D 1 >> 
/tmp/cron.output 2>&1

And a couple tasks in my web2py crontab:
*/1 * * * * root *cron/email_watchlist
0 2 * * * root *cron/google_feed

It seems like the */1 tasks get run but not the 0 2 one.

I'm about to give up and just wget URLs:
*/1 * * * * wget http://localhost/cron/email_watchlist >/dev/null 2>&1
00 2 * * * wget http://localhost/cron/google_feed >/dev/null 2>&1

Is this how external cron is supposed to work? What are other people doing 
that works? Any suggestions?


[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-16 Thread Simon Ashley
Vineet,

We're doing the same in a different client server environment.
Lots of business logic, 700+ tables, 10,000+ tasks to translate.
We intend writing a high level tool as a web2py code generator, that
will serve as a gateway between the 2.
However we're probably at a lower level on the learning curve.

On May 17, 6:09 am, Vineet  wrote:
> Villas,
> Let me give a little background.
> I have this entire massive application successfully running at client-
> sites in Microsoft Visual FoxPro.
> I have decided to shift from licensed platform to open-source
> platform.
> Chose Python for programming language & web2py for framework.
>
> My present task is not to define the app from scratch.
> Because the database-logic, business logic, UI is already there.
> I am trying to port the existing app to Python web framework.
>
> I am encouraged by your saying that ---
> "Web2py has all the ingredients you need to split a big horrible job
> in
> smaller easier ones.  It is extremely flexible for specifying queries
> depending on your 'decision-tree'. "
>
> Pl. help me solve my said issue in 'web2py'.
>
> --Vineet
> =


[web2py] Possible bug: Login redirect on an extension copies the extension

2011-05-16 Thread Chris
Hey, quick question: One of my controllers has a request that uses the
@auth.requires_login handler.

Problem is, when I go there and use an extension (examples: /init/
default/dothis.json, /init/default/dothis.txt), I get redirected to
the extension version of the login page by default (/init/default/
user.json/login)

It looks like the login_url is set in tools.py:831:

self.settings.login_url = self.url('user', args='login')

Is there any simple way to override this so that I get /init/default/
user/login instead of /init/default/user.json/login?


[web2py] Re: New importer in trunk

2011-05-16 Thread villas
Yes, I think that would be a good idea.  Maybe there is already a
similar way to do that?

On May 17, 12:38 am, pierreth  wrote:
> Would it be better as a command line argument for webp2y.py?
> Something like:
> python web2py.py --debug
> ?


[web2py] Re: Application design RDBMS vs GAE, future migrations

2011-05-16 Thread villas
If the database is complex (or may become more so in future) then why
not use Sql. It's just safer and more flexible.

GAE is great as a free way of dishing up views of single tables. With
a few extra feeds here and there.

Plus,  whenever I have had a complex system and compromised (by
denormalising) my data,  I have invariably regretted it later.  I mean
here, more important corporate data rather than for example blogs and
promotional websites.


On May 16, 11:55 am, Marek Mollin  wrote:
> Hello,
>
> As I have been more and more interested in GAE from app design
> perspective. I lurked into the codebase for web2py's gae driver and it
> seems to be mapping all the native futures I would like to have ( 'out
> of the box without custom queries' ). However I am wondering about the
> general experience.
>
> I know google has its up and downs with gae and I know the limitations
> it imposes. However I am worried that if I layout my database in non-
> rdbms fashion I have to design it with different paradigms in mind.
>
> Problem is what if I find google ineffective. My fears come from lack
> of static system, since a lot of the stuff I will be doing within my
> app will require file hosting. Have you done anything serious,
> designed it to work with gae and then changed your mind and switched
> to rdbms.
>
> I know I can change the driver, but its not that simple. Since I will
> have data that's heavily denormalized and very redundant. Have you got
> any studycase of migrating back and forth?
>
> Also how do you see the scalability of gae from large project
> perspective. I am not talking dummy-apps, but have you for instance
> developed an app that was designed to work with rdbms and switched to
> google and noticed its running much faster...
>
> I am starting a big project, have web2py as my choice (at least now)
> and after 
> readinghttp://www.carlosble.com/2010/11/goodbye-google-app-engine-gae/
> I am starting to rethink my choices.
> Also another thing is lack of merge-join which I find would made life
> easier(but I might be wrong? what's the story of implementing
> those...?)
>
> Regards,


[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-16 Thread Simon Ashley
Vineet,

Agreed, the temp file should be in the DAL.
I don't see at this stage why it would be break the logic.

On May 17, 5:47 am, Vineet  wrote:
> Simon,
> I thought on the idea of adding a MySQL temp table to manage insert/
> del/update on multiple tables.
> But there would be a large no. of such forms requiring this
> functionality.
> It is better to avoid fiddling with the schema (which is the database-
> tier) for the sake of business-logic tier.
>
> What if I add a temporary table in DAL itself (along with the other
> linked tables)?
> Would it break the web2py logic of generating, validating, and saving
> the form (if this table is used for generating the form)?
> I mean, if a form is generated from such a temp DAL table, whether it
> is possible to save data in multiple different tables.
>
> ---Vineet
> 
>
> On May 16, 4:33 pm, Simon Ashley  wrote:
>
>
>
>
>
>
>
> > Memory tables referred to have no ability to write to disk. Generally
> > we've used these for report accumulations. You could use a MySQL table
> > and delete the record at the end (if need be). Crude and there should
> > be a more pythonic method, but should work.
>
> > Define temp table fields as per the following:
>
> > 1. rec id
> > 2. table1.uid
> > 3. table1.variable
> > 4. table2.uid
> > 5. table2.variable
> > 6. table3.uid
> > 7. table3.variable
>
> > Populate the fields before the load. The uids will of course be hidden
> > on the form but used after the submit in separate database actions.
>
> > Zero uid's would trigger inserts, > 0 for deletions where variables
> > are blank or zero, edits where not. There is a level of programming
> > involved; Massimo implied that.
>
> > In your case, I would be reluctant to denormalise as further
> > complexity could be cumbersome.
> > (if not unworkable. Can think of examples in an application that we
> > are looking at converting that would make anyone's mind spin).
>
> > YMMV
>
> > On May 16, 1:15 am, Vineet  wrote:
>
> > > Simon,
> > > That is a good idea.
> > > In fact, almost the same approach is being followed in VFP cursor
> > > adaptor (the difference being that, data from MySQL tables is
> > > reproduced in same table structures, i.e cursors).
>
> > > Here, by virtual table, do you mean to say that we should reproduce
> > > the data into dictionaries by fetching a dict cursor from MySQLdb?
> > > (in DABO, they have an excellent concept of bizobj for this task).
>
> > > I am not asking for exact code, but can you suggest an approach to
> > > tackle the task?
>
> > > Dear Massimo & other friends,
> > > can you pl. suggest something to solve my problem?
>
> > > Thanks,
> > > Vineet.
>
> > > =
> > > On May 15, 5:07 pm, Simon Ashley  wrote:
>
> > > > Since no one has replied for a couple of days, I'll toss my 2 cents
> > > > in. Don't how much value this could be, as we just evaluating web2py
> > > > and python but in another environment we could have written data in
> > > > the normalised records to a temporary record in a denormalised,
> > > > virtualtable, update and saved this record, and then do selective
> > > > updates, insertions and deletions on each normalised record in the
> > > > original tables. Not that elegant but ...
>
> > > > On May 13, 9:17 pm, Vineet  wrote:
>
> > > > > pbreit,
> > > > > As you say, wherever possible or required, I have already denormalized
> > > > > thetable-structures.
> > > > > Apart from normalization / denormalization issue, in many other forms,
> > > > > I need to insert/update/delete records inmultipletables from one
> > > > > form.
> > > > > (as I mentioned earlier, there will be a mix of insert/update/delete
> > > > > of record(s) in different tables.)
>
> > > > > Massimo,
> > > > > If you too haven't understood what I intend to do with these 5 tables,
> > > > > I can elaborate the idea.
> > > > > Pl. tell me accordingly.
> > > > > The very success of developing my project using web2py hinges on this
> > > > > functionality.
>
> > > > > ---Vineet
> > > > > 
>
> > > > > On May 11, 5:17 am, pbreit  wrote:
>
> > > > > > Normalizing is not always the best approach. If the database has 
> > > > > > not yet
> > > > > > been designed, perhaps reconsider. I still don't really understand 
> > > > > > what you
> > > > > > are trying to do but 5 small tables might not be necessary.
>
> > > > > > I would suggest getting some code working with 2 tables an then go 
> > > > > > from
> > > > > > there.
>
> > > > > > Some 
> > > > > > options:http://web2py.com/book/default/chapter/07#One-form-for-multiple-table...
>
> > > > > > Another approach would to use FORM or SQLFORM.factory and then 
> > > > > > coding the
> > > > > > database updates. You lose some of the Web2py features but it might 
> > > > > > still be
> > > > > > the easiest way to do it.
>
> > > > > > But my first suggestion would be to t

[web2py] Re: Application design RDBMS vs GAE, future migrations

2011-05-16 Thread Anthony
Also, I think at some point in the near future, GAE is supposed to be 
offering a MySQL option.
 
Anthony

On Monday, May 16, 2011 7:29:47 PM UTC-4, howesc wrote:

> Marek,
>
> did you see google's announcements last week?  sometime this summer they 
> will offer app engine with SLA and all the real stuff that production 
> likes...
>
> i have interchanged in testing web2py code on GAE and RDBMS.  though once i 
> get into it i do my database layout differently and write my code 
> differently to work with GAE.  I am still confident that my code will run on 
> an RDBMS, though perhaps not as efficiently as if i had written for the 
> RDBMS.
>
> the updates to google's files API look to be quite nice - you can read, 
> manipulate, and write files to the blobstore now as if blobstore records 
> were files.  i have not used this feature yet, but suspect i will soon.
>
> i have not built a RDBMS app and then deployed to GAE, but what i can tell 
> you is that i have *never* worked with a platform that has scaled as well as 
> GAE.  even when my code was inefficient as long as we paid google they run 
> it so no customers experienced an outage while i fixed my code.
>
> 2 examples of GAE usage that i have worked on: www.elizabethscanvas.org is 
> all GAE, even the artwork images that are contributed by members are in the 
> GAE blobstore, and if you have an iOS device look for 'starmaker'  the app 
> communicates via an API to a web2py/GAE database backend.  the former has 
> low traffic so far, the latter has had spikes at various times since its 
> release.
>
> GAE is not the be-all-end-all, but if you are doing a web-based read 
> intensive application it's a strong option.
>
> christian
>


[web2py] Re: New importer in trunk

2011-05-16 Thread pierreth
Would it be better as a command line argument for webp2y.py?

Something like:

python web2py.py --debug

?


[web2py] Re: Application design RDBMS vs GAE, future migrations

2011-05-16 Thread howesc
Marek,

did you see google's announcements last week?  sometime this summer they 
will offer app engine with SLA and all the real stuff that production 
likes...

i have interchanged in testing web2py code on GAE and RDBMS.  though once i 
get into it i do my database layout differently and write my code 
differently to work with GAE.  I am still confident that my code will run on 
an RDBMS, though perhaps not as efficiently as if i had written for the 
RDBMS.

the updates to google's files API look to be quite nice - you can read, 
manipulate, and write files to the blobstore now as if blobstore records 
were files.  i have not used this feature yet, but suspect i will soon.

i have not built a RDBMS app and then deployed to GAE, but what i can tell 
you is that i have *never* worked with a platform that has scaled as well as 
GAE.  even when my code was inefficient as long as we paid google they run 
it so no customers experienced an outage while i fixed my code.

2 examples of GAE usage that i have worked on: www.elizabethscanvas.org is 
all GAE, even the artwork images that are contributed by members are in the 
GAE blobstore, and if you have an iOS device look for 'starmaker'  the app 
communicates via an API to a web2py/GAE database backend.  the former has 
low traffic so far, the latter has had spikes at various times since its 
release.

GAE is not the be-all-end-all, but if you are doing a web-based read 
intensive application it's a strong option.

christian


[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-16 Thread Jay
See the very bottom, I am so used to emacs keystrokes, that I
accidentally posted this before I was done. :(
Similar code works for update too.

Jay

On May 16, 6:33 pm, Jay  wrote:
> Vineet,
>
>  I wonder if this is what you want?
>
> I use this all the time. I have company info in a table and address in
> another, and my form contains company and address fields.
>
> db.define_table('company',
>     Field('name'),
>     Field('addressid', db.address),
>     migrate='company.table')
> db.define_table('address',
>     Field('street'),
>     Field('city'),
>     Field('state')
>     Field('zip'),
>     migrate='address.table')
>
> In the controller: (company.py):
>
> def newcompany():
>      'Get the data for a new company'
>     fields = 'name street city state zip'.split(' ')
>     form = SQLFORM.factory(db.address,db.company, fields=fields,
>                            formstyle='divs', submit_button='Save
> Company')
>
>     if form.accepts(request.vars, session):
>         coid =
> db.company.insert(**db.company._filter_fields(form.vars))
>         addrid =
> db.address.insert(**db.address._filter_fields(form.vars))
>         db(db.company.id == coid).update(addrid = addrid)
>     elif form.errors
return dict(form=form)  # this line was missing





[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-16 Thread Jay
Vineet,

 I wonder if this is what you want?

I use this all the time. I have company info in a table and address in
another, and my form contains company and address fields.

db.define_table('company',
Field('name'),
Field('addressid', db.address),
migrate='company.table')
db.define_table('address',
Field('street'),
Field('city'),
Field('state')
Field('zip'),
migrate='address.table')

In the controller: (company.py):

def newcompany():
 'Get the data for a new company'
fields = 'name street city state zip'.split(' ')
form = SQLFORM.factory(db.address,db.company, fields=fields,
   formstyle='divs', submit_button='Save
Company')

if form.accepts(request.vars, session):
coid =
db.company.insert(**db.company._filter_fields(form.vars))
addrid =
db.address.insert(**db.address._filter_fields(form.vars))
db(db.company.id == coid).update(addrid = addrid)
elif form.errors


[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-16 Thread villas
Hi Vineet,

If you already wrote the app in Foxpro then it should be much easier
to port. Take each Foxpro screen and make something similar in
Web2py?

I appreciate that might sound too facile, but when you tell me what's
wrong with that idea,  I might be able to see better where your
difficulty lies.

Regards, D



On May 16, 9:09 pm, Vineet  wrote:
> Villas,
> Let me give a little background.
> I have this entire massive application successfully running at client-
> sites in Microsoft Visual FoxPro.
> I have decided to shift from licensed platform to open-source
> platform.
> Chose Python for programming language & web2py for framework.
>
> My present task is not to define the app from scratch.
> Because the database-logic, business logic, UI is already there.
> I am trying to port the existing app to Python web framework.
>
> I am encouraged by your saying that ---
> "Web2py has all the ingredients you need to split a big horrible job
> in
> smaller easier ones.  It is extremely flexible for specifying queries
> depending on your 'decision-tree'. "
>
> Pl. help me solve my said issue in 'web2py'.
>
> --Vineet
> =


[web2py] Re: possible bug logging in to admin?

2011-05-16 Thread Massimo Di Pierro
oops. Thanks. This is a trunk only bug. I now fixed it.

On May 16, 4:42 pm, pbreit  wrote:
> I think there's a tiny typo in the new security check in admin/access.py.
> Should be "is_https", correct?
>
> if request.env.http_x_forwarded_for or request.is_http:
>     
> session.secure()http://code.google.com/p/web2py/source/browse/applications/admin/mode...


[web2py] Re: HELP: how do I subclass the Auth class and add additional fields to the login form?

2011-05-16 Thread Anthony
You might not need to subclass Auth to do that. Instead, you might be able 
to alter the form returned by Auth via the server-side DOM (e.g., 
http://web2pyslices.com/main/slices/take_slice/43).
 
Anthony
 
On Monday, May 16, 2011 5:41:29 PM UTC-4, Pystar wrote: 

> Hi guys, 
>
> I would like to know how to subclass the Auth class and add additional 
> fields to the login form. 
> thanks 
>


[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-16 Thread pbreit
Oops, my bad. Sorry about that.

I was probably mis-thinking about having them at the same level. This might 
make the logi more difficult or impossible.

if form_car.accepts(request.vars, session, dbio=False): 
do something
if form_customer.accepts(request.vars, session, dbio=False): 
do something 


[web2py] Re: HELP: how do I subclass the Auth class and add additional fields to the login form?

2011-05-16 Thread pbreit
If you're going to store them in the DB then Customizing Auth is easiest:
http://web2py.com/book/default/chapter/08#Customizing-Auth

Subclassing is going to be more difficult.

In a model file that comes before "auth =" do this:

from gluon.tools import Auth

class MyAuth(Auth): 

def navbar(self, prefix='Welcome', action=None):
""" subclassing navbar() """
...

Then switch "auth = Auth(globals(),db)" to "auth = MyAuth(globals(),db)"


[web2py] Cubrid?

2011-05-16 Thread mikech
Has anyone come across this DB?  Seems like it might be big in Korea.  The 
screen shots of the manager app looks interesting.

http://www.cubrid.org/home


[web2py] possible bug logging in to admin?

2011-05-16 Thread pbreit
I think there's a tiny typo in the new security check in admin/access.py. 
Should be "is_https", correct?

if request.env.http_x_forwarded_for or request.is_http:
session.secure() 
http://code.google.com/p/web2py/source/browse/applications/admin/models/access.py#13


[web2py] HELP: how do I subclass the Auth class and add additional fields to the login form?

2011-05-16 Thread Pystar
Hi guys,

I would like to know how to subclass the Auth class and add additional
fields to the login form.
thanks


[web2py] new app S5 slideshows in Web2py

2011-05-16 Thread Christopher Steel
LOL,

Some retro action...

This is a fairly rough implementation of S5 into a Web2py application
with an 'extra'.

Eventually I, or someone else (you?) will get around to giving is some
love, perhaps creating a db for slides, updating and so on.

In the mean time I could not resist the temptation make a Web2py
application that does S5 slides while playing annoying and repetitive
music at the same time...


http://code.google.com/p/uc-slideshow/


Cheers,


Christopher Steel


* This one is a long way from being Universal Cake at the moment...
but it is free and it works...


[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-16 Thread Massimo Di Pierro
I have not closely followed this thread so I am missing something but
this:

if form_car.accepts(request.vars, session, dbio=False):
if form_customer.accepts(request.vars, session, dbio=False):
do something

will not work because you cannot have nested accepts.

On May 16, 3:51 pm, pbreit  wrote:
> There might have been some confusion. You don't have to break your form or
> pages into multiple steps. But you can break the code in your controller
> into different steps. One controller can work with multiple tables.
>
> You can do stuff like:
>
> form_car = SQLFORM(db.car)
> form_customer = SQLFORM(db.customer)
> if form_car.accepts(request.vars, session, dbio=False):
>     if form_customer.accepts(request.vars, session, dbio=False):
>         do something
> return dict(form_car=form_car, form_customer=form_customer)
>
> You might need to use dbio=False so that Web2py doesn't automatically update
> the database. This can all be done on one web page.


[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-16 Thread pbreit
There might have been some confusion. You don't have to break your form or 
pages into multiple steps. But you can break the code in your controller 
into different steps. One controller can work with multiple tables.

You can do stuff like:

form_car = SQLFORM(db.car)
form_customer = SQLFORM(db.customer)
if form_car.accepts(request.vars, session, dbio=False):
if form_customer.accepts(request.vars, session, dbio=False):
do something
return dict(form_car=form_car, form_customer=form_customer)

You might need to use dbio=False so that Web2py doesn't automatically update 
the database. This can all be done on one web page.




[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-16 Thread Vineet
Dear Massimo,
Can I benefit from your expert advise too?

I am banking on Python & especially web2py for porting my apps from
Microsoft platform.
I tested turbogears but abandoned it since I found it too complex for
simple tasks, a lot of dependencies, memory savvy, weak docs, less
active community, etc.
Web2Py attracted me as it excels on all the above-referred points and
many others.

I am trying to port an ERP (enterprise resource planning) system for
automobile dealerships from VFP to web2py.
After this, there are be many more apps waiting to be ported.
My apps are complex & database oriented. (not just like 'yet another
blog site' or image upload, bulletin board, etc.)

Hope to get the helping hand from w2p community.

Thanks,
Vineet


[web2py] Re: Two questions: one about markmin and one about SQLFORM

2011-05-16 Thread Massimo Di Pierro
In markmin there are no line breaks. Just paragraphs. You have to set
the distance between paragraphs in CSS.

form=SQLFORM(...)
form.element('textarea')['_rows'] = random.randint(10,20)



On May 16, 3:13 pm, Jay Shaffstall  wrote:
> I've searched, but not found any information that helps me at my
> current level of web2py experience.
>
> Question 1: how do you insert a single line break (e.g. ) in
> markmin?  I've seen two spaces at the end of lines, but that doesn't
> seem to work for me.  I've seen that you can use  as a separator
> instead of , but that isn't what I want.  I just want to put a
> single line break in specific spots in the content.
>
> Question 2: How can I alter the attributes of form elements using
> SLQFORM?  Specifically, I want to change the number of rows and
> columns in a textarea, but I could see wanting to alter attributes of
> any form element.  The answer is probably to create a custom widget
> for the field in the model, but I haven't been able to come up with
> anything that has any effect.


[web2py] Two questions: one about markmin and one about SQLFORM

2011-05-16 Thread Jay Shaffstall
I've searched, but not found any information that helps me at my
current level of web2py experience.

Question 1: how do you insert a single line break (e.g. ) in
markmin?  I've seen two spaces at the end of lines, but that doesn't
seem to work for me.  I've seen that you can use  as a separator
instead of , but that isn't what I want.  I just want to put a
single line break in specific spots in the content.

Question 2: How can I alter the attributes of form elements using
SLQFORM?  Specifically, I want to change the number of rows and
columns in a textarea, but I could see wanting to alter attributes of
any form element.  The answer is probably to create a custom widget
for the field in the model, but I haven't been able to come up with
anything that has any effect.


[web2py] A few users have noticed disappearing posts...

2011-05-16 Thread Massimo Di Pierro
... if you are affected please email me personally.


[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-16 Thread Vineet
Villas,
Let me give a little background.
I have this entire massive application successfully running at client-
sites in Microsoft Visual FoxPro.
I have decided to shift from licensed platform to open-source
platform.
Chose Python for programming language & web2py for framework.

My present task is not to define the app from scratch.
Because the database-logic, business logic, UI is already there.
I am trying to port the existing app to Python web framework.

I am encouraged by your saying that ---
"Web2py has all the ingredients you need to split a big horrible job
in
smaller easier ones.  It is extremely flexible for specifying queries
depending on your 'decision-tree'. "

Pl. help me solve my said issue in 'web2py'.

--Vineet
=


[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-16 Thread Vineet
Simon,
I thought on the idea of adding a MySQL temp table to manage insert/
del/update on multiple tables.
But there would be a large no. of such forms requiring this
functionality.
It is better to avoid fiddling with the schema (which is the database-
tier) for the sake of business-logic tier.

What if I add a temporary table in DAL itself (along with the other
linked tables)?
Would it break the web2py logic of generating, validating, and saving
the form (if this table is used for generating the form)?
I mean, if a form is generated from such a temp DAL table, whether it
is possible to save data in multiple different tables.

---Vineet


On May 16, 4:33 pm, Simon Ashley  wrote:
> Memory tables referred to have no ability to write to disk. Generally
> we've used these for report accumulations. You could use a MySQL table
> and delete the record at the end (if need be). Crude and there should
> be a more pythonic method, but should work.
>
> Define temp table fields as per the following:
>
> 1. rec id
> 2. table1.uid
> 3. table1.variable
> 4. table2.uid
> 5. table2.variable
> 6. table3.uid
> 7. table3.variable
>
> Populate the fields before the load. The uids will of course be hidden
> on the form but used after the submit in separate database actions.
>
> Zero uid's would trigger inserts, > 0 for deletions where variables
> are blank or zero, edits where not. There is a level of programming
> involved; Massimo implied that.
>
> In your case, I would be reluctant to denormalise as further
> complexity could be cumbersome.
> (if not unworkable. Can think of examples in an application that we
> are looking at converting that would make anyone's mind spin).
>
> YMMV
>
> On May 16, 1:15 am, Vineet  wrote:
>
>
>
>
>
>
>
> > Simon,
> > That is a good idea.
> > In fact, almost the same approach is being followed in VFP cursor
> > adaptor (the difference being that, data from MySQL tables is
> > reproduced in same table structures, i.e cursors).
>
> > Here, by virtual table, do you mean to say that we should reproduce
> > the data into dictionaries by fetching a dict cursor from MySQLdb?
> > (in DABO, they have an excellent concept of bizobj for this task).
>
> > I am not asking for exact code, but can you suggest an approach to
> > tackle the task?
>
> > Dear Massimo & other friends,
> > can you pl. suggest something to solve my problem?
>
> > Thanks,
> > Vineet.
>
> > =
> > On May 15, 5:07 pm, Simon Ashley  wrote:
>
> > > Since no one has replied for a couple of days, I'll toss my 2 cents
> > > in. Don't how much value this could be, as we just evaluating web2py
> > > and python but in another environment we could have written data in
> > > the normalised records to a temporary record in a denormalised,
> > > virtualtable, update and saved this record, and then do selective
> > > updates, insertions and deletions on each normalised record in the
> > > original tables. Not that elegant but ...
>
> > > On May 13, 9:17 pm, Vineet  wrote:
>
> > > > pbreit,
> > > > As you say, wherever possible or required, I have already denormalized
> > > > thetable-structures.
> > > > Apart from normalization / denormalization issue, in many other forms,
> > > > I need to insert/update/delete records inmultipletables from one
> > > > form.
> > > > (as I mentioned earlier, there will be a mix of insert/update/delete
> > > > of record(s) in different tables.)
>
> > > > Massimo,
> > > > If you too haven't understood what I intend to do with these 5 tables,
> > > > I can elaborate the idea.
> > > > Pl. tell me accordingly.
> > > > The very success of developing my project using web2py hinges on this
> > > > functionality.
>
> > > > ---Vineet
> > > > 
>
> > > > On May 11, 5:17 am, pbreit  wrote:
>
> > > > > Normalizing is not always the best approach. If the database has not 
> > > > > yet
> > > > > been designed, perhaps reconsider. I still don't really understand 
> > > > > what you
> > > > > are trying to do but 5 small tables might not be necessary.
>
> > > > > I would suggest getting some code working with 2 tables an then go 
> > > > > from
> > > > > there.
>
> > > > > Some 
> > > > > options:http://web2py.com/book/default/chapter/07#One-form-for-multiple-table...
>
> > > > > Another approach would to use FORM or SQLFORM.factory and then coding 
> > > > > the
> > > > > database updates. You lose some of the Web2py features but it might 
> > > > > still be
> > > > > the easiest way to do it.
>
> > > > > But my first suggestion would be to try and simplify what you are 
> > > > > intending
> > > > > to do.


[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-16 Thread villas
It seems you have a very difficult workflow,  but have at least
established how your data should look.

So, ignore the tables a little for now,  try to visualise what the
user will see on the screen. How would your users like to enter their
data into the forms?  What data needs to be entered,  by whom,  at
what point?  How will those screens look?

Once you have a better idea of the workflow and how the screens might
appear,  you should be able to design some forms and get down to
processing the data.  Try sketching some flowcharts and mock-up some
screens to see how the gui could work.

Web2py has all the ingredients you need to split a big horrible job in
smaller easier ones.  It is extremely flexible for specifying queries
depending on your 'decision-tree'.


On May 16, 8:13 pm, Vineet  wrote:
> Villas,
> Your direction is perfect.
> While programming in VFP, in some of my forms, I had designed multiple
> steps (wizard).
> After breaking down the form into logical steps, further breaking down
> is not possible.
> Let me give a concrete example here. (back end database is MySQL).
>
> Consider an automobile workshop for repairing vehicles.
> A jobcard is prepared for every vehicle attended to.
> It contains complaints, repair operations, spare parts required,
> mechanic details, dates & times of vehicle in/repaired/billed/out,
> etc.
> These things are picked-up from their respective masters data from
> separate tables.
> The jobcard 'wizard' is divided into steps like 'receive the vehicle',
> 'enter repair operations', 'enter spare parts requirement',
> 'enter spare parts issued', 'billing', etc.
>
> Now, for an example, consider the step of 'enter repair operations'.
> Here, the data is saved through a transaction into multiple semi-
> normalised tables (e.g. separate tables for warranty repairs, paid
> repairs, free-services, tax-details, mechanic details, etc.).
> When a user re-opens earlier jobcard, he/she may change an amount,
> delete a repair operation, add another one, and so on...
> For every table, it is not possible to break-down the form in steps,
> since it would become messier & impractical.
>
> Now I hope you can judge as to why I am trying so much to get around
> the issue of handling multiple tables from a single form (or through a
> step in a form-wizard).
>
> Should you need any other detail for helping me, pl. let me know.
> In the meantime, I am figuring out how to fit Simon's idea in the app.
>
> Thanks,
> Vineet
> ===


[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-16 Thread Vineet
Villas,
Your direction is perfect.
While programming in VFP, in some of my forms, I had designed multiple
steps (wizard).
After breaking down the form into logical steps, further breaking down
is not possible.
Let me give a concrete example here. (back end database is MySQL).

Consider an automobile workshop for repairing vehicles.
A jobcard is prepared for every vehicle attended to.
It contains complaints, repair operations, spare parts required,
mechanic details, dates & times of vehicle in/repaired/billed/out,
etc.
These things are picked-up from their respective masters data from
separate tables.
The jobcard 'wizard' is divided into steps like 'receive the vehicle',
'enter repair operations', 'enter spare parts requirement',
'enter spare parts issued', 'billing', etc.

Now, for an example, consider the step of 'enter repair operations'.
Here, the data is saved through a transaction into multiple semi-
normalised tables (e.g. separate tables for warranty repairs, paid
repairs, free-services, tax-details, mechanic details, etc.).
When a user re-opens earlier jobcard, he/she may change an amount,
delete a repair operation, add another one, and so on...
For every table, it is not possible to break-down the form in steps,
since it would become messier & impractical.

Now I hope you can judge as to why I am trying so much to get around
the issue of handling multiple tables from a single form (or through a
step in a form-wizard).

Should you need any other detail for helping me, pl. let me know.
In the meantime, I am figuring out how to fit Simon's idea in the app.

Thanks,
Vineet
===


Re: [web2py] Re: develop iphone apps with web2py with this plugin

2011-05-16 Thread Jason Brower

PyWurfl is AWESOME!
I used it for some web2py stuff on my thesis.  It turned out very well 
as I could find just about anything I wanted about a phone. Glad to see 
it in use.

BR,
Jason

On 05/16/2011 08:36 PM, mattgorecki wrote:

I started building mobile views using jQuery Mobile just a few days
before you released this.  For the most part we did the same things,
but I have a bit of code that in models/0.py that checks for a mobile
user agent and adjusts the view accordingly.  This way I can use the
same controller for both the regular view and the mobile view.  The
normal view would be at index.html and the mobile view at
index.mobile.html.

You'll need mobile.sniffer and PyWURFL modules for this to work.

Here's the code: https://gist.github.com/974920

Matt Gorecki

On May 14, 11:52 pm, Massimo Di Pierro
wrote:

I find that designing the app formobilefirst forces to keep
navigation simple and that is good.

On May 14, 10:23 pm, Jason Brower  wrote:








On 05/14/2011 11:57 PM, Massimo Di Pierro 
wrote:>http://web2py.com/plugins/plugin_jqmobile/about

Please send us comments and suggestions

Excited to give it a try in some of my apps. Though I should probably
complete the apps first for normal browsers. :D
BR,
Jason Brower




[web2py] Re: Calling External jQuery pages

2011-05-16 Thread Anthony
On Monday, May 16, 2011 2:27:54 PM UTC-4, Chris May wrote: 
>
> 2) Wrap the JavaScript in jQuery's document ready function: 
> $(document).ready(function () { 
> ... your JavaScript ... 
> };

 
Hmm, according to http://api.jquery.com/ready/, $(function()...) is 
equivalent to $(document).ready(function()...), so shouldn't the original 
version work?
 
Anthony


[web2py] Re: New importer in trunk

2011-05-16 Thread villas
Tip: get the value of the URL and set the Debug accordingly from
that,  it makes it easier if you don't have to remember changing the
flag.

Have a look at this, for example:
request.env.http_host.split('.')[0]


On May 16, 6:15 pm, Ross Peoples  wrote:
> I was thinking about setting this in a db.py file or something to indicate
> that the app in in debug mode. Then before deploying, setting this to false.
> Also allowing controllers, modules, etc to access the value of this might be
> beneficial. It could be a master 'debug' switch for an entire application.
> It could be like using a DEBUG preprocessor directive, allowing you to write
> code that works differently when in debug mode for testing purposes.


[web2py] Re: For interest: Python Requests package - HTTP for humans

2011-05-16 Thread Anthony
On Monday, May 16, 2011 12:44:02 PM UTC-4, pbreit wrote: 
>
> GAE provides it's own fetch() function but that could be because of special 
> needs:
> http://code.google.com/appengine/docs/python/urlfetch/fetchfunction.html
>
 
So does web2py: 
http://web2py.com/book/default/chapter/12#Fetching-an-external-URL. :-)
 
Anthony
 


[web2py] Re: develop iphone apps with web2py with this plugin

2011-05-16 Thread Massimo Di Pierro
More than one year ago I wrote this:

http://www.web2py.com/examples/static/mobile_device_detect.py

and it has no dependencies. Do you think it still works?

Massimo

On May 16, 12:36 pm, mattgorecki  wrote:
> I started building mobile views using jQuery Mobile just a few days
> before you released this.  For the most part we did the same things,
> but I have a bit of code that in models/0.py that checks for a mobile
> user agent and adjusts the view accordingly.  This way I can use the
> same controller for both the regular view and the mobile view.  The
> normal view would be at index.html and the mobile view at
> index.mobile.html.
>
> You'll need mobile.sniffer and PyWURFL modules for this to work.
>
> Here's the code:https://gist.github.com/974920
>
> Matt Gorecki
>
> On May 14, 11:52 pm, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > I find that designing the app formobilefirst forces to keep
> > navigation simple and that is good.
>
> > On May 14, 10:23 pm, Jason Brower  wrote:
>
> > > On 05/14/2011 11:57 PM, Massimo Di Pierro 
> > > wrote:>http://web2py.com/plugins/plugin_jqmobile/about
>
> > > > Please send us comments and suggestions
>
> > > Excited to give it a try in some of my apps. Though I should probably
> > > complete the apps first for normal browsers. :D
> > > BR,
> > > Jason Brower


[web2py] Re: develop iphone apps with web2py with this plugin

2011-05-16 Thread mattgorecki
I started building mobile views using jQuery Mobile just a few days
before you released this.  For the most part we did the same things,
but I have a bit of code that in models/0.py that checks for a mobile
user agent and adjusts the view accordingly.  This way I can use the
same controller for both the regular view and the mobile view.  The
normal view would be at index.html and the mobile view at
index.mobile.html.

You'll need mobile.sniffer and PyWURFL modules for this to work.

Here's the code: https://gist.github.com/974920

Matt Gorecki

On May 14, 11:52 pm, Massimo Di Pierro 
wrote:
> I find that designing the app formobilefirst forces to keep
> navigation simple and that is good.
>
> On May 14, 10:23 pm, Jason Brower  wrote:
>
>
>
>
>
>
>
> > On 05/14/2011 11:57 PM, Massimo Di Pierro 
> > wrote:>http://web2py.com/plugins/plugin_jqmobile/about
>
> > > Please send us comments and suggestions
>
> > Excited to give it a try in some of my apps. Though I should probably
> > complete the apps first for normal browsers. :D
> > BR,
> > Jason Brower


[web2py] Re: Recaptcha and registration

2011-05-16 Thread Bjoern
Using 1.95.1 and not trunk, I found that I needed to use

VERIFY_SERVER = 'www.google.com/recaptcha/api

Otherwise, it works.


[web2py] Re: Editing row with SQLFORM.factory

2011-05-16 Thread contatogilson...@gmail.com
I tried to do as it is in the comments, but did not work:

http://web2pyslices.com/main/slices/take_slice/102
_
*Gilson Filho*
*Web Developer
http://gilsondev.com*


[web2py] Re: New importer in trunk

2011-05-16 Thread Ross Peoples
I was thinking about setting this in a db.py file or something to indicate 
that the app in in debug mode. Then before deploying, setting this to false. 
Also allowing controllers, modules, etc to access the value of this might be 
beneficial. It could be a master 'debug' switch for an entire application. 
It could be like using a DEBUG preprocessor directive, allowing you to write 
code that works differently when in debug mode for testing purposes. 

Re: [web2py] Re: some new cool stuff in trunk under testing

2011-05-16 Thread Martín Mulone
Up.

How do I use LOAD in the module?

2011/5/9 Jonathan Lundell 

> On May 9, 2011, at 12:57 PM, Bruno Rocha wrote:
>
> On Mon, May 9, 2011 at 3:46 PM, Martín Mulone 
> wrote:
>
>> current.db = DAL(..)
>>
>
> The db doesn't belongs to app?
>
> current.app.db = DAL(...)
>
>
> Yes, I think that's better.
>



-- 
 http://martin.tecnodoc.com.ar


[web2py] Re: For interest: Python Requests package - HTTP for humans

2011-05-16 Thread pbreit
I was pretty surprised at how bad the state of Python's "http client" 
libraries were. Fortunately I've been doing pretty simple stuff so far so 
urllib/urllib2 have been adequate. But this definitely looks nicer.

GAE provides it's own fetch() function but that could be because of special 
needs:
http://code.google.com/appengine/docs/python/urlfetch/fetchfunction.html


Re: [web2py] Re: show multiple tables in 1 page

2011-05-16 Thread pbreit
I can take another look at it but you are welcome to try and debug as well.

[web2py] Re: Web2py MySql Tables coming empty

2011-05-16 Thread pbreit
Oh, wow, that didn't even occur to me.

Yeah, you need to define models for all your tables. Here's a bit of info on 
"Legacy Databases":
http://web2py.com/book/default/chapter/06#Legacy-Databases-and-Keyed-Tables

There's a script that might be able to help you out:
http://code.google.com/p/web2py/source/browse/scripts/extract_mysql_models.py


[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-16 Thread villas
Hi Vineet

I think I am understanding more,  but still not enough to properly
help you :(

The business logic of your system is entirely in your own hands.  The
group cannot really help with that.

If you have a tricky form which will generate a multitude of
outcomes,  you should try making a flowchart for the logic.  If the
data can be entered in multiple stages,  you might have to design your
form as more of a wizard.

You can make a form with whatever fields you want,  validate the data
however you want,  accept the form and then decide what queries need
to be run, and  then run them.  It doesn't matter how many tables
there are.

If this can be done in one step great,  otherwise you'll have to think
about the wizard. You should investigate what happens if the process
should cancel/fail part way through,  will you have to reverse some
entries?  If so, you should prob make your queries inside a
transaction and then roll-back (if your DB can support this).

How long will the queries take to run?  If they take a long time,  you
may prefer to create some kind of queue.  Hopefully this can be
avoided.

Regards, D


[web2py] Re: New importer in trunk

2011-05-16 Thread pierreth
On 16 mai, 11:08, Ross Peoples  wrote:
> I haven't actually tried this yet, but couldn't you do something like this
> to turn it off/on:
>
> import gluon custom_import
> custom_import.DEBUG = False

You can do:

from gluon import custom_import
custom_import.DEBUG = False

But right now it won't change the importer by doing this. Would you
like to be able to switch in a similar fashion?

We can also add the switch in the web interface I guess.


[web2py] Re: New importer in trunk

2011-05-16 Thread Ross Peoples
I haven't actually tried this yet, but couldn't you do something like this 
to turn it off/on:

import gluon custom_import
custom_import.DEBUG = False


[web2py] New importer in trunk

2011-05-16 Thread pierreth
Hello,

There is a new version of the web2py importer in the trunk version.
This new version has the capability of reloading any modules when an
import is made on a module that has changed. So you can edit your .py
files in 'modules' or 'site-packages' or somewhere else and web2py
will reload the new version during the next import.

To turn this feature on or off, you have to edit the web2py file gluon/
custom_import.py and set DEBUG to True or False. The default value is
True so the feature is enabled by default.

Feedback on this new feature would be appreciated. I would appreciate
feedback on how might be the best to set this feature on and off.

Thank you.


[web2py] Re: Web2py MySql Tables coming empty

2011-05-16 Thread Anthony
I made a slight edit in the book near the end of the 
http://web2py.com/book/default/chapter/06#Record-Representation section, 
where 'db.tables' is mentioned. It now indicates that db.tables lists the 
tables defined for the db connection (previously it said that 'db.tables' 
queried the database for table names, which was misleading).
 
Anthony

On Monday, May 16, 2011 10:40:34 AM UTC-4, Anthony wrote:

> Simply connecting to a database does not tell web2py what tables are in the 
> database. You have to explicitly define the tables by using the DAL 
> define_table method. So, you code should be:
>  
> db=DAL('mysql://varun:VaruN@192.168.0.240:3306/test')  # note, you should 
> use DAL(), not SQLDB().
> db.define_table('person', )
> # Also, define any additional tables you want to access via the DAL.
>  
> Note, db.tables does not extract the names of the actual tables in the db 
> connection -- it simply lists the names of the DAL Table objects that have 
> been defined via define_table().
>  
> Anthony
>
> On Friday, May 6, 2011 3:49:54 AM UTC-4, vrathore wrote:
>
>> Hello There, 
>>
>> I am connecting to my existing Mysql DB, i am able to connect, but i 
>> am getting tables empty. 
>> Here is the Sample Code 
>> db=SQLDB('mysql://varun:VaruN@192.168.0.240:3306/test') 
>> print db 
>> print "gettables" ,db.tables 
>>
>> I get the following respose on the console 
>> database  > sql_mode='NO_BACKSLAS 
>> H_ESCAPES';", '_db_codec': 'UTF-8', '_timings': [('SET 
>> FOREIGN_KEY_CHECKS=1;', 0 
>> .0), ("SET sql_mode='NO_BACKSLASH_ESCAPES';", 0.0)], '_fake_migrate': 
>> False, '_d 
>> bname': 'mysql', '_adapter': > 0x01976670>, 'che 
>> ck_reserved': None, '_uri': 'mysql://varun:VaruN@192.168.0.240:3306/ 
>> test_ytk', ' 
>> tables': [], '_fake_migrate_enabled': False, '_migrate': True, 
>> '_pool_size': 0}> 
>>
>> "gettables"[] 
>>
>> On the Ticket Response on admin i see this error 
>> Traceback (most recent call last): 
>>   File "gluon/restricted.py", line 181, in restricted 
>>   File "E:/Projects/Web2Pye/web2py_win/web2py/applications/TSearch/ 
>> models/db.py", line 5, in  
>>   File "gluon/dal.py", line 4042, in __getitem__ 
>> KeyError: 'person' 
>>
>

[web2py] using rpy2 package with web2py

2011-05-16 Thread 1904
Hello everybody,

i m trying to use web2py with the rpy2 package. Everything is alright
and I can use rpy2 its really pretty [http://rpy.sourceforge.net/
rpy2.html] and i can use it also without problems in web2py.
Now I want to add the package gplot because I need to plot Cofidence
Intervals. I installed the package and everything was fine. I m able
to use gplots with rpy2 in python. here is a little example:

import rpy2.robjects as robjects
robjects.r.library("gplots")
r = robjects.r
x = 1
y =2
r.plotCI(x, y)

works fine. Rpy2 works also fine with web2py BUT if I want to use the
gplots library which was additonaly installed on my ubuntu pc web2py
cant find the gplots package and i dont know why!?!?!

I got this error message:
  File "/usr/lib/python2.6/dist-packages/rpy2/robjects/functions.py",
line 83, in __call__
return super(SignatureTranslatedFunction, self).__call__(*args,
**kwargs)
  File "/usr/lib/python2.6/dist-packages/rpy2/robjects/functions.py",
line 35, in __call__
res = super(Function, self).__call__(*new_args, **new_kwargs)
RRuntimeError: Error in function (package, help, pos = 2, lib.loc =
NULL, character.only = FALSE,  :
  there is no package called 'gplots'


I would be glab about help, thank you, jonas


[web2py] Re: Web2py MySql Tables coming empty

2011-05-16 Thread Anthony
Simply connecting to a database does not tell web2py what tables are in the 
database. You have to explicitly define the tables by using the DAL 
define_table method. So, you code should be:
 
db=DAL('mysql://varun:VaruN@192.168.0.240:3306/test')  # note, you should 
use DAL(), not SQLDB().
db.define_table('person', )
# Also, define any additional tables you want to access via the DAL.
 
Note, db.tables does not extract the names of the actual tables in the db 
connection -- it simply lists the names of the DAL Table objects that have 
been defined via define_table().
 
Anthony

On Friday, May 6, 2011 3:49:54 AM UTC-4, vrathore wrote:

> Hello There, 
>
> I am connecting to my existing Mysql DB, i am able to connect, but i 
> am getting tables empty. 
> Here is the Sample Code 
> db=SQLDB('mysql://varun:VaruN@192.168.0.240:3306/test') 
> print db 
> print "gettables" ,db.tables 
>
> I get the following respose on the console 
> database   sql_mode='NO_BACKSLAS 
> H_ESCAPES';", '_db_codec': 'UTF-8', '_timings': [('SET 
> FOREIGN_KEY_CHECKS=1;', 0 
> .0), ("SET sql_mode='NO_BACKSLASH_ESCAPES';", 0.0)], '_fake_migrate': 
> False, '_d 
> bname': 'mysql', '_adapter':  0x01976670>, 'che 
> ck_reserved': None, '_uri': 'mysql://varun:VaruN@192.168.0.240:3306/ 
> test_ytk', ' 
> tables': [], '_fake_migrate_enabled': False, '_migrate': True, 
> '_pool_size': 0}> 
>
> "gettables"[] 
>
> On the Ticket Response on admin i see this error 
> Traceback (most recent call last): 
>   File "gluon/restricted.py", line 181, in restricted 
>   File "E:/Projects/Web2Pye/web2py_win/web2py/applications/TSearch/ 
> models/db.py", line 5, in  
>   File "gluon/dal.py", line 4042, in __getitem__ 
> KeyError: 'person' 
>


[web2py] Re: Web2py MySql Tables coming empty

2011-05-16 Thread vrathore
its

print db['person']

Here its giving error





On May 6, 9:31 pm, pbreit  wrote:
> What is line 5 in db.py?


[web2py] Re: web2py

2011-05-16 Thread Anthony
Check out https://bitbucket.org/rochacbruno/powertable/overview and 
http://www.ebansoftware.net/en/prodotti/item/9-editable-jqgrid.
 
Anthony

On Friday, May 13, 2011 9:00:01 AM UTC-4, msaddicted wrote:

> Hello all, 
> I'm absolutely new to web2py and I'm trying to build an app to let web 
> users explore data views (ordering columns, search for content, 
> paginating rows) and have crud operations on specific tables (one or 
> more at the same time). I've checked out WebGrid for web2py or jqgrid, 
> but every solution have some tradeoffs. 
> Is out there some more complete example that use specific web2py 
> objects (SQLFORM, CRUD, etc.) I can follow? 
>
> Thank you, msaddicted



Re: [web2py] Re: Error in SQLTABLE in pymysql

2011-05-16 Thread Vasile Ermicioi
and python version please (needed for benchmarking)

pymysql also have the advantage to run on top of jython and pypy with no
efforts
and I guess that on top of pypy it will have much better performance


Re: [web2py] Re: Error in SQLTABLE in pymysql

2011-05-16 Thread Vasile Ermicioi
what benchmark do you use ?

also please provide some more information so I can reproduce your error
- what are other tables structure?
- what data do you have?
- Mysql version ans schema type (MyISAM or InnoDB)


Re: [web2py] Re: show multiple tables in 1 page

2011-05-16 Thread Stifan Kristi
thank you so much for your hints and pointers pbreit, btw, an error occured
when i tried to do it.

e.g. 1.
=== controller ===
def index():
pages = db(db.page.id > 0).select(orderby = db.page.title)
comments = db(db.comment.id > 0).select()
for comment in comments:
comment_groups[comment.page_id].append(comment)
return dict(pages = pages, comment_groups = comment_groups)

=== view ===

{{for page in pages:}}
{{=page.name}}
{{for comment in comment_groups[page.id]:}}
{{=comment.body}}
 {{pass}}

 
{{pass}}


=== traceback ===
Traceback (most recent call last):
  File "/home/sugizo/web2py/gluon/restricted.py", line 181, in restricted
exec ccode in environment
  File "/home/sugizo/web2py/applications/a/controllers/default.py", line 61,
in 
  File "/home/sugizo/web2py/gluon/globals.py", line 133, in 
self._caller = lambda f: f()
  File "/home/sugizo/web2py/applications/a/controllers/default.py", line 6,
in index
return dict(pages = pages, comment_groups = comment_groups)
NameError: global name 'comment_groups' is not defined

e.g. 2.
=== controller ===
def index():
pages = db(db.page.id > 0).select(orderby = db.page.title)
comments = db(db.comment.id > 0).select()
return dict(pages = pages, comments = comments)

=== view ===

{{for page in pages:}}
{{=page.name}}
{{for comment in comments:}}
{{if comment.page_id == page.id:}}
{{=comment.body}}
{{pass}}
 {{pass}}

 
{{pass}}


=== traceback ===
Traceback (most recent call last):
  File "/home/sugizo/web2py/gluon/restricted.py", line 181, in restricted
exec ccode in environment
  File "/home/sugizo/web2py/applications/a/views/default/index.html", line
4, in 
{{for comment in comments:}}
  File "/home/sugizo/web2py/gluon/dal.py", line 3532, in __getattr__
return self[key]
  File "/home/sugizo/web2py/gluon/dal.py", line 3523, in __getitem__
return dict.__getitem__(self, key)
KeyError: 'name'

did anyone ever have the same problem to show multiple tables in 1 page?
any hints and pointers are greatly appreciate, thank you so much.

On Mon, May 16, 2011 at 9:53 AM, pbreit  wrote:

> Hard to say the best way to do it. This might be one way (not tested).
>
> === controller ===
> def index():
> pages = db(db.page.id>0).select(orderby = db.page.title)
> comments = db(db.comment.id>0).select()
> return dict(pages=pages, comments=comments)
>
> === view ===
> 
> {{for page in page:}}
> {{=page.name}}
> {{for comment in comments if comment.page_id==page.id:}}
> {{=comment.body}}
>  {{pass}}
> 
>  
> {{pass}}
> 
>
>
> There's probably a much more efficient way to do it since the "for comment
> in comments" loop goes through all comments for each page. The way you had
> it didn't really make any sense because you were getting all the pages but
> then just the comments for one (unspecified) page. "db(db.comment.page_id
> == db.page.id).select()" is going to return ALL comments. If you want the
> comments for just one page you would do something like db(db.comment.page_id
> == r equest.args(0)).select().
>
> To make it more efficient, you might be able to group the comments in the
> controller. I don't know if this works, it's kind of a guess.
>
> def index():
> pages = db(db.page.id>0).select(orderby = db.page.title)
> comments = db(db.comment.id>0).select()
> for comment in comments:
> comment_groups[coment.page_id].append(comment)
> return dict(pages=pages, comment_groups=comment_groups)
>
> 
> {{for page in page:}}
> {{=page.name}}
> {{for comment in comment_groups[page.id]:}}
> {{=comment.body}}
>  {{pass}}
> 
>  
> {{pass}}
> 
>


[web2py] Re: Error in SQLTABLE in pymysql

2011-05-16 Thread SergeyPo
Massimo!

I was wrong to say that pymysql is 20% slower. It is 3 times slower
than mysqldb, and does huge memory leak (both facts for Windows XP).
Mysql is so popular that you should treat it as priority! Please
consider switching back to mysqldb or at least making this user-
selectable easily.

Best regards,
Sergey Podlesny

On 16 май, 15:00, SergeyPo  wrote:
> I get the following error when call SQL table, when I have reference
> fields in my data table.
> E.g.:
>
> db.define_table('alarms',
>     SQLField('function_name', 'string', length=64),
>     SQLField('created_at', 'datetime',
> default=datetime.datetime.now()),
>     SQLField('header', db.headers),
>     SQLField('time_based', db.time_based, required=False),
>     SQLField('komment', 'string', length=255),
>     SQLField('ack_at', 'datetime', default=None, notnull=False),
>     SQLField('detail', db.details, required=False),
>     SQLField('investigation', db.investigations),
>     SQLField('internals', 'text'),
> )
> alarms_rs = db(eval(terms)).select( orderby=alarms_orderby,
>
> limitby=session.alarms_limitby,
>                                         )
> print alarms_rs #prints query results into console window, no errors
> at this point
> alarms_tbl = SQLTABLE(alarms_rs,
>                     _class='sortable',
>                     headers=headers_dict,
>                     truncate = 200,
>                     orderby=True)
>
> At this point error occures for the field SQLField('investigation',
> db.investigations).
> Here is a traceback:
>
> Traceback (most recent call last):
>   File "C:\web2py\gluon\restricted.py", line 181, in restricted
>     exec ccode in environment
>   File "C:/web2py/applications/advantage/controllers/alarms.py", line
> 842, in 
>   File "C:\web2py\gluon\globals.py", line 133, in 
>     self._caller = lambda f: f()
>   File "C:\web2py\gluon\tools.py", line 2335, in f
>     return action(*a, **b)
>   File "C:/web2py/applications/advantage/controllers/alarms.py", line
> 137, in alarms_table
>     orderby=True)
>   File "C:\web2py\gluon\sqlhtml.py", line 1366, in __init__
>     elif linkto and hasattr(field._table,'_primarykey') and fieldname
> in field._table._primarykey:
>   File "C:\web2py\gluon\dal.py", line 3457, in repr_ref
>     def repr_ref(id, r=referenced, f=ff): return f(r, id)
>   File "C:\web2py\gluon\dal.py", line 3426, in ff
>     row=r(id)
>   File "C:\web2py\gluon\dal.py", line 4387, in __call__
>     record = self._db(self.id == key).select(limitby=(0,1)).first()
>   File "C:\web2py\gluon\dal.py", line 5164, in select
>     return self.db._adapter.select(self.query,fields,attributes)
>   File "C:\web2py\gluon\dal.py", line 1077, in select
>     rows = response(sql)
>   File "C:\web2py\gluon\dal.py", line 1067, in response
>     self.execute(sql)
>   File "C:\web2py\gluon\dal.py", line 1152, in execute
>     return self.log_execute(*a, **b)
>   File "C:\web2py\gluon\dal.py", line 1147, in log_execute
>     ret = self.cursor.execute(*a,**b)
>   File "C:\web2py\gluon\contrib\pymysql\cursors.py", line 108, in
> execute
>     self.errorhandler(self, exc, value)
>   File "C:\web2py\gluon\contrib\pymysql\connections.py", line 182, in
> defaulterrorhandler
>     raise Error(errorclass, errorvalue)
> Error: (, AssertionError('Protocol
> error, expecting EOF',))
>
> I tried to workaround by adding format to 'investigations' table, set
> represent=None to fields in question, this won't help. If
> db.alarms.investigation field is empty (None) error does not occur.
> MySQL console lets me select the record in investigations field, there
> are no problems with data.
>
> Looks like pymysql gives so many problems, won't it be better to go
> back to dbmysql? pymysql works 20% slower on my PC, application admin
> is not working on Windows and Debian installations since web2py
> version 1.92 (I reported on this usergroup)... why so many problems
> with contrib module?


[web2py] Editing row with SQLFORM.factory

2011-05-16 Thread contatogilson...@gmail.com
Hi,

It has a module that I used the "link" forms using SQLFORM.factory, and
everything went right. How do I make this just the same way that editing the
data? I can send the data tothe forms, but it does not save.
_
*Gilson Filho*
*Web Developer
http://gilsondev.com*


[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-16 Thread Vineet
Dear Simon & villas,
Thanks for your replies.
Let me digest your ideas by putting them to work.
Then I can ask for your help on fine-tuning the form.


In reply to villas's post, I have this to write---
Dear villas,
Seems that you have got my problem almost correctly, with one
difference.
Let me brief the problem here again.

A form is handling table-1, table-2, table-3.
User will manipulate the data so that there may be an insert statement
for table-1, update statement for table-2, delete statement for
table-3 (or any other combination of DML statements for each table).
I can't hardcode DML statements for tables, since I can't predict
which table would be receiving
what DML statement.
If that were the case, I would have used form=SQLFORM and then
form[0].insert(2,TR(...))
OR use of SQLFORM.Factory

As such, I could not get started by writing a controller (since I am
stuck-up with how to tackle this logic).
(If you require, I can attach a screenshot of such form prepared in
VFP to get the idea of why this is required.)

So, in a nutshell, my question is this ---
How to identify which DML statement is required for
which table.
Which components of web2py can be used in building a generic
controller for handling such kind of form.

Thanks,
Vineet
===


[web2py] Re: Tr.lời: Re: Tr.lời: Re: Tr.lời: Re: web2py 1.95.1 and open issues

2011-05-16 Thread ls1
I confirm the problem. Had the same errors.
Solution for user: delete all non-tickets files from errors directory.
Any non-ticket file in directory generates error and links like

http://127.0.0.1:8000/admin/default/errors/

does not work.

To preserve directory structure in my application hg repository I used
to have one empty file in each directory.
Now I had to delete this file, didn't like it.


On 28 Kwi, 19:55, selecta  wrote:
> > What do you mean by corrupted error tickets? Do you have a traceback?
>
> all I get is an unknow error, a printout in the shell and a ticket
> file
> if i try to access this ticket file in the appadmin i get the
> traceback that i posted before
>
> Traceback (most recent call last):
>   File "/home/fkrause/Downloads/tmp/wp/web2py/gluon/restricted.py",
> line 181, in restricted
>     exec ccode in environment
>   File "/home/fkrause/Downloads/tmp/wp/web2py/applications/admin/
> controllers/default.py", line 1188, in 
>   File "/home/fkrause/Downloads/tmp/wp/web2py/gluon/globals.py", line
> 133, in 
>     self._caller = lambda f: f()
>   File "/home/fkrause/Downloads/tmp/wp/web2py/applications/admin/
> controllers/default.py", line 1033, in errors
>     error = pickle.load(open(fullpath, 'r'))
>   File "/usr/lib/python2.6/pickle.py", line 1370, in load
>     return Unpickler(file).load()
>   File "/usr/lib/python2.6/pickle.py", line 858, in load
>     dispatch[key](self)
>   File "/usr/lib/python2.6/pickle.py", line 880, in load_eof
>     raiseEOFErrorEOFError


[web2py] ajax update database

2011-05-16 Thread comamitc
I am wondering the best way to send more than one record's value to a
controller and then update a database with it.  What i want to do is
push a string like:

var data = "[{"id": 1, "val": something},{"id": 2, "val":
somethingElse}]";

into:

$.ajax({
type: "POST",
url: fetchURL("saveAttrs"),
data: attr_data,
// everything below here is unimportant!!!
success: function(msg){
$("li#stats").show().html(msg);
setTimeout(clearStats, 3000);
}
});

I am unsure of how to access this data from the server side. I tried
an example on stackoverflow which was:

def saveAttrs():
 import simplejson as json
 j = json.loads(request.body.read())
 return "success!"

but this gave me an error saying my string wasn't JSON formatted.  How
exaclty do i get this data to the server in bulk format instead of
having to update every record independently in the jQuery for each
loop.

Thanks in advance!



[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-16 Thread Simon Ashley
Memory tables referred to have no ability to write to disk. Generally
we've used these for report accumulations. You could use a MySQL table
and delete the record at the end (if need be). Crude and there should
be a more pythonic method, but should work.

Define temp table fields as per the following:

1. rec id
2. table1.uid
3. table1.variable
4. table2.uid
5. table2.variable
6. table3.uid
7. table3.variable

Populate the fields before the load. The uids will of course be hidden
on the form but used after the submit in separate database actions.

Zero uid's would trigger inserts, > 0 for deletions where variables
are blank or zero, edits where not. There is a level of programming
involved; Massimo implied that.

In your case, I would be reluctant to denormalise as further
complexity could be cumbersome.
(if not unworkable. Can think of examples in an application that we
are looking at converting that would make anyone's mind spin).

YMMV

On May 16, 1:15 am, Vineet  wrote:
> Simon,
> That is a good idea.
> In fact, almost the same approach is being followed in VFP cursor
> adaptor (the difference being that, data from MySQL tables is
> reproduced in same table structures, i.e cursors).
>
> Here, by virtual table, do you mean to say that we should reproduce
> the data into dictionaries by fetching a dict cursor from MySQLdb?
> (in DABO, they have an excellent concept of bizobj for this task).
>
> I am not asking for exact code, but can you suggest an approach to
> tackle the task?
>
> Dear Massimo & other friends,
> can you pl. suggest something to solve my problem?
>
> Thanks,
> Vineet.
>
> =
> On May 15, 5:07 pm, Simon Ashley  wrote:
>
>
>
>
>
>
>
> > Since no one has replied for a couple of days, I'll toss my 2 cents
> > in. Don't how much value this could be, as we just evaluating web2py
> > and python but in another environment we could have written data in
> > the normalised records to a temporary record in a denormalised,
> > virtualtable, update and saved this record, and then do selective
> > updates, insertions and deletions on each normalised record in the
> > original tables. Not that elegant but ...
>
> > On May 13, 9:17 pm, Vineet  wrote:
>
> > > pbreit,
> > > As you say, wherever possible or required, I have already denormalized
> > > thetable-structures.
> > > Apart from normalization / denormalization issue, in many other forms,
> > > I need to insert/update/delete records inmultipletables from one
> > > form.
> > > (as I mentioned earlier, there will be a mix of insert/update/delete
> > > of record(s) in different tables.)
>
> > > Massimo,
> > > If you too haven't understood what I intend to do with these 5 tables,
> > > I can elaborate the idea.
> > > Pl. tell me accordingly.
> > > The very success of developing my project using web2py hinges on this
> > > functionality.
>
> > > ---Vineet
> > > 
>
> > > On May 11, 5:17 am, pbreit  wrote:
>
> > > > Normalizing is not always the best approach. If the database has not yet
> > > > been designed, perhaps reconsider. I still don't really understand what 
> > > > you
> > > > are trying to do but 5 small tables might not be necessary.
>
> > > > I would suggest getting some code working with 2 tables an then go from
> > > > there.
>
> > > > Some 
> > > > options:http://web2py.com/book/default/chapter/07#One-form-for-multiple-table...
>
> > > > Another approach would to use FORM or SQLFORM.factory and then coding 
> > > > the
> > > > database updates. You lose some of the Web2py features but it might 
> > > > still be
> > > > the easiest way to do it.
>
> > > > But my first suggestion would be to try and simplify what you are 
> > > > intending
> > > > to do.


[web2py] Error in SQLTABLE in pymysql

2011-05-16 Thread SergeyPo
I get the following error when call SQL table, when I have reference
fields in my data table.
E.g.:

db.define_table('alarms',
SQLField('function_name', 'string', length=64),
SQLField('created_at', 'datetime',
default=datetime.datetime.now()),
SQLField('header', db.headers),
SQLField('time_based', db.time_based, required=False),
SQLField('komment', 'string', length=255),
SQLField('ack_at', 'datetime', default=None, notnull=False),
SQLField('detail', db.details, required=False),
SQLField('investigation', db.investigations),
SQLField('internals', 'text'),
)
alarms_rs = db(eval(terms)).select( orderby=alarms_orderby,
 
limitby=session.alarms_limitby,
)
print alarms_rs #prints query results into console window, no errors
at this point
alarms_tbl = SQLTABLE(alarms_rs,
_class='sortable',
headers=headers_dict,
truncate = 200,
orderby=True)

At this point error occures for the field SQLField('investigation',
db.investigations).
Here is a traceback:


Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 181, in restricted
exec ccode in environment
  File "C:/web2py/applications/advantage/controllers/alarms.py", line
842, in 
  File "C:\web2py\gluon\globals.py", line 133, in 
self._caller = lambda f: f()
  File "C:\web2py\gluon\tools.py", line 2335, in f
return action(*a, **b)
  File "C:/web2py/applications/advantage/controllers/alarms.py", line
137, in alarms_table
orderby=True)
  File "C:\web2py\gluon\sqlhtml.py", line 1366, in __init__
elif linkto and hasattr(field._table,'_primarykey') and fieldname
in field._table._primarykey:
  File "C:\web2py\gluon\dal.py", line 3457, in repr_ref
def repr_ref(id, r=referenced, f=ff): return f(r, id)
  File "C:\web2py\gluon\dal.py", line 3426, in ff
row=r(id)
  File "C:\web2py\gluon\dal.py", line 4387, in __call__
record = self._db(self.id == key).select(limitby=(0,1)).first()
  File "C:\web2py\gluon\dal.py", line 5164, in select
return self.db._adapter.select(self.query,fields,attributes)
  File "C:\web2py\gluon\dal.py", line 1077, in select
rows = response(sql)
  File "C:\web2py\gluon\dal.py", line 1067, in response
self.execute(sql)
  File "C:\web2py\gluon\dal.py", line 1152, in execute
return self.log_execute(*a, **b)
  File "C:\web2py\gluon\dal.py", line 1147, in log_execute
ret = self.cursor.execute(*a,**b)
  File "C:\web2py\gluon\contrib\pymysql\cursors.py", line 108, in
execute
self.errorhandler(self, exc, value)
  File "C:\web2py\gluon\contrib\pymysql\connections.py", line 182, in
defaulterrorhandler
raise Error(errorclass, errorvalue)
Error: (, AssertionError('Protocol
error, expecting EOF',))


I tried to workaround by adding format to 'investigations' table, set
represent=None to fields in question, this won't help. If
db.alarms.investigation field is empty (None) error does not occur.
MySQL console lets me select the record in investigations field, there
are no problems with data.

Looks like pymysql gives so many problems, won't it be better to go
back to dbmysql? pymysql works 20% slower on my PC, application admin
is not working on Windows and Debian installations since web2py
version 1.92 (I reported on this usergroup)... why so many problems
with contrib module?


[web2py] Application design RDBMS vs GAE, future migrations

2011-05-16 Thread Marek Mollin
Hello,

As I have been more and more interested in GAE from app design
perspective. I lurked into the codebase for web2py's gae driver and it
seems to be mapping all the native futures I would like to have ( 'out
of the box without custom queries' ). However I am wondering about the
general experience.

I know google has its up and downs with gae and I know the limitations
it imposes. However I am worried that if I layout my database in non-
rdbms fashion I have to design it with different paradigms in mind.

Problem is what if I find google ineffective. My fears come from lack
of static system, since a lot of the stuff I will be doing within my
app will require file hosting. Have you done anything serious,
designed it to work with gae and then changed your mind and switched
to rdbms.

I know I can change the driver, but its not that simple. Since I will
have data that's heavily denormalized and very redundant. Have you got
any studycase of migrating back and forth?

Also how do you see the scalability of gae from large project
perspective. I am not talking dummy-apps, but have you for instance
developed an app that was designed to work with rdbms and switched to
google and noticed its running much faster...

I am starting a big project, have web2py as my choice (at least now)
and after reading 
http://www.carlosble.com/2010/11/goodbye-google-app-engine-gae/
I am starting to rethink my choices.
Also another thing is lack of merge-join which I find would made life
easier(but I might be wrong? what's the story of implementing
those...?)

Regards,


Re: [web2py] How to apply a layout?

2011-05-16 Thread Vinicius Assef
I saw it many times but I was looking for some "install" or "apply" button.

Thank you, Bruno.

--
Vinicius Assef.



On 5/15/11, Bruno Rocha  wrote:
> Layouts are plugins, un your app click in plugin and choose the file to
> upload.
> Em 15/05/2011 21:31, "Vinicius Assef"  escreveu:
>> Guys, I'm certains this is very basic stuff, but I couldn't find an
>> explanation to apply a layout from www.web2py.com/layouts to my app.
>>
>> I downloaded a file with w2p extension from there and I don't know how
>> to use it.
>>
>> Please, send me a link because the book chapter about it doesn't touch
>> about using a w2p file.
>>
>> Thanks.
>>
>> --
>> Vinicius Assef.
>


[web2py] Re: Case sensitive email register

2011-05-16 Thread Christopher Steel
I think defaulting to case insensitive would be a good idea as well.

For a while I wanted to stick with the specification which calls for
email servers to be case sensitive for email addresses but I think for
practical reasons case insensitive makes a lot of sense where
bob.h...@gmail.com is equivalent to bob.h...@gmail.com.

Actually gmail makes bob.hope@gmail equivalent to bobh...@gmail.com as
well.

C


On May 14, 12:30 am, luis diaz  wrote:
> in the user registration process
> the system take the following email as a user
> different
>
> use...@hotx.com
> use...@hotx.com
>
> this sharing is not to my liking.
>
> I think it would be appropriate to add the email Requires
> IS_LOWER the option ()


[web2py] For interest: Python Requests package - HTTP for humans

2011-05-16 Thread Tom Atkins
http://docs.python-requests.org/en/latest/index.html