Re: [web2py] Re: Dumb syntax error! Can't fix it!

2010-02-04 Thread Thadeus Burgess
OperationalErrors only get raised by the cursor object, meaning there
was an issue at the database level, not the web2py level.

-Thadeus





On Thu, Feb 4, 2010 at 1:03 PM, Jason Brower  wrote:
> Gees thanks, I never thought about that one...
> Password changed, thanks...
> BR,
> Jason Brower
>
> On Thu, 2010-02-04 at 10:48 -0800, mr.freeze wrote:
>> I think 'transaction' is a reserved word. Try changing it to
>> 'transactions'.
>>
>> On Feb 4, 12:35 pm, Jason Brower  wrote:
>> > Prolly obvious, but I can't see it... can you?
>> >
>> >  db.py
>> > 6KViewDownload
>>
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: DAL migration problem

2010-02-04 Thread Thadeus Burgess
Ok I get what you mean on changing sql to SQL. Misunderstanding, I
thought you ment the keyword that was being thrown off.

It will be an immutable array (tuple). The bracket just slipped in there :P

Any ideas you could share on modularizing dal.py that could allow this
to be in another file?

-Thadeus





On Thu, Feb 4, 2010 at 1:00 PM, Jonathan Lundell  wrote:
> On Feb 4, 2010, at 9:02 AM, Thadeus Burgess wrote:
>
>> 1. I do not capitalize name because this is actually what you are
>> attempting to call your column, it could be 'select', 'Select',
>> 'SELect'. It just seemed more logical to display the name that you
>> wrote. Though it can be capitalized. I thought you were referring to
>> the name of the database it was part of.
>
> I'm not sure what you're replying to here. I was suggesting changing the 
> literal string 'sql' to 'SQL'.
>
>>
>> 2. Yes, but then you wouldn't be able to do
>> self._adapter.KEYWORDS_COMMON or db._adapter.KEY I don't see a
>> reason for the following either, adding yet another import to
>> web2py... (though I agree, I don't like how long dal/sql.py is either)
>>
>> # pseudocode
>> class BaseAdapter(..):
>>    KEYWORDS_COMMON = from keywords import KEYWORDS_COMMON
>
> Perhaps the long-term solution is to look at how dal.py could be modularized.
>
>>
>> 3. Good point, I agree, SyntaxError it is.
>>
>> 4. Its no different than the "if if hasattr(self,tablename) or
>> tablename[0] == '_': and if tablename in self.tables: checks that
>> already exist there.
>
> I'm conjecturing that testing against a long mutable array is expensive. I 
> could be wrong, of course.
>
>>
>> 5. You say that you don't want to proliferate more flags into the
>> web2py environment. I ask, how then would you know what database you
>> want to check against?
>
> Ah, I see. No, that's not my point. My point is not proliferation of options 
> in general; it's proliferation of options that need to be changed for 
> production.
>
> It's not that hard to work around, of course; I can always define a global 
> production flag.
>
>>
>> 6. So all in support for target_databases for the name instead of
>> check_reserved?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Dumb syntax error! Can't fix it!

2010-02-04 Thread Thadeus Burgess
mr freeze is right on target :)

transaction is a reserved keyword.

-Thadeus





On Thu, Feb 4, 2010 at 12:49 PM, Jason Brower  wrote:
> Yes of course... (:
> Traceback (most recent call last):
> File "/home/encompass/Programming/Web Pages/2hand/gluon/restricted.py", line 
> 173, in restricted
>    exec ccode in environment
>  File "/home/encompass/Programming/Web 
> Pages/2hand/applications/2hand/models/db.py", line 57, in 
>    SQLField('created', 'datetime', default=now, readable=False))
>  File "/home/encompass/Programming/Web Pages/2hand/gluon/sql.py", line 1252, 
> in define_table
>    t._create(migrate=migrate, fake_migrate=fake_migrate)
>  File "/home/encompass/Programming/Web Pages/2hand/gluon/sql.py", line 1669, 
> in _create
>    self._db._execute(query)
>  File "/home/encompass/Programming/Web Pages/2hand/gluon/sql.py", line 890, 
> in 
>    self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
> OperationalError: near "transaction": syntax error
> On Thu, 2010-02-04 at 12:41 -0600, Thadeus Burgess wrote:
>> A traceback might help :)
>>
>> -Thadeus
>>
>>
>>
>>
>>
>> On Thu, Feb 4, 2010 at 12:35 PM, Jason Brower  wrote:
>> > Prolly obvious, but I can't see it... can you?
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "web2py-users" group.
>> > To post to this group, send email to web...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > web2py+unsubscr...@googlegroups.com.
>> > For more options, visit this group at 
>> > http://groups.google.com/group/web2py?hl=en.
>> >
>> >
>>
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Dumb syntax error! Can't fix it!

2010-02-04 Thread Thadeus Burgess
And thank you for your email password.

-Thadeus





On Thu, Feb 4, 2010 at 12:41 PM, Thadeus Burgess  wrote:
> A traceback might help :)
>
> -Thadeus
>
>
>
>
>
> On Thu, Feb 4, 2010 at 12:35 PM, Jason Brower  wrote:
>> Prolly obvious, but I can't see it... can you?
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To post to this group, send email to web...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/web2py?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Dumb syntax error! Can't fix it!

2010-02-04 Thread Thadeus Burgess
A traceback might help :)

-Thadeus





On Thu, Feb 4, 2010 at 12:35 PM, Jason Brower  wrote:
> Prolly obvious, but I can't see it... can you?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] csv export/import oddities

2010-02-04 Thread Thadeus Burgess
The issue is when you export the entire web2py database. It exports it
into a "meta" csv file.

So its csv, but it has web2py generated metadata about what goes
where, try opening your exported csv file in a text editor and you
will see what I mean.

This is why when you open in excel, it is unable to import back into web2py.

You have two options, export each table separately/import separately,
or chop up your db export into little files, edit them, then join it
back together to re import.

-Thadeus





On Thu, Feb 4, 2010 at 12:30 PM, Miguel  wrote:
> Hi
>
> I am running into weird issues with the csv import/export of the db.
>
> To start I use the following code to check the "dialect" of the csv
> files:
> import csv
>
> def DisplayDialect(file):
>    csvfile = open(file)
>    smple = csvfile.read()
>    dialect = csv.Sniffer().sniff(smple)
>
>    print " Delimiter :" + str(dialect.delimiter)
>    print " Doublequote : "+ str(dialect.doublequote)
>    print " Escapechar :" + str(dialect.escapechar)
>    print " LineTerminator :" + str(dialect.lineterminator)
>    print " Quotechar :" + str(dialect.quotechar)
>    print " quoting :" + str(dialect.quoting)
>    print " skipinitialspace :" + str(dialect.skipinitialspace)
>
>
> Here is what happens:
>
> CASE A:
> - Export the entire db to csv
> - The csv.sniffer generates an exception "Could not determine
> delimiter"
> - However I can import the file back in web2py
>
> CASE B:
> - Export the entire db to csv
> - Open the excel
> - The csv.sniffer can recognize the format
> - However I CANNOT import the file back in web2py
>
>
> Any suggestions here? This makes it impossible for me to add testing
> data in excel and import it back into web2py.
>
> Thanks
> Miguel
> If I export my entire DB and then I try to check the format with
> csv.sniffer using the following cod
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: The state of the wiki and documentation in general

2010-02-04 Thread Thadeus Burgess
We need two sets of documentation.

Community documentation, for those who use web2py

Developer documentation, for those who contribute to web2py.

As far as developer documentation, I would be happy with lots of
comments in the code. At the very least 25% of the lines should become
meaningful comments!

For community documentation, at least
http://docs.djangoproject.com/en/1.1/ got something right :)

-Thadeus





On Thu, Feb 4, 2010 at 11:18 AM, DenesL  wrote:
>
> First of all you can't just replicate the pdf book, only the code
> examples.
> Second, sales revenue is not an objective.
>
> The effort of webtopy is to unify scattered docs.
> An online version of documentation is not a bad idea, it allows timely
> update so it is always current (ala other doc wikis).
> Documentation by users for users.
>
>
> On Feb 4, 11:57 am, tiago almeida  wrote:
>> Why go through all this effort to just replicate what's already available in
>> the PDF, to an html format?
>>
>> What a website can give, and a book can't, is tutorials, short tips, FAQs,
>> discussions etc. Something the wiki could provide if it were open to public
>> editing (or the newly createdhttp://webtopy.org/community/if it gets
>> comunity support).
>>
>> An online version of the book is, to me, just a bad idea: it won't give any
>> extra benefit in relation to the pdf and it will negatively affect the book
>> sales (which might be important).
>>
>> Just my 2 cent.
>> Best Regards,
>> Tiago
>> --
>>
>> On Thu, Feb 4, 2010 at 4:39 PM, villas  wrote:
>> > On Feb 3, 8:58 pm, mdipierro  wrote:
>> > > Denes is right.
>>
>> > Hi Massimo,
>> > Well,  more specifically then:
>>
>> > 1. Do you agree that it's a good idea to use the current book to make
>> > an online book?  If not, let's forget it.
>>
>> > 2. Do you have an opinion on what form the online book should take?
>> > e.g. Djanjo, Cakephp, Php.net manual with comments...
>>
>> > 3. Income. Will the online book project negatively affects the income
>> > from the book. To make sure that this does not lead to a problem,  I
>> > propose that you make a suggestion as to how this may be compensated.
>> > I suggest alternatives might include adsense,  a subscription model,
>> > and donations, etc for access to all the update notes.  Of course,
>> > even If the online book became the main place for the documentation to
>> > be updated,  you could still sell the paper version. This would be
>> > something for you to decide / accept.
>>
>> > 4. What format should we use for the text?  (Markdown, please?)
>>
>> > 5 .It is important for the domain to belong to Web2py/Massimo.  May I
>> > suggest book.web2py.com?
>>
>> > 6. No one will take the online book project seriously unless we also
>> > think about the roles we would need to fill. There are people in this
>> > community with much greater project expertise than I,  so please feel
>> > free to dismiss the following.  I am only making suggestions. e.g.
>> > - Model Designer.  It is crucial that the data is saved in the most
>> > logical way for the future.  This shouldn't be trusted to someone like
>> > me!  I vote for you (Massimo),  if you have time.  Part of my
>> > reasoning is that you know how to design a workable versioning
>> > system :-)
>> > - Project Manager.  Allocate tasks (and fire people!),  supervise,
>> > coordinate timeline.
>> > - Programmers for controllers and views.  Maybe split this into two:
>> > Admin and Enduser.
>> > - Html, CSS and JQuery effects (optional extra, can come later)
>> > - Data Loaders to copy and paste the sections of the book.  I think
>> > I'd be good at this one,  if the project manager would have me!
>>
>> > Sorry to ask/make these specific questions/suggestions,  but without
>> > your support (Massimo),  let's be realistic,  a community effort to
>> > produce and support the online book project probably isn't going to
>> > happen.
>>
>> > Thanks for listening.
>> > --D
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups
>> > "web2py-users" group.
>> > To post to this group, send email to web...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > web2py+unsubscr...@googlegroups.com
>> > .
>> > For more options, visit this group at
>> >http://groups.google.com/group/web2py?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=e

Re: [web2py] Re: The state of the wiki and documentation in general

2010-02-04 Thread Thadeus Burgess
> ... tutorials, short tips, FAQs, discussions 

Search. The number one key feature is the ability to have intelligent search.

I don't think we need an online book (bad idea). I think we need
something more along the lines of like the django documentation.

A 4 to 5 part tutorial that gets you ready to use web2py in a few
hours, taking you through step by step through installation and
development line by line explaining what everything is doing in great
detail. At the end of the tutorial you have a working application,
like a pastebin or something.

Then detail sections that drill down web2py and break it up between
each of its layers. Sections explaining all of the features and
neuances of web2py. Other sections that refer to common use cases,
such as "Working with AJAX, json objects" that have everything you
would need to know using ajax/json with web2py.

Then we having the mailing list for discussions, alterego for faq,
web2pyslices for short tips.

We're just missing a real "walkthrough" and a real "indepth look" of web2py

-Thadeus





On Thu, Feb 4, 2010 at 10:57 AM, tiago almeida
 wrote:
> Why go through all this effort to just replicate what's already available in
> the PDF, to an html format?
>
> What a website can give, and a book can't, is tutorials, short tips, FAQs,
> discussions etc. Something the wiki could provide if it were open to public
> editing (or the newly created http://webtopy.org/community/ if it gets
> comunity support).
>
> An online version of the book is, to me, just a bad idea: it won't give any
> extra benefit in relation to the pdf and it will negatively affect the book
> sales (which might be important).
>
> Just my 2 cent.
> Best Regards,
> Tiago
> --
>
> On Thu, Feb 4, 2010 at 4:39 PM, villas  wrote:
>>
>> On Feb 3, 8:58 pm, mdipierro  wrote:
>> > Denes is right.
>>
>> Hi Massimo,
>> Well,  more specifically then:
>>
>> 1. Do you agree that it's a good idea to use the current book to make
>> an online book?  If not, let's forget it.
>>
>> 2. Do you have an opinion on what form the online book should take?
>> e.g. Djanjo, Cakephp, Php.net manual with comments...
>>
>> 3. Income. Will the online book project negatively affects the income
>> from the book. To make sure that this does not lead to a problem,  I
>> propose that you make a suggestion as to how this may be compensated.
>> I suggest alternatives might include adsense,  a subscription model,
>> and donations, etc for access to all the update notes.  Of course,
>> even If the online book became the main place for the documentation to
>> be updated,  you could still sell the paper version. This would be
>> something for you to decide / accept.
>>
>> 4. What format should we use for the text?  (Markdown, please?)
>>
>> 5 .It is important for the domain to belong to Web2py/Massimo.  May I
>> suggest book.web2py.com?
>>
>> 6. No one will take the online book project seriously unless we also
>> think about the roles we would need to fill. There are people in this
>> community with much greater project expertise than I,  so please feel
>> free to dismiss the following.  I am only making suggestions. e.g.
>> - Model Designer.  It is crucial that the data is saved in the most
>> logical way for the future.  This shouldn't be trusted to someone like
>> me!  I vote for you (Massimo),  if you have time.  Part of my
>> reasoning is that you know how to design a workable versioning
>> system :-)
>> - Project Manager.  Allocate tasks (and fire people!),  supervise,
>> coordinate timeline.
>> - Programmers for controllers and views.  Maybe split this into two:
>> Admin and Enduser.
>> - Html, CSS and JQuery effects (optional extra, can come later)
>> - Data Loaders to copy and paste the sections of the book.  I think
>> I'd be good at this one,  if the project manager would have me!
>>
>> Sorry to ask/make these specific questions/suggestions,  but without
>> your support (Massimo),  let's be realistic,  a community effort to
>> produce and support the online book project probably isn't going to
>> happen.
>>
>> Thanks for listening.
>> --D
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To post to this group, send email to web...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/web2py?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this gr

Re: [web2py] Re: DAL migration problem

2010-02-04 Thread Thadeus Burgess
1. I do not capitalize name because this is actually what you are
attempting to call your column, it could be 'select', 'Select',
'SELect'. It just seemed more logical to display the name that you
wrote. Though it can be capitalized. I thought you were referring to
the name of the database it was part of.

2. Yes, but then you wouldn't be able to do
self._adapter.KEYWORDS_COMMON or db._adapter.KEY I don't see a
reason for the following either, adding yet another import to
web2py... (though I agree, I don't like how long dal/sql.py is either)

# pseudocode
class BaseAdapter(..):
KEYWORDS_COMMON = from keywords import KEYWORDS_COMMON

3. Good point, I agree, SyntaxError it is.

4. Its no different than the "if if hasattr(self,tablename) or
tablename[0] == '_': and if tablename in self.tables: checks that
already exist there.

5. You say that you don't want to proliferate more flags into the
web2py environment. I ask, how then would you know what database you
want to check against?

6. So all in support for target_databases for the name instead of
check_reserved?

-Thadeus





On Thu, Feb 4, 2010 at 10:37 AM, Jonathan Lundell  wrote:
> ery request. (BTW, if I'm developing through the GUI, where do I see the pri

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: format zero IS_IN_DB

2010-02-04 Thread Thadeus Burgess
This is a difficult to decide. For me it is both ways. Since half of
my forms require zero=None and the other half require zero='', either
way it goes there will be no option that is more "convenient" for my
development.

I stand in support of zero=None. Web2py is a data/business logic
oriented framework. Therefore it should default to what is most
natural from the database point of view. It is also the original look
and feel of these form elements, so it is also keeping things the same
as they used to be.

off-topic answer:

SQLFORM(db.mytable, my_records_id)
or
crud.update(db.mytable, my_recofds_id)


-Thadeus





On Thu, Feb 4, 2010 at 9:59 AM, Jonathan Lundell  wrote:
> On Feb 4, 2010, at 7:34 AM, mdipierro wrote:
>
>> Mind that currently zero='' should be interpreted as zero='(please
>> choose a value)'. the value '' is not in the db and will not pass
>> validation. It s just a place holder. Only if
>> IS_NULL_OR(IS_IN_DB(...zero='')) then the value '' can pass
>> validation.
>
> Right, and it's a very useful mode. I think I see (vaguely) the source of the 
> tension.
>
> zero='' is the most natural behavior for many (most?) forms, from a UI logic 
> point of view.
>
> zero=None is the most natural logic from the POV of data access: it gives us 
> the list that actually is in the set/db, and nothing more.
>
> I don't think that either flavor of naturalness is "most natural". Which is 
> why I don't care that much how it goes; I'll probably adopt a practice of 
> coding it explicitly regardless. So you can count me as neutral if you like.
>
> BTW, an off-topic question: is there a straightforward way to prepopulate a 
> form with an existing database row? I know, I should RTFM
>
>>
>> On Feb 4, 9:25 am, Jonathan Lundell  wrote:
>>> On Feb 4, 2010, at 7:08 AM, mdipierro wrote:
>>>
 I do not really have an opinion on this. I am only reluctant to
 changes in behavior.
 Anyway, I am prepared to make this change (zero=None by default). I
 would like to know that all major contributors are on board so that
 you can answer the emails when users complain instead of me. ;-)
>>>
 Anybody who has an opinion about this should post here or email me
 personally.
>>>
>>> I prefer zero=None as the default, on the grounds that it seems more 
>>> logical for the default case to not include items that aren't actually in 
>>> the database. Least surprise.
>>>
>>> OTOH, it's not a high priority for me, since it's easy enough to override 
>>> either way.
>>>
>>>
>>>
 Executive Summery:
>>>
 There is a proposal to default IS_IN_SET(zero=None) and
 IS_IN_DB(zero=None) so that dropdown select option NO LONGER will have
 a default black option. Currently, by default, when you create a new
 record the blank option is selected and, if you do not change it and
 if you do not allow IS_NULL, you get an error message. With the
 proposed change, when you create a new record all select/options will
 - by default - select the first alphabetical value unless you change
 it.
>>>
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To post to this group, send email to web...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/web2py?hl=en.
>>
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Changing redirect for @auth.requires_login()

2010-02-04 Thread Thadeus Burgess
yes but it wont. the redirect is bug since it creates the strings when
you instantiate the Auth class, the urls set in stone.

So

>>>auth = Auth(globals())

>>>auth.settings.controller = 'myauth'

>>>print auth.settings.login_next
'/init/default/index'

-Thadeus





On Wed, Feb 3, 2010 at 9:06 PM, weheh  wrote:
> I think what everyone's trying to say is that if you don't set
> auth.settings.login_next then by default, the redirect after login
> will be to the decorated controller that sent you to login to begin
> with. So make sure there is no auth.settings.login_next in your model
> file (db.py).
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: DAL migration problem

2010-02-04 Thread Thadeus Burgess
> * Could we use 'check_reserved' instead of 'check_reserve'? It sounds more 
> natural to me.

Why not.

>
> * Capitalize SQL in the error message strings

It is capitalized.

>
> * dal.py is already much too long. Could the wordlists live somewhere else?

No, they belong with their relative adapters. Object Oriented devel at its best.

>
> * Is 'print' the most appropriate way to show the warning message? How about 
> at least sending it to stderr, or see the next point:
>
> * I don't entirely get the rationale for the distinction between the warning 
> message and raising a syntax error, at least not based on the selected list. 
> Since this is intended for development, not production, why not just make it 
> a syntax error and > be done with it? Or if it's important, make it a 
> separate option.
>

here is my rational. the reason for displaying an error is because the
KEYWORDS_ALL contains all known sql keywords. Therefore it contains
keywords that might not necessarily effect your deployment, so it
shouldn't stop the software from running, but at least log a warning
letting you know so that you can change it if you want. Sure we can
print to stderr. KEYWORDS_ALL is a placeholder until we devote the
time to creating adapter specific lists. In fact once each adapter has
their own list KEYWORDS_ALL probably won't exist any more, and the
`all` option will use a union of all the lists.

You said it yourself, you don't want more proliferating flags, so no
separate option. However if anyone else has an opinion on the matter?

>
> * I remain uneasy about the idea of doing this on every call (vs calls that 
> make actual changes in the db). I don't know what the performance overhead is 
> of the lookup (I suspect that frozenset would be faster--at the very least 
> something immutable), so maybe it's a non-concern. I'm also uneasy about 
> proliferating flags that you have to remember to turn off for production; 
> it's too easy to forget about once it's working.

I don't understand what you are so concerned about the performance
overhead (like a fraction of a fraction of a fraction of a tiny
fraction of a nanosecond that it takes?)

Let me qoute you again "Since this is intended for development, not
production..."

...I made my case, as long as check_reserved is set to None it won't
do the check. (None is the default)

And about the flags... you have to change many other options when
moving into deployment (such as db connection string to the DAL...
which ill be damned if its not in the same constructor as this flag).

So let me get this straight, you want the option to target multiple
database types that YOU want... but what..., web2py is supposed to
play God and read your mind? How else would web2py determine what
target backends you are looking for.

Then you raise a good point, there is no sense in adding a flag just
for one option, perhaps a better name such as ``target_adapters=[]``
instead of check_reserve. That way the list could be used for multiple
purposes that might arise in the future. such as higher compatibility
layers that check joins vs. pagination etc.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: making changes in web2py

2010-02-03 Thread Thadeus Burgess
-1 for admin username
+1 for anti-brute-forcing. If incorrect password typed 3 times, ban
the IP permanently until you log into ssh and edit a pickled file.

-Thadeus





On Wed, Feb 3, 2010 at 7:07 PM, mdipierro  wrote:
> I am confused. appadmin does not requires any. appadmin, by default,
> required admin (perhaps you refer to that). appadmin predates auth. If
> your app needs a more complex appadmin authentication you should
> connect to the auth of the app.
>
> admin does not no need more than a passoword because there is a single
> user (administrator) and because it should not relay on the presence
> of a database.
>
> On Feb 3, 3:22 pm, Wes James  wrote:
>> On Wed, Feb 3, 2010 at 1:48 PM, mdipierro  wrote:
>>
>> 
>>
>>
>>
>> >> By the way  Massimo, will you take a patch to add a username to
>> >> appadmin?  If not, I'm learning a few things on the way, anyway.
>>
>> > please explain more.
>>
>> appadmin only uses a password to login.  I'm putting in a username too
>> so it requires a username and password to log in to appadmin.
>>
>> 
>>
>> -wes
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] disable remember me

2010-02-03 Thread Thadeus Burgess
Cool, must have missed that one.

In my environment I have absolutely no need for remember me on our
app, In fact remember me would be a disaster to the internal
application.

Thanks.

-Thadeus





On Wed, Feb 3, 2010 at 5:40 PM, Wes James  wrote:
> This is in tools.py
>
> self.settings.remember_me_form = True
>
> -wes
>
> On Wed, Feb 3, 2010 at 4:39 PM, Wes James  wrote:
>> or have an option in db.py:
>>
>> auth.settings.remember_me=(True|False)
>>
>> On Wed, Feb 3, 2010 at 3:07 PM, Thadeus Burgess  
>> wrote:
>>> -Thadeus
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "web2py-users" group.
>>> To post to this group, send email to web...@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> web2py+unsubscr...@googlegroups.com.
>>> For more options, visit this group at 
>>> http://groups.google.com/group/web2py?hl=en.
>>>
>>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] disable remember me

2010-02-03 Thread Thadeus Burgess
-Thadeus

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: DAL migration problem

2010-02-03 Thread Thadeus Burgess
I know I didn't put one there.

sql.py is way to spaghetti and will take longer than I have available
to make it work for sql.py.

When will we be able to use the new dal?

-Thadeus





On Wed, Feb 3, 2010 at 2:46 PM, mdipierro  wrote:
> There is no check_reserved in gluon/sql.py.
>
> On Feb 3, 12:33 pm, Thadeus Burgess  wrote:
>> A) Bring home the bacon !
>>
>> B) Every time unless you set check_reserve to None. In production you
>> would have check_reserve to None.
>>
>> C) It should be a union, and that is exactly what its documentation I
>> added says. But we can't do a union until we actually create database
>> specific keywords until then ALL will have to suffice.
>>
>> -Thadeus
>>
>> On Wed, Feb 3, 2010 at 12:27 PM, Jonathan Lundell  wrote:
>> > On Feb 3, 2010, at 9:43 AM, Thadeus Burgess wrote:
>>
>> >> Ok take a look at the following proposed changes
>>
>> > I'll try to look at it later today; I'm off to work now.
>>
>> > Is the check made every time, or only when a table is actually being 
>> > created (or migrated)? The latter should be adequate, at least by default, 
>> > and would have less impact on performance.
>>
>> > A side thought: the lists probably ought to be frozensets, not arrays, for 
>> > performance. And KEYWORDS_ALL ought to be a union (calculated once) of the 
>> > other sets.
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "web2py-users" group.
>> > To post to this group, send email to web...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > web2py+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/web2py?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] IS_IN_SET multiple=True with non-ASCII character failed

2010-02-03 Thread Thadeus Burgess
Try assigning them unique ID's instead of the string.

IS_IN_SET((1, 2, 3, 4), (option a, option b, option c, option d), multiple=True)

-Thadeus





On Wed, Feb 3, 2010 at 2:03 PM, szimszon  wrote:
> IS_IN_SET(['Új', 'Beépítve', 'Eladva', 'Használt','Selejtezve',
> 'Cseredarab', 'Bérben', 'Hibás'],multiple=True)
>
> If I select "Új" I get: value not allowed
> If I select "Selejtezve" it's OK.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: The state of the wiki and documentation in general

2010-02-03 Thread Thadeus Burgess
There is no case. We all agree.

Now who is actually going to DO it ?

I can't. I work, sleep, and sometimes if I have time eat. Then I work
some more. My company is not going to pay me to write web2py
documentation.

And as my comment earlier wasn't just to be funny it is serious. Do
you have time to devote to creating an online documentation book for
web2py? If you do then by all means we're not stopping you!

-Thadeus





On Wed, Feb 3, 2010 at 1:14 PM, villas  wrote:
> I think that Cakephp also has a very good online book:  
> http://book.cakephp.org.
> I notice these days that they are also raising some revenue with
> adsense,  which might work well.
>
> However, people like me would also be willing to pay a subscription to
> access a more up to date online book. Goodness me, the book is only 12
> dollars or something, that's 1 dollar per month. How many hours do I
> waste searching for answers and then have to waste someone else's time
> by asking on the list?  That's a terrible cost to the community.
>
> Ironically,  whilst Web2py enables us to fully embrace the most
> efficient publishing technology that the world has ever seen,  we wait
> for an entire year between updates on the main documentation.
>
> Wouldn't it be a great benefit if all that wonderful assistance given
> on the group list, plus the errata, can be continually incorporated
> into the book. Making happier users, a less busy list, and our top
> development guru freer to put his brilliant ideas into action.  We
> simply need an online book. I rest my case :-)
>
> --David
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: DAL migration problem

2010-02-03 Thread Thadeus Burgess
A) Bring home the bacon !

B) Every time unless you set check_reserve to None. In production you
would have check_reserve to None.

C) It should be a union, and that is exactly what its documentation I
added says. But we can't do a union until we actually create database
specific keywords until then ALL will have to suffice.

-Thadeus





On Wed, Feb 3, 2010 at 12:27 PM, Jonathan Lundell  wrote:
> On Feb 3, 2010, at 9:43 AM, Thadeus Burgess wrote:
>
>> Ok take a look at the following proposed changes
>
> I'll try to look at it later today; I'm off to work now.
>
> Is the check made every time, or only when a table is actually being created 
> (or migrated)? The latter should be adequate, at least by default, and would 
> have less impact on performance.
>
> A side thought: the lists probably ought to be frozensets, not arrays, for 
> performance. And KEYWORDS_ALL ought to be a union (calculated once) of the 
> other sets.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: DAL migration problem

2010-02-03 Thread Thadeus Burgess
As an added note, I could use some help in creating the database
specific keywords lists.

-Thadeus





On Wed, Feb 3, 2010 at 11:43 AM, Thadeus Burgess  wrote:
> Ok take a look at the following proposed changes
>
> http://code.google.com/r/thadeusburgess-web2py/source/detail?r=c416459252755abde998e923021188335924e02c
>
> I made it DRY. Also you pass a list of options. Here is example usage
>
> db = DAL('sqlite', pool_size, check_reserve=['common',
> 'postgres', 'mysql'])
>
> check_reserve is a list of backends to use, with two extra terms 'all'
> and 'common'. It defaults to None, which performs no check.
>
> If you set common, it will check the KEYWORDS_COMMON list, and throw a
> SyntaxError.
>
> If you set all, it will check the KEYWORDS_ALL list, and print a
> warning message.
>
> If you set an adapter name, it will check the adapters KEYWORDS and
> throw a SyntaxError.
>
> This only effects the new dal, (dal.py) since i do not have time to
> implement this for sql.py.
>
>
> As Jonathan Lundell suggests in his mercurial post, you can code
> review this change. Once we are happy, Massimo can pull the changes
> in.
>
> -Thadeus
>
>
>
>
>
> On Tue, Feb 2, 2010 at 4:44 PM, Richard  wrote:
>> This is awesome - thanks Thadeus!
>> I develop with sqlite but deploy on postgres/GAE and almost always get
>> caught by this.
>>
>>
>>
>> On Feb 3, 9:10 am, Jonathan Lundell  wrote:
>>> On Feb 2, 2010, at 1:19 PM, Thadeus Burgess wrote:
>>>
>>> > 1. Its only in two places. Once for tablename, and once for fieldname.
>>> > And then this needs to be done for sql.py just in case
>>>
>>> DRY
>>>
>>>
>>>
>>> > 2. Yes very chatty. What about the following?
>>>
>>> > DAL('sqlite', pool_size=1, check_reserve=None)
>>> > DAL('sqlite', pool_size=1, check_reserve='common')
>>> > DAL('sqlite', pool_size=1, check_reserve='all')
>>> > DAL('sqlite', pool_size=1, check_reserve='postgres')
>>> > DAL('sqlite', pool_size=1, check_reserve='mssql')
>>>
>>> > This way we can define the level of check. Then the check will be
>>> > placed in a function of db. db._verify_reserved_keyword(keyword) which
>>> > will perform the checks based on the self.check_reserve.
>>> > None would be no name checking, to keep backwards compatibility and
>>> > for production systems. comments?
>>>
>>> Makes sense. How about accepting a list?
>>>
>>>
>>>
>>> > 3. How is it ambiguous, you hit the definition right on target. Its
>>> > common SQL commands that without these commands you don't have SQL,
>>> > and if you use one of these terms in the current system you get an
>>> > OperationalError anyways.
>>>
>>> OK...
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To post to this group, send email to web...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/web2py?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: DAL migration problem

2010-02-03 Thread Thadeus Burgess
Ok take a look at the following proposed changes

http://code.google.com/r/thadeusburgess-web2py/source/detail?r=c416459252755abde998e923021188335924e02c

I made it DRY. Also you pass a list of options. Here is example usage

db = DAL('sqlite', pool_size, check_reserve=['common',
'postgres', 'mysql'])

check_reserve is a list of backends to use, with two extra terms 'all'
and 'common'. It defaults to None, which performs no check.

If you set common, it will check the KEYWORDS_COMMON list, and throw a
SyntaxError.

If you set all, it will check the KEYWORDS_ALL list, and print a
warning message.

If you set an adapter name, it will check the adapters KEYWORDS and
throw a SyntaxError.

This only effects the new dal, (dal.py) since i do not have time to
implement this for sql.py.


As Jonathan Lundell suggests in his mercurial post, you can code
review this change. Once we are happy, Massimo can pull the changes
in.

-Thadeus





On Tue, Feb 2, 2010 at 4:44 PM, Richard  wrote:
> This is awesome - thanks Thadeus!
> I develop with sqlite but deploy on postgres/GAE and almost always get
> caught by this.
>
>
>
> On Feb 3, 9:10 am, Jonathan Lundell  wrote:
>> On Feb 2, 2010, at 1:19 PM, Thadeus Burgess wrote:
>>
>> > 1. Its only in two places. Once for tablename, and once for fieldname.
>> > And then this needs to be done for sql.py just in case
>>
>> DRY
>>
>>
>>
>> > 2. Yes very chatty. What about the following?
>>
>> > DAL('sqlite', pool_size=1, check_reserve=None)
>> > DAL('sqlite', pool_size=1, check_reserve='common')
>> > DAL('sqlite', pool_size=1, check_reserve='all')
>> > DAL('sqlite', pool_size=1, check_reserve='postgres')
>> > DAL('sqlite', pool_size=1, check_reserve='mssql')
>>
>> > This way we can define the level of check. Then the check will be
>> > placed in a function of db. db._verify_reserved_keyword(keyword) which
>> > will perform the checks based on the self.check_reserve.
>> > None would be no name checking, to keep backwards compatibility and
>> > for production systems. comments?
>>
>> Makes sense. How about accepting a list?
>>
>>
>>
>> > 3. How is it ambiguous, you hit the definition right on target. Its
>> > common SQL commands that without these commands you don't have SQL,
>> > and if you use one of these terms in the current system you get an
>> > OperationalError anyways.
>>
>> OK...
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] making changes in web2py

2010-02-03 Thread Thadeus Burgess
Massimo seems to prefer emailing patches rather than pulling from our
cloned repositories. Since he wants exact specific control over what
gets pulled in. Kind of like "quality control" until he trusts the
developer I suppose :) Linus Torvalds also prefers this approach of
diffs instead of clones for these very same reasons, so its
understandable. Web2py is his baby and nothing should come to harm it
:)

-Thadeus





On Wed, Feb 3, 2010 at 11:29 AM, Jonathan Lundell  wrote:
> ssimo pulls the change from that repository, rather than our having to try to 
> pass around patches by em

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] making changes in web2py

2010-02-03 Thread Thadeus Burgess
What is wrong with http://mercurial.selenic.com/guide/

There is nothing special about hg+web2py together.

-Thadeus





On Wed, Feb 3, 2010 at 11:13 AM, Jonathan Lundell  wrote:
> On Feb 3, 2010, at 9:09 AM, Thadeus Burgess wrote:
>
>> if you already have a clone, make your changes, then commit them to
>> your local copy.
>>
>> When you want updates do
>>
>> hg pull web2py && hg merge
>>
>> It should update and leave your changes, unless there is a conflict
>> which you will need a program such as "MELD" to solve.
>
> It'd be nice to have a slice or wiki page or something on hg+web2py. 
> Commands, workflow, hints--since most of us are relatively new to hg. 
> Ideally, not just the commands, but some explanation of what's going on.
>
>
>>
>> -Thadeus
>>
>>
>>
>>
>>
>> On Wed, Feb 3, 2010 at 11:02 AM, Wes James  wrote:
>>> Say I do:
>>>
>>> hg clone web2py
>>>
>>> I make changes to the code, then later another update comes out for
>>> web2py and I want my changes added to the update.  Can someone help me
>>> with this process?
>>>
>>> thx,
>>>
>>> -wes
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] making changes in web2py

2010-02-03 Thread Thadeus Burgess
if you already have a clone, make your changes, then commit them to
your local copy.

When you want updates do

hg pull web2py && hg merge

It should update and leave your changes, unless there is a conflict
which you will need a program such as "MELD" to solve.

-Thadeus





On Wed, Feb 3, 2010 at 11:02 AM, Wes James  wrote:
> Say I do:
>
> hg clone web2py
>
> I make changes to the code, then later another update comes out for
> web2py and I want my changes added to the update.  Can someone help me
> with this process?
>
> thx,
>
> -wes
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] 1.74.10 is OUT

2010-02-03 Thread Thadeus Burgess
You might want to wait before including patch, since I made some of
the suggested changes last night, we can see how it looks then.

-Thadeus





On Wed, Feb 3, 2010 at 10:40 AM, Thadeus Burgess  wrote:
> It does not look like you included the patch for the reserved keywords?
>
> -Thadeus
>
>
>
>
>
> On Wed, Feb 3, 2010 at 10:22 AM, mdipierro  wrote:
>> fixes a few problems with CRON, typos and check for invalid field and
>> in DB (thanks Thedeus)
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To post to this group, send email to web...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/web2py?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] 1.74.10 is OUT

2010-02-03 Thread Thadeus Burgess
It does not look like you included the patch for the reserved keywords?

-Thadeus





On Wed, Feb 3, 2010 at 10:22 AM, mdipierro  wrote:
> fixes a few problems with CRON, typos and check for invalid field and
> in DB (thanks Thedeus)
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] hg export tip on fresh hg clone

2010-02-02 Thread Thadeus Burgess
The act of exporting a changeset generates an augmented patch file
that describes the change. A Mercurial patch file contains some
metadata and a traditional unified diff.

Once a changeset has been exported from one repository, it can be
imported into another.

The actual command is

hg export 

Where tip can be substituted for the latest commit.

You can read the documentation

http://mercurial.selenic.com/wiki/Export

There are several links to how to use export/import on this page

-Thadeus





On Tue, Feb 2, 2010 at 9:15 PM, Wes James  wrote:
> I just download web2py: hg clone
>
> without doing anything if I do "hg export tip" it shows a diff :
>
> # HG changeset patch
> # User mdipie...@massimo-di-pierros-macbook.local
> # Date 1265154799 21600
> # Node ID a40f484a4627a4d4373ce305d381e97842830148
> # Parent  4e6959c4eaddd53eb314032f741e961a53a50bb8
> fixed typo, thank you Elcio Ferreira
>
> etc.
>
> Is this just a change that Massimo has not committed yet?
>
> thx,
>
> -wes
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: dal.py

2010-02-02 Thread Thadeus Burgess
sql.py is what we are using right now. (1.7*.* branch)

dal.py is a rewrite of sql.py but in a much more modular manner. It
will make adding new database back ends easier, and make the dal much
more maintainable.

-Thadeus





On Tue, Feb 2, 2010 at 6:20 PM, Richard  wrote:
> I'm confused about this - dal2.py is the new version but what is the
> difference between sql.py and dal.py?
>
>
> On Feb 3, 7:05 am, Thadeus Burgess  wrote:
>> belay that :)
>>
>> was using sql.py's Field with dal.py's DAL
>>
>> -Thadeus
>>
>> On Tue, Feb 2, 2010 at 11:53 AM, Thadeus Burgess  
>> wrote:
>> > migrate=True
>>
>> > self.db.define_table('settings',
>> >            Field('key'),
>> >            Field('name'),
>> >            Field('value', 'text'),
>> >            Field('description', 'text'),
>> >            migrate=migrate
>> >        )
>>
>> > First error testing out new dal.py
>>
>> > Traceback (most recent call last):
>> >  File "/home//Applications/web2py/gluon/restricted.py", line 173, in 
>> > restricted
>> >    exec ccode in environment
>> >  File "/home//Applications/web2py/applications//models/common.py",
>> > line 63, in 
>> >    configure = utils.Configure(db, migrate=migrate_db)
>> >  File "/home//Applications/web2py/applications//modules/utils.py",
>> > line 109, in __init__
>> >    self.define_tables(migrate=migrate)
>> >  File "/home//Applications/web2py/applications//modules/utils.py",
>> > line 121, in define_tables
>> >    migrate=migrate
>> >  File "/home//Applications/web2py/gluon/dal.py", line 2556, in define_table
>> >    **dict(primarykey=args.get('primarykey',None)))
>> >  File "/home//Applications/web2py/gluon/dal.py", line 2788, in __init__
>> >    'define_table argument is not a Field: %s' % field
>> > SyntaxError: define_table argument is not a Field: .key
>>
>> > -Thadeus
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Newbie Question: Intellisense for Web2Py?

2010-02-02 Thread Thadeus Burgess
Have you tried it?

-Thadeus





On Tue, Feb 2, 2010 at 4:31 PM, DL  wrote:
> Are you sure?  I thought '__all__' was made for cases like this..
>
> On Jan 21, 7:03 am, Thadeus Burgess  wrote:
>> It is not, it will not pull in the imports of other files.
>>
>> You have to specifically declare all modules that are imported that
>> you want available in the file that you want code completion on.
>>
>> -Thadeus
>>
>>
>>
>> On Wed, Jan 20, 2010 at 3:46 PM, mdipierro  wrote:
>> > I have not tried by perhaps putting
>>
>> > if 0:
>> >   from gluon.tools import *
>> >   from gluon.sqlhtml import *
>> >   from gluon.sql import *
>> >   #...etc etc for every module you want to import
>>
>> > in web2py/w.py
>>
>> > and importing
>>
>> >   from w import *
>>
>> > in very file is a more compact solution.
>>
>> > On Jan 20, 2:26 pm, Thadeus Burgess  wrote:
>> >> To get web2py to work with code completion. This will work with
>> >> eclipse + pydev, or wing IDE, or netbeans + python.
>>
>> >> add this to the top of your file (unfortunately it has to be on every
>> >> file you want code completion).
>>
>> >> if 0:
>> >>    from gluon.tools import *
>> >>    from gluon.sqlhtml import *
>> >>    from gluon.sql import *
>> >>    #...etc etc for every module you want to import
>>
>> >> -Thadeus
>>
>> >> On Wed, Jan 20, 2010 at 9:04 AM, mdipierro  
>> >> wrote:
>> >> > I know Eclipse works with web2py. I do not use it but I think it has
>> >> >intellisense.
>>
>> >> > On Jan 20, 12:24 am, Tweety  wrote:
>> >> >> Hello,
>>
>> >> >> I am a newbie both with web2py, python and computer and web development
>> >> >> in general. I am trying to digest Massimo's book which I bought from
>> >> >> Lulu. I just want to ask anybody if they can suggest an IDE that has
>> >> >>intellisensethat can make learning much more easier for me?
>>
>> >> >> Right now, I am just trying to memorize all the functions and it is
>> >> >> really hard for me :(
>>
>> >> >> I am desperate to learn but am wondering if anybody can suggest an IDE
>> >> >> that can work with web2py that hasintellisense?
>>
>> >> >> I hope someday Web2Py will haveintellisense:)
>>
>> >> >> Thanks 2 you all,
>>
>> >> >> Tweety
>>
>> >> > --
>> >> > You received this message because you are subscribed to the Google 
>> >> > Groups "web2py-users" group.
>> >> > To post to this group, send email to web...@googlegroups.com.
>> >> > To unsubscribe from this group, send email to 
>> >> > web2py+unsubscr...@googlegroups.com.
>> >> > For more options, visit this group 
>> >> > athttp://groups.google.com/group/web2py?hl=en.
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "web2py-users" group.
>> > To post to this group, send email to web...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > web2py+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/web2py?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: DAL migration problem

2010-02-02 Thread Thadeus Burgess
1. Its only in two places. Once for tablename, and once for fieldname.
And then this needs to be done for sql.py just in case

2. Yes very chatty. What about the following?

DAL('sqlite', pool_size=1, check_reserve=None)
DAL('sqlite', pool_size=1, check_reserve='common')
DAL('sqlite', pool_size=1, check_reserve='all')
DAL('sqlite', pool_size=1, check_reserve='postgres')
DAL('sqlite', pool_size=1, check_reserve='mssql')

This way we can define the level of check. Then the check will be
placed in a function of db. db._verify_reserved_keyword(keyword) which
will perform the checks based on the self.check_reserve.
None would be no name checking, to keep backwards compatibility and
for production systems. comments?

3. How is it ambiguous, you hit the definition right on target. Its
common SQL commands that without these commands you don't have SQL,
and if you use one of these terms in the current system you get an
OperationalError anyways.

-Thadeus





On Tue, Feb 2, 2010 at 3:09 PM, Jonathan Lundell  wrote:
> On Feb 2, 2010, at 12:48 PM, Thadeus Burgess wrote:
>
>> You can view a proposed change, I have sent this to Massimo to look at.
>>
>> http://code.google.com/r/thadeusburgess-web2py/source/detail?r=e875496cc5978200fb6c0aa0f85a8df1a945df21
>>
>> I'm not sure what keywords we really want to use or not, but this is a
>> starting point.
>>
>> I added two lists to BaseAdapter global. KEYWORDS_ALL and KEYWORDS_COMMON.
>>
>> My thought is that no tablename or column name should pass through
>> KEYWORDS_COMMON, then KEYWORDS_ALL can be used to check integration
>> with other database types. So if it is in KEYWORDS_ALL just log a
>> warning.
>>
>> Then each adapter will have their own set of reserved words that will
>> be stored in a list named KEYWORDS. So a tablename or column name will
>> fail if it is in either KEYWORDS_COMMON or KEYWORDS, and will send a
>> warning if it is in KEYWORDS_ALL.
>>
>> I think this could go into sql.py as just fail on KEYWORDS_COMMON and
>> warn on KEYWORDS_ALL, and then the new dal will break it down by
>> database specifics.
>>
>> What do you think?
>
> I think it's a pretty good start. A couple of nits, though.
>
> 1. The test ought to be encapsulated somewhere, presumably in dal.py, so 
> you're not repeating the logic so many places.
>
> 2. I'm not so sure about logging a warning; seems like it'd be noisy. Could 
> it maybe be a property of a table that defaults to COMMON but can be set to 
> ALL at table-creation time? Or something like that? I probably don't care 
> about making the test in production, after all.
>
> 3. KEYWORDS_COMMON as a name: I assume you mean "keywords that are commonly 
> reserved"? It also suggests "keywords that are common to all adapters". 
> Regardless, it's ambiguous; at the very least the criteria for inclusion 
> should be documented in comments with the lists.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: DAL migration problem

2010-02-02 Thread Thadeus Burgess
You can view a proposed change, I have sent this to Massimo to look at.

http://code.google.com/r/thadeusburgess-web2py/source/detail?r=e875496cc5978200fb6c0aa0f85a8df1a945df21

I'm not sure what keywords we really want to use or not, but this is a
starting point.

I added two lists to BaseAdapter global. KEYWORDS_ALL and KEYWORDS_COMMON.

My thought is that no tablename or column name should pass through
KEYWORDS_COMMON, then KEYWORDS_ALL can be used to check integration
with other database types. So if it is in KEYWORDS_ALL just log a
warning.

Then each adapter will have their own set of reserved words that will
be stored in a list named KEYWORDS. So a tablename or column name will
fail if it is in either KEYWORDS_COMMON or KEYWORDS, and will send a
warning if it is in KEYWORDS_ALL.

I think this could go into sql.py as just fail on KEYWORDS_COMMON and
warn on KEYWORDS_ALL, and then the new dal will break it down by
database specifics.

What do you think?

It is then just one more step to add to DAL.__init__ a
target_sql_dialect which will use the KEYWORDS of the target adapter
so that you can catch these early on.

I have tested the patch in my system and its actually caught a
handfull of naming no-nos.

-Thadeus





On Tue, Feb 2, 2010 at 2:43 PM, Jonathan Lundell  wrote:
> e check that used the union of all the keywo

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: DAL migration problem

2010-02-02 Thread Thadeus Burgess
just as a note.

"role" is a sql keyword in ansi-sql, it will be a reserved word in the
next version of Transact-SQL/Sql-server, the other databases should be
fine, and is used in auth.

"table_name" is a reserved keyword in postgresql -
http://www.postgresql.org/docs/8.3/static/sql-keywords-appendix.html
other databases seem to be fine.

Hrm... there are lots of "reserved keywords" in postgresql that I have
used for column names. Makes it annoying when something like "key" is
a perfect name for your column but its reserved. Why does it not fail
then?

-Thadeus





On Tue, Feb 2, 2010 at 11:31 AM, Thadeus Burgess  wrote:
> Actually, we can use the Adaptors to hold specific keywords. So in
> DAL.__init__ can have for fields if fieldname in
> self._adapter.KEYWORDS then raise SyntaxError
>
> -Thadeus
>
>
>
>
>
> On Tue, Feb 2, 2010 at 11:28 AM, Thadeus Burgess  
> wrote:
>> Massimo, is there a better place (in dal.py) to place this check. The
>> most logical I see is the Field.__init__ constructor.
>>
>> -Thadeus
>>
>>
>>
>>
>>
>> On Tue, Feb 2, 2010 at 11:27 AM, Thadeus Burgess  
>> wrote:
>>> I am working on this, I am integrating a list of reserved words into
>>> the Field() class.
>>>
>>> For now just the common SQL keywords, which I'm sure can be extended
>>> to include backend-specific keywords.
>>>
>>> -Thadeus
>>>
>>>
>>>
>>>
>>>
>>> On Tue, Feb 2, 2010 at 11:08 AM, baloan  wrote:
>>>> Thanks David for the reference.
>>>>
>>>> Btw, DATE is not marked as a reserved keyword on PostgreSQL and I can
>>>> create DATE columns using SQL or the admin tools (pgadmin).
>>>>
>>>> Consequently I was doubly confused as DATE appears as a web2py
>>>> reserved word to me.
>>>>
>>>> @Massimo: in your leisure time ;-) you may consider to change the
>>>> ProgrammingError exception to give a hint I used a "web2py/SQL
>>>> reserved word".
>>>>
>>>> Regards, Andreas
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google Groups 
>>>> "web2py-users" group.
>>>> To post to this group, send email to web...@googlegroups.com.
>>>> To unsubscribe from this group, send email to 
>>>> web2py+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at 
>>>> http://groups.google.com/group/web2py?hl=en.
>>>>
>>>>
>>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] feature request: appadmin login - add a username

2010-02-02 Thread Thadeus Burgess
The best way is to use mercurial and make a clone of web2py.

Make your changes, and the commit them to your local version.

Then you can run

hg export tip >> /path/to/a/file.diff

That will create your diff file you can send to massimo. Then massimo
can import that file and it will assign you as the author of the patch
when he uses hg import.

-Thadeus





On Tue, Feb 2, 2010 at 2:13 PM, Wes James  wrote:
> I would like to request that a username be added to the appadmin
> login.  It would be nice to have one more layer of security.
>
> Since I'm guessing you will ask for a patch ;)  Will someone
> provide some tips on how to do this?  Do I keep a copy of the original
> py file, make my changes, then run diff on them (what params?) then
> that can create a patch file from the diff?
>
> Thanks,
>
> -wes
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: dal.py

2010-02-02 Thread Thadeus Burgess
belay that :)

was using sql.py's Field with dal.py's DAL

-Thadeus





On Tue, Feb 2, 2010 at 11:53 AM, Thadeus Burgess  wrote:
> migrate=True
>
> self.db.define_table('settings',
>            Field('key'),
>            Field('name'),
>            Field('value', 'text'),
>            Field('description', 'text'),
>            migrate=migrate
>        )
>
> First error testing out new dal.py
>
> Traceback (most recent call last):
>  File "/home//Applications/web2py/gluon/restricted.py", line 173, in 
> restricted
>    exec ccode in environment
>  File "/home//Applications/web2py/applications//models/common.py",
> line 63, in 
>    configure = utils.Configure(db, migrate=migrate_db)
>  File "/home//Applications/web2py/applications//modules/utils.py",
> line 109, in __init__
>    self.define_tables(migrate=migrate)
>  File "/home//Applications/web2py/applications//modules/utils.py",
> line 121, in define_tables
>    migrate=migrate
>  File "/home//Applications/web2py/gluon/dal.py", line 2556, in define_table
>    **dict(primarykey=args.get('primarykey',None)))
>  File "/home//Applications/web2py/gluon/dal.py", line 2788, in __init__
>    'define_table argument is not a Field: %s' % field
> SyntaxError: define_table argument is not a Field: .key
>
> -Thadeus
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] dal.py

2010-02-02 Thread Thadeus Burgess
migrate=True

self.db.define_table('settings',
Field('key'),
Field('name'),
Field('value', 'text'),
Field('description', 'text'),
migrate=migrate
)

First error testing out new dal.py

Traceback (most recent call last):
  File "/home//Applications/web2py/gluon/restricted.py", line 173, in restricted
exec ccode in environment
  File "/home//Applications/web2py/applications//models/common.py",
line 63, in 
configure = utils.Configure(db, migrate=migrate_db)
  File "/home//Applications/web2py/applications//modules/utils.py",
line 109, in __init__
self.define_tables(migrate=migrate)
  File "/home//Applications/web2py/applications//modules/utils.py",
line 121, in define_tables
migrate=migrate
  File "/home//Applications/web2py/gluon/dal.py", line 2556, in define_table
**dict(primarykey=args.get('primarykey',None)))
  File "/home//Applications/web2py/gluon/dal.py", line 2788, in __init__
'define_table argument is not a Field: %s' % field
SyntaxError: define_table argument is not a Field: .key

-Thadeus

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: DAL migration problem

2010-02-02 Thread Thadeus Burgess
Actually, we can use the Adaptors to hold specific keywords. So in
DAL.__init__ can have for fields if fieldname in
self._adapter.KEYWORDS then raise SyntaxError

-Thadeus





On Tue, Feb 2, 2010 at 11:28 AM, Thadeus Burgess  wrote:
> Massimo, is there a better place (in dal.py) to place this check. The
> most logical I see is the Field.__init__ constructor.
>
> -Thadeus
>
>
>
>
>
> On Tue, Feb 2, 2010 at 11:27 AM, Thadeus Burgess  
> wrote:
>> I am working on this, I am integrating a list of reserved words into
>> the Field() class.
>>
>> For now just the common SQL keywords, which I'm sure can be extended
>> to include backend-specific keywords.
>>
>> -Thadeus
>>
>>
>>
>>
>>
>> On Tue, Feb 2, 2010 at 11:08 AM, baloan  wrote:
>>> Thanks David for the reference.
>>>
>>> Btw, DATE is not marked as a reserved keyword on PostgreSQL and I can
>>> create DATE columns using SQL or the admin tools (pgadmin).
>>>
>>> Consequently I was doubly confused as DATE appears as a web2py
>>> reserved word to me.
>>>
>>> @Massimo: in your leisure time ;-) you may consider to change the
>>> ProgrammingError exception to give a hint I used a "web2py/SQL
>>> reserved word".
>>>
>>> Regards, Andreas
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "web2py-users" group.
>>> To post to this group, send email to web...@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> web2py+unsubscr...@googlegroups.com.
>>> For more options, visit this group at 
>>> http://groups.google.com/group/web2py?hl=en.
>>>
>>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: DAL migration problem

2010-02-02 Thread Thadeus Burgess
Massimo, is there a better place (in dal.py) to place this check. The
most logical I see is the Field.__init__ constructor.

-Thadeus





On Tue, Feb 2, 2010 at 11:27 AM, Thadeus Burgess  wrote:
> I am working on this, I am integrating a list of reserved words into
> the Field() class.
>
> For now just the common SQL keywords, which I'm sure can be extended
> to include backend-specific keywords.
>
> -Thadeus
>
>
>
>
>
> On Tue, Feb 2, 2010 at 11:08 AM, baloan  wrote:
>> Thanks David for the reference.
>>
>> Btw, DATE is not marked as a reserved keyword on PostgreSQL and I can
>> create DATE columns using SQL or the admin tools (pgadmin).
>>
>> Consequently I was doubly confused as DATE appears as a web2py
>> reserved word to me.
>>
>> @Massimo: in your leisure time ;-) you may consider to change the
>> ProgrammingError exception to give a hint I used a "web2py/SQL
>> reserved word".
>>
>> Regards, Andreas
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To post to this group, send email to web...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/web2py?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: DAL migration problem

2010-02-02 Thread Thadeus Burgess
I am working on this, I am integrating a list of reserved words into
the Field() class.

For now just the common SQL keywords, which I'm sure can be extended
to include backend-specific keywords.

-Thadeus





On Tue, Feb 2, 2010 at 11:08 AM, baloan  wrote:
> Thanks David for the reference.
>
> Btw, DATE is not marked as a reserved keyword on PostgreSQL and I can
> create DATE columns using SQL or the admin tools (pgadmin).
>
> Consequently I was doubly confused as DATE appears as a web2py
> reserved word to me.
>
> @Massimo: in your leisure time ;-) you may consider to change the
> ProgrammingError exception to give a hint I used a "web2py/SQL
> reserved word".
>
> Regards, Andreas
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Search function

2010-02-02 Thread Thadeus Burgess
Feel free to take a look at

http://code.google.com/p/blogitizor/source/browse/src/controllers/search.py

Note you will see

w = utils.w
ws = utils.ws

They just append wild cards to the variable.

Look in http://code.google.com/p/blogitizor/source/browse/src/modules/utils.py
for these two functions.

-Thadeus





On Tue, Feb 2, 2010 at 8:49 AM, mdipierro  wrote:
> Search is a complex issues how to implement really depends on the type
> of data, size of data and number of users.
>
> A simple minimalist solution is
>
> #view default/index.html
>  type="submit">
> {{=results}}
>
> #controller default.py
> def index():
>    keywords=[]
>    if request.vars.keywords:
>        keywords = [x for x in keywords.split() if len(x)>3]
>    if keywords:
>        query1=reduce(lambda a,b:a|b,[db.table.field1.like('%'+k+'%')
> for k in keywords])
>        query2=reduce(lambda a,b:a|b,[db.table.field1.like('%'+k+'%')
> for k in keywords])
>        results = db(query1|query2).select()
>    else:
>        results = ''
>    return dict(results=results)
>
> On Feb 2, 4:13 am, Al  wrote:
>> I am trying to incorporate a "Search" function into my web2py
>> application. I have found similar thing in the sample appliance such
>> as the KPAX and the C.R.M application, could someone detail how I
>> could copy code from these apps. Is there a way to trace the relevant
>> section of code for the search function (ajax, controllers, views,
>> etc), I have spent the whole day and can't get it to work. I just want
>> to search on two fields - Title and Keywords of a table - a generic
>> search would also be good if the performance is not too bad
>>
>> Al
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: DAL migration problem

2010-02-02 Thread Thadeus Burgess
I see so many of those I would use on a daily basis :(

-Thadeus





On Tue, Feb 2, 2010 at 8:41 AM, villas  wrote:
> I get so frustrated when bitten by the "reserved words" problem.
> Unfortunately so many people only avoid the ones for their own chosen
> database, which is such a shame when it means their code is not
> portable.
>
> Anyway, this checklist is my favourite reference when I have a
> doubt:
> http://drupal.org/node/141051
>
> --David
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: The state of the wiki and documentation in general

2010-02-01 Thread Thadeus Burgess
Because the web2py community is made up of people who use python for
real world work and have real world jobs to make money. Django fanboys
have nothing better to do all day than write docs in their parents
basement:)

-Thadeus





On Mon, Feb 1, 2010 at 6:21 PM, mdipierro  wrote:
> rsonally, I could use help in fixing the docstrings and unittests so
> that documentation would be automatically generated using Sphinx. This
> is the only way to have docs that always up to date. You can use ANY
> text from the book to improve docst

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] compile app error

2010-02-01 Thread Thadeus Burgess
It might be a permission issue. If web2py does not have permissions to
save to the folder it cannot compile.

-Thadeus





On Mon, Feb 1, 2010 at 5:09 PM, Wes James  wrote:
> When I try to compile my app with 1.74.9 I get:
>
> Cannot compile: there are errors in your app. Debug it, correct errors
> and try again.
>
> I've been poking around my app, but haven't come across any errors in
> the code.  Is it possible to put what file the error was in in a later
> version of appamin?
>
> I compiled it under 1.74.8.  Does it need to be uncompiled then
> recompiled for each version?
>
> thx,
>
> -wes
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Extra cron processes under Ubuntu 9.10 and Snow Leopard after upgrade to 1.74.9

2010-02-01 Thread Thadeus Burgess
we might have his admin password, but he doesn't have ssl!! :)

-Thadeus





On Mon, Feb 1, 2010 at 3:57 PM, mdipierro  wrote:
> 173.203.204.205

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Questions on Auth

2010-02-01 Thread Thadeus Burgess
Not necessarily, what if you set session tokens to visitors as well ?
You would not want to clear these out.

Since a session is not tied to auth, a session is tied to the client
visiting the website, you should clear these out manually in your
logout function.

-Thadeus





On Mon, Feb 1, 2010 at 3:38 PM, sveinh  wrote:
> Hi
>
> Thanks for the update.
>
> Regarding 2), I'm not talking about auth-tokens in Session, but
> whatever other tokens the programmer has entered into session. Should
> these not also be cleared?
>
> sveinh
>
> On Feb 1, 8:49 pm, mdipierro  wrote:
>> Entering panic mode!
>>
>> You are correct about 1). There is a major bug in 1.74.8. One line in
>> tools.py appears to be missing. I must have accidentally while
>> applying the "remember me" patch.
>>
>> I have fixed this in trunk. I have posted 1.74.9.
>>
>> !!! EVERYONE PLEASE UPGRADE. THIS IS A MAJOR SECURITY ISSUE !!!
>>
>> 2) is not a problem. That is normal web2py behavior. It recycles the
>> sessions tokens. All auth variables are cleared at logout.
>>
>> Massimo
>>
>> On Feb 1, 1:01 pm, sveinh  wrote:
>>
>> > Hi
>>
>> > I'd like to report two things I have encountered regarding
>> > authentication:
>>
>> > 1) Login with no (or wrong) password
>> > I have made no changes to the source, open the Welcome application,
>> > register a new user, then login. When logging in, I use the same e-
>> > mail as when registering, and password blank.
>>
>> > It logs me in successfully.
>>
>> > Is this a bug?
>>
>> > 2) Session present after logout
>> > I set a session variable while logged in. Log the user out, then in
>> > again, the session variable is still present. I would assume that a
>> > session should be cleared when logging out? Or will the user be
>> > connected to the same session when logging in again before session
>> > timeout?
>>
>> > In advance, thanks!
>>
>> > -sveinh
>>
>> > My runtime env:
>>
>> > Running with Firefox on Ubuntu 9.10 Desktop:
>>
>> > python2.5 web2py.py --nogui
>> > web2py Enterprise Web Framework
>> > Created by Massimo Di Pierro, Copyright 2007-2010
>> > Version 1.74.8 (2010-01-24 16:46:23)
>> > Database drivers available: SQLite3
>> > Starting cron...
>> > choose a password:something
>> > please visit:
>> >        http://127.0.0.1:8000
>> > use "kill -SIGTERM 5364" to shutdown the web2py server
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] EMERGENCY! Major security hole in 1.74.8 fixed in 1.74.9.

2010-02-01 Thread Thadeus Burgess
Does this apply to <= 1.74.7?

-Thadeus





On Mon, Feb 1, 2010 at 1:56 PM, mdipierro  wrote:
> User sveinh has discovered a major security hole in 1.74.8. This is
> really major and you should immediately upgrade to 1.74.9.
>
> I apologize for this.
>
> Massimo
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Copy tables from existing table

2010-02-01 Thread Thadeus Burgess
So if I wanted to copy tables over, but set unique=False

I ended up with the following

audit_table = [copy.copy(f) for f in table]
for i in range(len(audit_table)):
audit_table[i].unique = False

db.define_table(table.table_name + '_auditlog', Audit.audit_template,
*audit_table)

-Thadeus





On Thu, Jan 28, 2010 at 5:52 PM, Thadeus Burgess  wrote:
> Sometimes I think to myself and say, "Why didn't I just try that!"
>
> Thank you, both of you!
>
> -Thadeus
>
>
>
>
>
> On Thu, Jan 28, 2010 at 4:27 PM, mdipierro  wrote:
>> Or
>>
>> db.define_table('newname',db.othertable)
>>
>> On Jan 28, 4:19 pm, DenesL  wrote:
>>> db.define_table('newname',*[f for f in db.table])
>>>
>>> On Jan 28, 2:20 pm, Thadeus Burgess  wrote:
>>>
>>> > Is there a way to iterate through the Field() elements of a table and
>>> > use them to create another similar table ?
>>>
>>> > I'm looking for something like
>>>
>>> > db.define_table('hi', Field('hello'), Field('world'))
>>>
>>> > class Foo()
>>> >    def init(atable):
>>> >       for field in atable:
>>> >          db.define_table(tablename + '_mod', field, field, field,
>>> > Field('bar', 'datetime'))
>>>
>>> > So I would end up with
>>>
>>> > db.hi and db.hi_mod.
>>>
>>> > -Thadeus
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To post to this group, send email to web...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/web2py?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Plugin

2010-02-01 Thread Thadeus Burgess
Create your models/controllers/views/static files etc everything as
you normally would, But append the word "plugin_" in front of it

so

models/plugin_test.py
controllers/plugin_test.py
views/plugin_test/index.html
static/plugin_test/logo.png

But also follow the database/global def namespace convention so

db.define_table('plugin_test_links', Field('link', requires=IS_URL),
Field('time', 'datetime', default=request.now))

def plugin_get_links():
   return db().select(db.plugin_test_links.ALL)

Your plugin will show up as a different section (at the bottom) of
web2py admin, and you can go into it and then click "pack" and it will
make a plugin zipped file that can be unpacked.

-Thadeus





On Mon, Feb 1, 2010 at 11:25 AM, K.R.Arun  wrote:
> Will some one tell me, how to make a plugin?
>
> For example a layout plugin, or an OAuth plugin, or anything like
> that.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Global Variable Available Across Sessions

2010-02-01 Thread Thadeus Burgess
Sounds nasty.

reading from the disk will always be faster than querying that database again.

It seems the following should work for you then?

t=cache.ram('from_sql_server',lambda:cache.disk('from_sql_server',
   lambda:myobject(),time_expire=5),time_expire=5)

This way if its not in ram, it checks the disk, if its not on the
disk, it will query the server (which takes 30 seconds, but then
everything will be cached)

Then if you needed updated data from the database you could
cache.ram.clear() cache.disk.clear()

-Thadeus





On Mon, Feb 1, 2010 at 10:18 AM, Mark Larsen  wrote:
>> Why not use a chained cache.disk inside a cache.ram.
>
> I think I like just using the cache.ram and pre-loading each
> processes.  The structure is large and I'm not sure how reading from
> disk (especially with a fair amount of users) would affect
> performance.  I'm going to have to profile this when I get there.
> Both are good options to try.
>
>> I'm curious, what is the object your trying to cache ? I would think
>> any object that had to persist in a thread-safe way like your
>> requirements should be redesigned and stored in a database.
>
> This data is actually coming from a database.  The problem is it's a
> poorly designed archived away, massive beast running on an antiquated
> server that is slow, slow, and did I mention slow.  Simple selects
> take 30 seconds as opposed to the fractions of seconds they should
> take.  Goods new for me though is I only need to read from this
> database (and it updates very infrequently), so I was going to
> pre-cache the data I need into an object and get it from there.  Note
> that this is not my applications database but is a linked server using
> sql server 2005.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Global Variable Available Across Sessions

2010-02-01 Thread Thadeus Burgess
Why not use a chained cache.disk inside a cache.ram.

This way it caches to both, so if it doesn't have cached in ram, it
can always pull from the disk.

I'm curious, what is the object your trying to cache ? I would think
any object that had to persist in a thread-safe way like your
requirements should be redesigned and stored in a database.

-Thadeus





On Sun, Jan 31, 2010 at 8:09 PM, Mark Larsen  wrote:
>> FWIW, I had good results in a previous project using a recipe from
>> Massimo for a ram cached threadsafe class. I wasn't using Apache,
>> though.
>
> Mike,  that looks really promising.  I imagine I could come up with a
> way to get all the apache processes to cache the same object after the
> server starts.  If I remember correctly about the mod_wsgi and apache,
> I'd have a duplicate object for each process but since I'm only
> interested in reading from it with very infrequent updates to it (and
> ram is cheap), it wouldn't be a big deal.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: A small improvement for the edit interface

2010-01-31 Thread Thadeus Burgess
freeze..

hg export 

so

hg export tip

and then its as easy as a hg import  for massimo.

-Thadeus





On Sun, Jan 31, 2010 at 5:35 PM, mr.freeze  wrote:
> I sent you a new admin/controllers/default.py. I'm not really sure how
> to make a patch with mercurial yet.
>
> On Jan 31, 12:08 pm, mdipierro  wrote:
>> Can you fix it?
>>
>> On Jan 31, 11:19 am, "mr.freeze"  wrote:
>>
>> > It only shows this for me on Windows:
>> > edit views: l, l, l, l
>>
>> > I think it is because of the backslash in the path.
>>
>> > On Jan 31, 11:02 am, mdipierro  wrote:
>>
>> > > BTW. This is in trunk!
>>
>> > > On Jan 31, 10:46 am, Jose  wrote:
>>
>> > > > excellent, thanks
>>
>> > > > jose
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Global Variable Available Across Sessions

2010-01-31 Thread Thadeus Burgess
Use cache.disk and cache your object instance.

-Thadeus





On Sun, Jan 31, 2010 at 5:04 PM, Mark Larsen  wrote:
> I'd like to use a global variable (an instance of an object) that is
> initiated at server start up and that is a available to all
> threads/processes of the application.  Is such a thing possible?
>
> If it matters, I develop using the built-in server and use
> apache2/mod_wsgi in production.
>
> Thanks,
> Mark
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: CMS & content upload

2010-01-31 Thread Thadeus Burgess
also you might want to consider markdown, I am using it on my site for comments.

With the WIKI that is in gluon/contrib/markdown and WMD javascript
editor, with textarea resize it makes a great combo.

Do take a look at blogitizor for how this is implemented.

-Thadeus





On Sun, Jan 31, 2010 at 4:53 PM, mdipierro  wrote:
> You can upload HTML but then splay it with {{=XML
> (html_text,sanitize=True)}}
>
>
>
> On Jan 31, 3:17 pm, weheh  wrote:
>> This is not precisely a web2py question. But there are knowledgeable
>> people here who may know the answer.
>>
>> I'm adding CMS functionality to my site. As it is currently
>> implemented, I have a text field that an admin can type html into and
>> then upload it to the site where it is displayed.
>>
>> My concern is that I am creating a security hole in the site. It would
>> obviously be better if they couldn't upload html, but rather a simpler
>> markup language that is read by a python module that parses it and
>> spits out real html, which is then displayed. This would potentially
>> block any nasty code that someone might try to upload to the site.
>>
>> Anybody know of such a markup language and its associated python
>> module? (I know python has an html parser and I could block all tags
>> other than a select few, but thought I'd ask in case there's a better
>> answer out there.)
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Unreliable csv-download

2010-01-30 Thread Thadeus Burgess
Here is at least the tempfile part of it. Not sure how you would do
the pagination, since its exporting an already selected Rows object.

Johann could you look and see if using a tempfile instead works? I
attached the hg export diff.

-Thadeus





On Sat, Jan 30, 2010 at 3:32 PM, mdipierro  wrote:
> I'd just rewrite it to use tempfile and use add an option to do
> pagination (the counterindidation with pagination is that it may cause
> data loss or duplication although very rarely).
>
> On Jan 30, 3:03 pm, Thadeus Burgess  wrote:
>> Rewrite or provide an alternative to ?
>>
>> -Thadeus
>>
>> On Sat, Jan 30, 2010 at 2:51 PM, mdipierro  wrote:
>> > I think we should consider rewriting the export function using a
>> > tmpfile instead of StringIO and doing pagination.
>>
>> > On Jan 30, 2:49 pm, Thadeus Burgess  wrote:
>> >> Perhaps you need to write your own csv export. Save a csv file to /tmp
>> >> instead and then when your finished creating your csv file then stream
>> >> it for download.
>>
>> >> This might reduce the memory requirements? Though not sure what you
>> >> can do about the fact web2py cache's your select into memory, maybe do
>> >> it in chunks as you generate the csv file?
>>
>> >> -Thadeus
>>
>> >> On Sat, Jan 30, 2010 at 2:37 PM, mdipierro  
>> >> wrote:
>> >> > The problem is that all records are copied into memory before being
>> >> > serialized + the entire csv is copied into memory. We need to find a
>> >> > better way when exporting a large of records.
>>
>> >> > On Jan 30, 12:19 pm, Johann Spies  wrote:
>> >> >> It happened more than once that a csv-export using appadmin resulted
>> >> >> in incomplete data both with Postgresql-backend and sqlite.
>>
>> >> >> This one was on sqlite:
>>
>> >> >> Selected records: 139413
>> >> >> csv-exported (first effort): 287 records.
>> >> >> csv-exported (second effort) 216 records
>>
>> >> >> This after a lot of time and slowing down the computer to a near 
>> >> >> standstill.
>>
>> >> >> I suppose it might be easier and more reliable directly form the 
>> >> >> database.
>>
>> >> >> Regards
>> >> >> Johann
>>
>> >> > --
>> >> > You received this message because you are subscribed to the Google 
>> >> > Groups "web2py-users" group.
>> >> > To post to this group, send email to web...@googlegroups.com.
>> >> > To unsubscribe from this group, send email to 
>> >> > web2py+unsubscr...@googlegroups.com.
>> >> > For more options, visit this group 
>> >> > athttp://groups.google.com/group/web2py?hl=en.
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "web2py-users" group.
>> > To post to this group, send email to web...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > web2py+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/web2py?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

# HG changeset patch
# User thade...@ra
# Date 1264899320 21600
# Node ID 9ee66cc8d033ca3607202bbc442f017e971f5f57
# Parent  8f96488fc82eeb57e3cdd9dab5ef0e216026064b
rows __str__ uses tmpfile

diff -r 8f96488fc82e -r 9ee66cc8d033 gluon/sql.py
--- a/gluon/sql.py	Sat Jan 30 16:39:58 2010 -0600
+++ b/gluon/sql.py	Sat Jan 30 18:55:20 2010 -0600
@@ -39,6 +39,7 @@
 import marshal
 import decimal
 import struct
+import tempfile
 
 from utils import md5_hash
 from serializers import json
@@ -3459,10 +3460,13 @@
 """
 serializes the table into a csv file
 """
-
-s = cStringIO.StringIO()
+
+(i, fname) = tempfile.mkstemp()
+s = open(fname, 'w')
 self.export_to_csv_file(s)
-return s.getvalue()
+s.close()
+s = open(fname, 'r')
+return s.read()
 
 def xml(self):
 """


Re: [web2py] Re: Unreliable csv-download

2010-01-30 Thread Thadeus Burgess
Rewrite or provide an alternative to ?

-Thadeus





On Sat, Jan 30, 2010 at 2:51 PM, mdipierro  wrote:
> I think we should consider rewriting the export function using a
> tmpfile instead of StringIO and doing pagination.
>
> On Jan 30, 2:49 pm, Thadeus Burgess  wrote:
>> Perhaps you need to write your own csv export. Save a csv file to /tmp
>> instead and then when your finished creating your csv file then stream
>> it for download.
>>
>> This might reduce the memory requirements? Though not sure what you
>> can do about the fact web2py cache's your select into memory, maybe do
>> it in chunks as you generate the csv file?
>>
>> -Thadeus
>>
>> On Sat, Jan 30, 2010 at 2:37 PM, mdipierro  wrote:
>> > The problem is that all records are copied into memory before being
>> > serialized + the entire csv is copied into memory. We need to find a
>> > better way when exporting a large of records.
>>
>> > On Jan 30, 12:19 pm, Johann Spies  wrote:
>> >> It happened more than once that a csv-export using appadmin resulted
>> >> in incomplete data both with Postgresql-backend and sqlite.
>>
>> >> This one was on sqlite:
>>
>> >> Selected records: 139413
>> >> csv-exported (first effort): 287 records.
>> >> csv-exported (second effort) 216 records
>>
>> >> This after a lot of time and slowing down the computer to a near 
>> >> standstill.
>>
>> >> I suppose it might be easier and more reliable directly form the database.
>>
>> >> Regards
>> >> Johann
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "web2py-users" group.
>> > To post to this group, send email to web...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > web2py+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/web2py?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Unreliable csv-download

2010-01-30 Thread Thadeus Burgess
Perhaps you need to write your own csv export. Save a csv file to /tmp
instead and then when your finished creating your csv file then stream
it for download.

This might reduce the memory requirements? Though not sure what you
can do about the fact web2py cache's your select into memory, maybe do
it in chunks as you generate the csv file?

-Thadeus





On Sat, Jan 30, 2010 at 2:37 PM, mdipierro  wrote:
> The problem is that all records are copied into memory before being
> serialized + the entire csv is copied into memory. We need to find a
> better way when exporting a large of records.
>
> On Jan 30, 12:19 pm, Johann Spies  wrote:
>> It happened more than once that a csv-export using appadmin resulted
>> in incomplete data both with Postgresql-backend and sqlite.
>>
>> This one was on sqlite:
>>
>> Selected records: 139413
>> csv-exported (first effort): 287 records.
>> csv-exported (second effort) 216 records
>>
>> This after a lot of time and slowing down the computer to a near standstill.
>>
>> I suppose it might be easier and more reliable directly form the database.
>>
>> Regards
>> Johann
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: has anybody check the the cron in trunk?

2010-01-30 Thread Thadeus Burgess
in windows?

c:\python25\python.exe

its not case sensitive but it is slash sensitive

-Thadeus





On Sat, Jan 30, 2010 at 12:24 AM, mdipierro  wrote:
> Would this path be right
>
> c:/Python25/python.exe
>
> or this
>
> c:\Python25\python.exe
>
> or both?
>
> On Jan 29, 11:18 pm, "mr.freeze"  wrote:
>> No but I'm getting this in the console on Windows 7:>>> WARNING:root:WEB2PY 
>> CRON Call returned code 1:
>>
>> 'c:/Python25/python.exe\' is not recognized as an internal or external
>> command,
>> operable program or batch file.
>>
>> On Jan 29, 5:37 pm, mdipierro  wrote:
>>
>> > In particular on windows and the @reboot option?
>>
>> > Massimo
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: format zero IS_IN_DB

2010-01-30 Thread Thadeus Burgess
Excellent suggestion on adding the comments with a link to the
discussion thread Iceberg

-Thadeus





On Sat, Jan 30, 2010 at 2:07 AM, Iceberg  wrote:
> When saying "some people ask for zero=None, some for zero='', some for
> zero='Please choose a value'", ok, I am the one who once suggest the
> recent zero='' change, in this thread:
>  https://groups.google.com/group/web2py/browse_frm/thread/7a5154c377c9eec3
>
> But hey, I think I made myself clear in that post, that:
>  zero='blah blah' is UNACCEPTABLE, because it is not friendly for non-
> english users.
>  zero='' is better than above
>  zero=None is preferable. The reason is explained so well by Denes
> and Thadeus, and I can't agree more.
>
> And one more suggestion. If after this discussion, the default zero is
> back to None again (I hope so), so please please add one line of
> comment as a warning sign, to avoid it being change in the future. It
> was changed back and forth in the past, only because we fail to mark
> all these valuable, wise discussion in document. For example:
>
>  IS_IN_DB(...,
>    zero=None, # Why? See 
> https://groups.google.com/group/web2py/browse_frm/thread/d25d13cd3f5bd7b1
>    ...)
>
> Regards,
> Iceberg
>
> On Jan29, 11:55pm, Thadeus Burgess  wrote:
>> +1 supporting DenesL argument. (but we already know this)
>>
>> note.
>>
>> default.
>>
>> breaks app.
>>
>> we like the feature
>>
>> but it shouldn't break an app
>>
>> no reason to have to specifically DISABLE something that hasn't
>> existed in web2py before ( you know, the empty select or "please
>> choose a value" breaks my app which is why I'm still running pre-1.70
>> codebase )
>>
>> The only reason that it defaults to zero='' is because the person who
>> originally requested it needed that.
>>
>> Their only argument was THEY needed it so it should default to it just
>> for THEIR convenience while everyone else is subjugated to having to
>> DISABLE a NEW feature.
>>
>> -Thadeus
>>
>>
>>
>> On Fri, Jan 29, 2010 at 9:31 AM, DenesL  wrote:
>>
>> > I must insist.
>> > The point is that IS_IN_DB and IS_IN_SET now show a spurious empty
>> > option by default.
>> > The keyword here is default.
>>
>> > If you want to introduce a 'choose a value" option you should do it
>> > explicitly and 'at your own risk', the risk being that it creates an
>> > option that when selected will cause an error.
>>
>> > An empty option is plainly wrong, it is not part of the IS_IN_DB or
>> > IS_IN_SET options. It is completely artificial.
>>
>> > How many times the option has been changed should not matter, getting
>> > it right should.
>> > Denes.
>>
>> > On Jan 29, 10:06 am, mdipierro  wrote:
>> >> There is no way to please everybody here. some people ask for
>> >> zero=None, some for zero='', some for zero='Please choose a value'.
>> >> There is no right or wrong. I think we should leave the default as is
>> >> ('', we changed it twice already) and you configure it as needed.
>>
>> >> Massimo
>>
>> >> On Jan 29, 9:00 am, DenesL  wrote:
>>
>> >> > 
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "web2py-users" group.
>> > To post to this group, send email to web...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > web2py+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/web2py?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Using XML templates with AMF

2010-01-29 Thread Thadeus Burgess
@service.amfrpc3('domain')
def somefunction(param):
   return response.render(filename='mytemplate.xml', context=dict(items))

-Thadeus





On Fri, Jan 29, 2010 at 8:28 PM, Dane  wrote:
> Yes, I'm using services currently. My question is how do I return xml
> generated by a template THROUGH a service. Sorry if I'm unclear or out
> in left field. I'm still a beginner. The idea is something like this:
>
> @service.amfrpc3('domain')
> def somefunction(param):
>      return dict(items = db(db.items.param == param).select())
>       #this would return xml generated by associated template
>
>
> #template for somefunction would look something like:
>
> 
>   {{for item in items}}
>
>     
>         {{=item.child}}
>
>     
>
> 
>
>
>
>
>
> On Jan 29, 7:11 pm, mdipierro  wrote:
>> Did you look into web2py services?
>>
>> @service.amfrpc3('domain')
>> def somefunction(a,b,c):
>>       return a+b+c
>>
>> On Jan 29, 5:44 pm, Dane  wrote:
>>
>> > Hello,
>>
>> > I'm building a web2py backend for a Flex site, and I would like to
>> > send some of my data as XML since it's hierarchical in nature and AS3
>> > has great xml manipulation capabilities with e4x. However, I'd like to
>> > send this data through an exposed amf function instead of through REST
>> > for speed, security, and uniformity across my services. PyAMF has no
>> > problem with XML, and I know I could use a tool like ElementTree to
>> > build my xml right in the exposed function, but I'd rather use the
>> > Web2py templating system. Any ideas on how I'd go about sending XML
>> > generated through a template to Flex through an amf function?  Thanks!
>>
>> > -Dane
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Postgres Log Shipping

2010-01-29 Thread Thadeus Burgess
Yes google is great. I can find most anything I want with google.

I was looking for if anyone knew any good tutorials that might have
been missed by google.

Thanks though.

-Thadeus





On Fri, Jan 29, 2010 at 3:36 PM, Johann Spies  wrote:
> On 29 January 2010 22:50, Thadeus Burgess  wrote:
>> Can anyone suggest a tutorial for log shipping to another database
>> using postgresql ?
>
> If you mean by "log shipping" the method of using logs of
> sql-transactions to duplicate a database on another server you can
> search for "postgresql warm standby" e.g.
> http://wiki.postgresql.org/wiki/Warm_Standby.
>
> Regards
> Johann
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] response.postprocessing

2010-01-29 Thread Thadeus Burgess
bah I need to take a break, my eyes play tricks on me.

-Thadeus





On Fri, Jan 29, 2010 at 3:35 PM, Thadeus Burgess  wrote:
> Why does this function get a dictionary, when this is the only
> function in postprocessing
>
> def compress_response(xml):
>    print xml # prints {'form': }
>    cpat = 
> re.compile(r'[\n\t\r\f\v]|(?s)\s\s\s|(?s)|(?s)|(?s)')
>    d = cpat.sub(save_pre, xml)
>    return d
>
> response.postprocessing.append(compress_response)
>
> and this function get a string? when it is the only function in 
> postprocessing?
>
> def hi(vars):
>    print vars # prints     return vars
>
> response.postprocessing.append(hi)
>
> -Thadeus
>
>
>
>
>
> On Fri, Jan 29, 2010 at 3:26 PM, Thadeus Burgess  
> wrote:
>> Thanks. grep fail :)
>>
>> -Thadeus
>>
>>
>>
>>
>>
>> On Fri, Jan 29, 2010 at 3:22 PM, Jonathan Lundell  wrote:
>>> On Jan 29, 2010, at 1:16 PM, Thadeus Burgess wrote:
>>>
>>>> Maybe its just me and I need to look harder
>>>>
>>>> but I can't find where web2py calls this... at all
>>>
>>> run_controller_in() (in compileapp.py)
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "web2py-users" group.
>>> To post to this group, send email to web...@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> web2py+unsubscr...@googlegroups.com.
>>> For more options, visit this group at 
>>> http://groups.google.com/group/web2py?hl=en.
>>>
>>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] response.postprocessing

2010-01-29 Thread Thadeus Burgess
Why does this function get a dictionary, when this is the only
function in postprocessing

def compress_response(xml):
print xml # prints {'form': }
cpat = 
re.compile(r'[\n\t\r\f\v]|(?s)\s\s\s|(?s)|(?s)|(?s)')
d = cpat.sub(save_pre, xml)
return d

response.postprocessing.append(compress_response)

and this function get a string? when it is the only function in postprocessing?

def hi(vars):
print vars # prints  wrote:
> Thanks. grep fail :)
>
> -Thadeus
>
>
>
>
>
> On Fri, Jan 29, 2010 at 3:22 PM, Jonathan Lundell  wrote:
>> On Jan 29, 2010, at 1:16 PM, Thadeus Burgess wrote:
>>
>>> Maybe its just me and I need to look harder
>>>
>>> but I can't find where web2py calls this... at all
>>
>> run_controller_in() (in compileapp.py)
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To post to this group, send email to web...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/web2py?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] response.postprocessing

2010-01-29 Thread Thadeus Burgess
Thanks. grep fail :)

-Thadeus





On Fri, Jan 29, 2010 at 3:22 PM, Jonathan Lundell  wrote:
> On Jan 29, 2010, at 1:16 PM, Thadeus Burgess wrote:
>
>> Maybe its just me and I need to look harder
>>
>> but I can't find where web2py calls this... at all
>
> run_controller_in() (in compileapp.py)
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] response.postprocessing

2010-01-29 Thread Thadeus Burgess
Maybe its just me and I need to look harder

but I can't find where web2py calls this... at all

-Thadeus

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Postgres Log Shipping

2010-01-29 Thread Thadeus Burgess
Can anyone suggest a tutorial for log shipping to another database
using postgresql ?

-Thadeus

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] routes.py SUCKS

2010-01-29 Thread Thadeus Burgess
routes_in

('^/admin(?P.*)', '/admin\g'),
('^/appadmin(?P.*)', '/init/appadmin\g'),
('^/(?P.*)', '/init/default/\g'),

routes_out

('/init/appadmin(?P.*)', '/appadmin\g'),
('/init/default(?P.*)', '/default\g'),


-Thadeus





On Fri, Jan 29, 2010 at 11:24 AM, Jonathan Lundell  wrote:
>
>> Setting up the WSGI handler is easy, however routes.py gives me a hard
>> time. I tried a bunch of versions, but none seemed to work.
>>
>> Can someone help out? This should be really easy, but it isn't!
>
> One thing that might help: I added a doctest section to routes.example.py. 
> The intention is that you can use it to see what your modified routes.py is 
> actually doing (you need to edit the doctest accordingly, of course).
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Strange ticket

2010-01-29 Thread Thadeus Burgess
http

ubuntu 8.10

apache2

mod_wsgi

python 2.6

The thing is, the ticket is issued when clients visit the website, I
cannot reproduce the error, so I have no clue what "action" causes
this. It only happens once in a blue moon (meaning once maybe every
2-5 days). It happens during the day and night. And since the
traceback starts at the web2py level I have no clue if its my app
causing it or the setup?

It looks like the server might be getting alot of requests, and web2py
tries to read a controller for exec and fails, but I'm just guessing.

-Thadeus





On Fri, Jan 29, 2010 at 11:10 AM, mdipierro  wrote:
> It his over https with wsgiserver?
>
> On Jan 29, 10:56 am, Thadeus Burgess  wrote:
>> Every once in a while I get the following ticket. Its random, any ideas?
>>
>> Traceback (most recent call last):
>>   File "gluon/main.py", line 396, in wsgibase
>>     request.body = copystream_progress(request) ### stores request body
>>   File "gluon/main.py", line 143, in copystream_progress
>>     copystream(source, dest, size, chunk_size)
>>   File "gluon/fileutils.py", line 302, in copystream
>>     data = src.read(size)
>> IOError: request data read error
>>
>> -Thadeus
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Strange ticket

2010-01-29 Thread Thadeus Burgess
Every once in a while I get the following ticket. Its random, any ideas?

Traceback (most recent call last):
  File "gluon/main.py", line 396, in wsgibase
request.body = copystream_progress(request) ### stores request body
  File "gluon/main.py", line 143, in copystream_progress
copystream(source, dest, size, chunk_size)
  File "gluon/fileutils.py", line 302, in copystream
data = src.read(size)
IOError: request data read error

-Thadeus

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: format zero IS_IN_DB

2010-01-29 Thread Thadeus Burgess
+1 supporting DenesL argument. (but we already know this)

note.

default.

breaks app.

we like the feature

but it shouldn't break an app

no reason to have to specifically DISABLE something that hasn't
existed in web2py before ( you know, the empty select or "please
choose a value" breaks my app which is why I'm still running pre-1.70
codebase )

The only reason that it defaults to zero='' is because the person who
originally requested it needed that.

Their only argument was THEY needed it so it should default to it just
for THEIR convenience while everyone else is subjugated to having to
DISABLE a NEW feature.

-Thadeus





On Fri, Jan 29, 2010 at 9:31 AM, DenesL  wrote:
>
> I must insist.
> The point is that IS_IN_DB and IS_IN_SET now show a spurious empty
> option by default.
> The keyword here is default.
>
> If you want to introduce a 'choose a value" option you should do it
> explicitly and 'at your own risk', the risk being that it creates an
> option that when selected will cause an error.
>
> An empty option is plainly wrong, it is not part of the IS_IN_DB or
> IS_IN_SET options. It is completely artificial.
>
> How many times the option has been changed should not matter, getting
> it right should.
> Denes.
>
>
> On Jan 29, 10:06 am, mdipierro  wrote:
>> There is no way to please everybody here. some people ask for
>> zero=None, some for zero='', some for zero='Please choose a value'.
>> There is no right or wrong. I think we should leave the default as is
>> ('', we changed it twice already) and you configure it as needed.
>>
>> Massimo
>>
>> On Jan 29, 9:00 am, DenesL  wrote:
>>
>> > 
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Copy tables from existing table

2010-01-28 Thread Thadeus Burgess
Sometimes I think to myself and say, "Why didn't I just try that!"

Thank you, both of you!

-Thadeus





On Thu, Jan 28, 2010 at 4:27 PM, mdipierro  wrote:
> Or
>
> db.define_table('newname',db.othertable)
>
> On Jan 28, 4:19 pm, DenesL  wrote:
>> db.define_table('newname',*[f for f in db.table])
>>
>> On Jan 28, 2:20 pm, Thadeus Burgess  wrote:
>>
>> > Is there a way to iterate through the Field() elements of a table and
>> > use them to create another similar table ?
>>
>> > I'm looking for something like
>>
>> > db.define_table('hi', Field('hello'), Field('world'))
>>
>> > class Foo()
>> >    def init(atable):
>> >       for field in atable:
>> >          db.define_table(tablename + '_mod', field, field, field,
>> > Field('bar', 'datetime'))
>>
>> > So I would end up with
>>
>> > db.hi and db.hi_mod.
>>
>> > -Thadeus
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Copy tables from existing table

2010-01-28 Thread Thadeus Burgess
Is there a way to iterate through the Field() elements of a table and
use them to create another similar table ?

I'm looking for something like

db.define_table('hi', Field('hello'), Field('world'))

class Foo()
   def init(atable):
  for field in atable:
 db.define_table(tablename + '_mod', field, field, field,
Field('bar', 'datetime'))

So I would end up with

db.hi and db.hi_mod.

-Thadeus

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: format zero IS_IN_DB

2010-01-28 Thread Thadeus Burgess
My thoughts exactly :)

-Thadeus





On Thu, Jan 28, 2010 at 12:55 PM, DenesL  wrote:
> Thanks, I've seen it.
>
> The problem with format and IS_IN_DB can be easily fixed in sql.py but
> I would be against setting the default of zero to '' in IS_IN_DB and
> IS_IN_SET if it creates an empty option in the dropdown.
>
> zero seems to have been introduced to display a "choose a value" kind
> of message as the first option in the dropdown, and it should be
> explicitly set when required, not explicity removed when not required,
> i.e. having to set zero=None if you do not want the empty option,
> which should not have been there to begin with.
>
> Denes.
>
> On Jan 28, 12:25 pm, Thadeus Burgess  wrote:
>> http://groups.google.com/group/web2py/browse_thread/thread/e0ed90f8e7...
>>
>> Please follow the above thread.
>>
>> Massimo said he was thinking about how to procede with the matter.
>>
>> -Thadeus
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] format zero IS_IN_DB

2010-01-28 Thread Thadeus Burgess
http://groups.google.com/group/web2py/browse_thread/thread/e0ed90f8e72960f6

Please follow the above thread.

Massimo said he was thinking about how to procede with the matter.


-Thadeus





On Thu, Jan 28, 2010 at 11:05 AM, DenesL  wrote:
>
> Back in Jan.2/10 the default for zero was changed to ''
> http://groups.google.com/group/web2py/msg/684a2374e7379861
>
> Consider:
> db.define_table('person',Field('name',unique=True), format='%(name)s')
> db.define_table('dog',Field('name',unique=True),Field
> ('owner',db.person), format='%(name)s')
>
> will generate a db.dog.owner dropdown with an empty option that IMO
> should not be there since it is not part of the associated IS_IN_DB
> requires.
>
> Could you please explain to me why was zero='' made the default?
>
> Denes.
>
> PS: this also applies to IS_IN_SET but not in relation to
> table._format e.g.
>
 r=IS_IN_SET((1,2,3))
 r.options()
> [('', ''), ('1', '1'), ('2', '2'), ('3', '3')]
>
> counter-intuitive.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Mobile devices + web2py

2010-01-28 Thread Thadeus Burgess
wow Massimo where did that one creep out of the depths from!

Lol I never knew :)

-Thadeus





On Thu, Jan 28, 2010 at 9:27 AM, tiago almeida
 wrote:
> Great! I missed that one.
>
> Thank you very much,
> Tiago
> -
> On Thu, Jan 28, 2010 at 3:15 PM, mdipierro  wrote:
>>
>> http://www.web2py.com/examples/static/mobile_device_detect.py
>>
>> On Jan 28, 6:01 am, tiago almeida  wrote:
>> > Hello,
>> > does web2py have any mechanism for dealing with mobile devices? I'm
>> > talking
>> > about *determining if the user is on a mobile device* so that pages can
>> > be
>> > tailored for those screens.
>> >
>> > I've searched in the book and in web2pyslices and don't see anything
>> > like
>> > that.
>> >
>> > Thanks a lot in advance,
>> > Tiago Almeida
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To post to this group, send email to web...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/web2py?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: wmd

2010-01-28 Thread Thadeus Burgess
Take a look at

http://code.google.com/p/blogitizor/source/browse/src/controllers/admin.py
line 280 starts the controller.

note lines 293-297 - setting wmd defaults

Look at

http://code.google.com/p/blogitizor/source/browse/src/views/admin/create.html

note lines
191-193 - sets wmd options
331 - initializes wmd, this will scan all textareas and convert them
to wmd unless they are of class wmd-ignore


-Thadeus





On Thu, Jan 28, 2010 at 5:00 AM, selecta  wrote:
> i showed in a slice that using a wysiwyg editor for markup is
> possible, why not use that instead of wysiwym
>
> On Jan 28, 9:52 am, Johann Spies  wrote:
>> Thadeus mentioned that he used WMD on his blog.
>>
>> I have tried to get it working by putting the following in layout.hml:
>>
>> 
>>   // to set WMD's options programatically, define a "wmd_options"
>> object with whatever settings
>>   // you want to override.  Here are the defaults:
>>   wmd_options = {
>>   // format sent to the server.  Use "Markdown" to return the markdown 
>> source.
>>   output: "HTML",
>>
>>   // line wrapping length for lists, blockquotes, etc.
>>   lineLength: 40,
>>
>>   // toolbar buttons.  Undo and redo get appended automatically.
>>   buttons: "bold italic | link blockquote code image | ol ul heading hr",
>>
>>   // option to automatically add WMD to the first textarea found.  See
>> apiExample.html for usage.
>>   autostart: true
>>   };
>> 
>> 
>> 
>> 
>>
>> But this seems to be ignored.
>>
>> As I understand the instructions this should be just before 
>> so I cannot see where else to put it.
>>
>> What am I doing wrong?
>>
>> Johann
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-28 Thread Thadeus Burgess
This is an issue with how different operating systems have different
methods for representing newline and as avid python developers we
should all know this :)

-Thadeus





On Wed, Jan 27, 2010 at 11:50 PM, mdipierro  wrote:
> I just run the test and you are right. It does not work.
>
> I also checked the original problem reported on this thread that
> started the discussion and I fail to reproduce it.
>
>>>> writer=csv.writer(s,quoting=csv.QUOTE_MINIMAL)
>>>> writer.writerow(['this','is\na','test',12])
>>>> print s.getvalue()
> this,"is
> a",test,12
>>>> reader=csv.reader(s,quoting=csv.QUOTE_MINIMAL)
>>>> s.seek(0)
>>>> for line in reader: print line
> ...
> ['this', 'is\x07', 'test', '12']
> ['this', 'is\na', 'test', '12']
>
>
> On Jan 27, 11:36 pm, Thadeus Burgess  wrote:
>> We can't have it exporting qoutes and then the import expecting the
>> qoutes to be minimal. Then the export/import functionality is broken
>> between itself =/
>>
>> I still say, sql.py should stay QOUTE_MINIMAL and dal.py should be
>> QOUTE_NONNUMERIC. This way it keeps a sense of backwards-compatibility
>> with the option of better use-case in the new dal.
>>
>> Either way both import/export need to be the same.
>>
>> -Thadeus
>>
>> On Wed, Jan 27, 2010 at 11:16 PM, mdipierro  wrote:
>> > Oops. I was wrong. I did not do what I said. I just changed trunk so
>> > that import on import requires QUOTE_MINIMAL but on export applies
>> > QUOTE_NONNUMERIC.
>>
>> > So import does not change but new export should still be compatible
>> > with input. Am I wrong again?
>> > I did not try it yet. I am making a guess.
>>
>> > Massimo
>>
>> > On Jan 27, 11:01 pm, Thadeus Burgess  wrote:
>> >> Are you saying that from the csv module point of view, or from web2py
>> >> point of view?
>>
>> >> I just attempted a simple test attempting to export one of my old
>> >> files... it failed.
>>
>> >> Its no biggie, I just will specify my qoute type if I ever need to use
>> >> one of these old csv files.
>>
>> >> My only request is make an official changelog, and make a note about this!
>>
>> >> -Thadeus
>>
>> >> On Wed, Jan 27, 2010 at 10:55 PM, mdipierro  
>> >> wrote:
>> >> > ill not be a problem since this parameter only affects export
>> >> > not import. Because of the way it work
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "web2py-users" group.
>> > To post to this group, send email to web...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > web2py+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/web2py?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-27 Thread Thadeus Burgess
We can't have it exporting qoutes and then the import expecting the
qoutes to be minimal. Then the export/import functionality is broken
between itself =/

I still say, sql.py should stay QOUTE_MINIMAL and dal.py should be
QOUTE_NONNUMERIC. This way it keeps a sense of backwards-compatibility
with the option of better use-case in the new dal.

Either way both import/export need to be the same.

-Thadeus





On Wed, Jan 27, 2010 at 11:16 PM, mdipierro  wrote:
> Oops. I was wrong. I did not do what I said. I just changed trunk so
> that import on import requires QUOTE_MINIMAL but on export applies
> QUOTE_NONNUMERIC.
>
> So import does not change but new export should still be compatible
> with input. Am I wrong again?
> I did not try it yet. I am making a guess.
>
> Massimo
>
> On Jan 27, 11:01 pm, Thadeus Burgess  wrote:
>> Are you saying that from the csv module point of view, or from web2py
>> point of view?
>>
>> I just attempted a simple test attempting to export one of my old
>> files... it failed.
>>
>> Its no biggie, I just will specify my qoute type if I ever need to use
>> one of these old csv files.
>>
>> My only request is make an official changelog, and make a note about this!
>>
>> -Thadeus
>>
>> On Wed, Jan 27, 2010 at 10:55 PM, mdipierro  wrote:
>> > ill not be a problem since this parameter only affects export
>> > not import. Because of the way it work
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-27 Thread Thadeus Burgess
Are you saying that from the csv module point of view, or from web2py
point of view?

I just attempted a simple test attempting to export one of my old
files... it failed.

Its no biggie, I just will specify my qoute type if I ever need to use
one of these old csv files.

My only request is make an official changelog, and make a note about this!

-Thadeus





On Wed, Jan 27, 2010 at 10:55 PM, mdipierro  wrote:
> ill not be a problem since this parameter only affects export
> not import. Because of the way it work

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Postgresql interface buggy

2010-01-27 Thread Thadeus Burgess
generic, their quite powerful though. But a single function called
from the web2py command line to convert between data types shouldn't
be that hard.

of course, you "should" have your data types set out before the app
ever hits production so migrations like this usually mean deleting the
sqlite database ands tarting from scratch.

-Thadeus





On Wed, Jan 27, 2010 at 10:52 PM, mdipierro  wrote:
> ant something that is more complex and the database does not
> support it (for example a string field into a date field) than one
> needs to write a script for it. The conversion may be done on the db
> side or on the web2py side. The fact is there are a lot of options. I
> am not sure how general rails migrations scri

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Two domains, two web2py instances, two apps, same database

2010-01-27 Thread Thadeus Burgess
Here are my needs.

example.com = public portion of the website. This includes anything
publicly accessible, and allows new accounts to be created. Only needs
access to one table, accounts table.
dashboard.example.com = internal portion of the website, which
includes all account management functions, but of course linked to the
same database, but has access to many more tables.

In this setup, I would run two apache virtualhosts, and two
installations of web2py. I will define my models in a module that they
can be imported to each app.

Each app will of course have a different set of
controllers/views/static etc etc.

And dashboard.example.com will be force https, IP restricted (by
apache), htpasswd, web2py passwd, etc.. etc..

Is this an appropriate setup for this? Would having one app that
checks request.env.http_host and route based on this a better
solution?

What would be the correct way to design the models so they can be
imported instead of "exectued", like Admin but I need them to unpack
into the web2py global namespace. Since I am on linux, would symlinks
be a better approach I could store just the accounts table in one
file, and symlink that to both apps from a central "projects" folder.

Thoughts, suggestions, ideas?

-Thadeus

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-27 Thread Thadeus Burgess
what if I have old csv backups laying around :)

Ok +1 for QOUTES_NONNUMERIC as default.

-Thadeus





On Wed, Jan 27, 2010 at 7:45 PM, mdipierro  wrote:
> I do not think this change will cause any backward compatibility
> problems.
>
> On Jan 27, 3:58 pm, Thadeus Burgess  wrote:
>> Doesn't that break backwards compatibility ?
>>
>> -Thadeus
>>
>> On Wed, Jan 27, 2010 at 1:38 PM, mdipierro  wrote:
>> > I just made this default in trunk.
>>
>> > On Jan 27, 10:42 am, Thadeus Burgess  wrote:
>> >> You need to define the appropriate csv.QOUTES type. You probably have
>> >> csv.QOUTES_MINIMAL (which is the web2py default)
>>
>> >> Try the following
>>
>> >> import csv
>> >> db(query).select().export_to_csv_file(s, delimiter=',', quotechar='"',
>> >> quoting=csv.QUOTE_NONNUMERIC)
>> >> db.import_from_csv_file(s, delimiter=',', quotechar='"',
>> >> qouting=csv.QOUTE_NONNUMERIC)
>>
>> >> -Thadeus
>>
>> >> On Wed, Jan 27, 2010 at 10:11 AM, mdipierro  
>> >> wrote:
>> >> > this sounds like a bug but more of a bug in the csv module than in
>> >> > web2py.
>> >> > Anyway, it needs some testing. I will put this in my queue but it
>> >> > would help if somebody else can also look into this. The only export/
>> >> > import functions are in gluon/sql.py (for Table and for SQLDB).
>>
>> >> > On Jan 27, 8:55 am, Praneeth  wrote:
>> >> > > Hello folks,
>>
>> >> > > I was wondering if anyone faced this problem before. I was migrating a
>> >> > > database from sqlite to MySQL and had to do a db.export_to_csv_file. 
>> >> > > My
>> >> > > database contains strings with a carriage return. Seems like the 
>> >> > > export
>> >> > > creates carriage returns in the CSV file resulting in a failure when
>> >> > > doing a db.import_from_csv_file. I manually removed the carriage 
>> >> > > returns
>> >> > > from my file for a successful import.
>>
>> >> > > --
>> >> > > Praneeth
>>
>> >> > --
>> >> > You received this message because you are subscribed to the Google 
>> >> > Groups
>> >> > "web2py-users" group.
>> >> > To post to this group, send email to web...@googlegroups.com.
>> >> > To unsubscribe from this group, send email to
>> >> > web2py+unsubscr...@googlegroups.com
>> >> > .
>> >> > For more options, visit this group at
>> >> >http://groups.google.com/group/web2py?hl=en.
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "web2py-users" group.
>> > To post to this group, send email to web...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > web2py+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/web2py?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Postgresql interface buggy

2010-01-27 Thread Thadeus Burgess
What about data type conversion though.

In rails this is why you have to define migrations in rake script.

Would it even be worth it for web2py ?

Could we load the database column to a csv file, have web2py automate
the drop column create column and new insert to the new data type?

-Thadeus





On Wed, Jan 27, 2010 at 7:44 PM, mdipierro  wrote:
> problem is that changing a type is not always well defined. In
> particular if you have data in the column the database may not be able
> to convert the data from the old typ

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread Thadeus Burgess
Doesn't javascript input serialization expect to look the field up by id?

form = id = formname class=formname:
   input:
  class = formname
  id = formname_field

#formname input { ... }
#formname #formname_users_email { ... }
#formname .formname { ... }

-Thadeus





On Wed, Jan 27, 2010 at 5:12 PM, Jonathan Lundell  wrote:
> On Jan 27, 2010, at 2:30 PM, Thadeus Burgess wrote:
>
>> if it was defaulted to None we could go
>>
>> if _id == None then id = tablename else id = _id
>>
>> Id accept that, just set a unique id for each of my forms and nothing
>> will conflict and it will still keep good with old apps.
>
> And _id = False for no id at all.
>
> It's not that it isn't useful to put all of them into the same class; it's 
> that class is the right way to do it, rather than id.
>
>
>>
>> -Thadeus
>>
>>
>>
>>
>>
>> On Wed, Jan 27, 2010 at 4:27 PM, Wes James  wrote:
>>> Why not:
>>>
>>>  form1=SQLFORM(..., _id="what_you_want")
>>>
>>> -wes
>>>
>>> On Wed, Jan 27, 2010 at 7:31 AM, mdipierro  wrote:
>>>> The ids are only used for CSS. you can do
>>>>
>>>> form1=SQLFORM(...,_class='form1')
>>>> form1.accepts(request.post_vars,formname=None)
>>>> form2=SQLFORM(...,_class='form2')
>>>> form2.accepts(request.post_vars,formname=None)
>>>> return dict(form1=form1,form2=form2)
>>>>
>>>> and you can use the class to refer to the id of the first or the
>>>> second in CSS. There should be no ambiguity.
>>>>
>>>> Massimo
>>>>
>>>>
>>>
>>> 
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "web2py-users" group.
>>> To post to this group, send email to web...@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> web2py+unsubscr...@googlegroups.com.
>>> For more options, visit this group at 
>>> http://groups.google.com/group/web2py?hl=en.
>>>
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To post to this group, send email to web...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/web2py?hl=en.
>>
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread Thadeus Burgess
Doesn't javascript input serialization expect to look the field up by id?

it should be

form = id = formname class=formname:
   input:
  class = formname
  id = formname_field

#formname input { ... }
#formname #formname_users_email { ... }
#formname .formname { ... }

This would give a lot more flexibility from both a CSS design and a UI
design using jquery selection.

-Thadeus





On Wed, Jan 27, 2010 at 5:12 PM, Jonathan Lundell  wrote:
> On Jan 27, 2010, at 2:30 PM, Thadeus Burgess wrote:
>
>> if it was defaulted to None we could go
>>
>> if _id == None then id = tablename else id = _id
>>
>> Id accept that, just set a unique id for each of my forms and nothing
>> will conflict and it will still keep good with old apps.
>
> And _id = False for no id at all.
>
> It's not that it isn't useful to put all of them into the same class; it's 
> that class is the right way to do it, rather than id.
>
>
>>
>> -Thadeus
>>
>>
>>
>>
>>
>> On Wed, Jan 27, 2010 at 4:27 PM, Wes James  wrote:
>>> Why not:
>>>
>>>  form1=SQLFORM(..., _id="what_you_want")
>>>
>>> -wes
>>>
>>> On Wed, Jan 27, 2010 at 7:31 AM, mdipierro  wrote:
>>>> The ids are only used for CSS. you can do
>>>>
>>>> form1=SQLFORM(...,_class='form1')
>>>> form1.accepts(request.post_vars,formname=None)
>>>> form2=SQLFORM(...,_class='form2')
>>>> form2.accepts(request.post_vars,formname=None)
>>>> return dict(form1=form1,form2=form2)
>>>>
>>>> and you can use the class to refer to the id of the first or the
>>>> second in CSS. There should be no ambiguity.
>>>>
>>>> Massimo
>>>>
>>>>
>>>
>>> 
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "web2py-users" group.
>>> To post to this group, send email to web...@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> web2py+unsubscr...@googlegroups.com.
>>> For more options, visit this group at 
>>> http://groups.google.com/group/web2py?hl=en.
>>>
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To post to this group, send email to web...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/web2py?hl=en.
>>
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: After upgrade, getting "NameError name 'table' is not defined"

2010-01-27 Thread Thadeus Burgess
Dont forget to replace teh views so you can get the cache templates

-Thadeus





On Wed, Jan 27, 2010 at 5:01 PM, MikeEllis  wrote:
> Thanks, Thadeus.  Replacing appadmin.py fixed it.
>
> On Jan 27, 5:56 pm, Thadeus Burgess  wrote:
>> Yes you should replace the appadmin files.
>>
>> There was a bug (don't remember what) with the old appadmin that was
>> fixed in recent versions.
>>
>> Plus you get access to cache statistics if you have guppy heapy installed :)
>>
>> -Thadeus
>>
>> On Wed, Jan 27, 2010 at 4:44 PM, MikeEllis  wrote:
>> > I get the error shown in the subject of this message when I try to
>> > manually insert a new record into any of my tables using the built-in
>> > db admin interface.  The complete traceback is
>>
>> > Traceback (most recent call last):
>> >  File "/Users/mellis/web2py/gluon/restricted.py", line 173, in
>> > restricted
>> >    exec ccode in environment
>> >  File "/Users/mellis/web2py/applications/init/views/appadmin.html",
>> > line 208, in 
>> > NameError: name 'table' is not defined
>>
>> > The error occurs when I click "Insert new ..." in appadmin/index.
>>
>> > FWIW, I upgraded from 1.64 to the latest version a few days ago.  I
>> > copied the entire app to the new installation.  Do I need to replace
>> > any of the appadmin files?
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "web2py-users" group.
>> > To post to this group, send email to web...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > web2py+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/web2py?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] After upgrade, getting "NameError name 'table' is not defined"

2010-01-27 Thread Thadeus Burgess
Yes you should replace the appadmin files.

There was a bug (don't remember what) with the old appadmin that was
fixed in recent versions.

Plus you get access to cache statistics if you have guppy heapy installed :)

-Thadeus





On Wed, Jan 27, 2010 at 4:44 PM, MikeEllis  wrote:
> I get the error shown in the subject of this message when I try to
> manually insert a new record into any of my tables using the built-in
> db admin interface.  The complete traceback is
>
> Traceback (most recent call last):
>  File "/Users/mellis/web2py/gluon/restricted.py", line 173, in
> restricted
>    exec ccode in environment
>  File "/Users/mellis/web2py/applications/init/views/appadmin.html",
> line 208, in 
> NameError: name 'table' is not defined
>
> The error occurs when I click "Insert new ..." in appadmin/index.
>
> FWIW, I upgraded from 1.64 to the latest version a few days ago.  I
> copied the entire app to the new installation.  Do I need to replace
> any of the appadmin files?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread Thadeus Burgess
if it was defaulted to None we could go

if _id == None then id = tablename else id = _id

Id accept that, just set a unique id for each of my forms and nothing
will conflict and it will still keep good with old apps.

-Thadeus





On Wed, Jan 27, 2010 at 4:27 PM, Wes James  wrote:
> Why not:
>
>  form1=SQLFORM(..., _id="what_you_want")
>
> -wes
>
> On Wed, Jan 27, 2010 at 7:31 AM, mdipierro  wrote:
>> The ids are only used for CSS. you can do
>>
>> form1=SQLFORM(...,_class='form1')
>> form1.accepts(request.post_vars,formname=None)
>> form2=SQLFORM(...,_class='form2')
>> form2.accepts(request.post_vars,formname=None)
>> return dict(form1=form1,form2=form2)
>>
>> and you can use the class to refer to the id of the first or the
>> second in CSS. There should be no ambiguity.
>>
>> Massimo
>>
>>
>
> 
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-27 Thread Thadeus Burgess
I would say keep the old default in sql.py but make this the new
default in dal.py

The new dal has new functionality anyways

-Thadeus





On Wed, Jan 27, 2010 at 3:58 PM, Thadeus Burgess  wrote:
> Doesn't that break backwards compatibility ?
>
> -Thadeus
>
>
>
>
>
> On Wed, Jan 27, 2010 at 1:38 PM, mdipierro  wrote:
>> I just made this default in trunk.
>>
>> On Jan 27, 10:42 am, Thadeus Burgess  wrote:
>>> You need to define the appropriate csv.QOUTES type. You probably have
>>> csv.QOUTES_MINIMAL (which is the web2py default)
>>>
>>> Try the following
>>>
>>> import csv
>>> db(query).select().export_to_csv_file(s, delimiter=',', quotechar='"',
>>> quoting=csv.QUOTE_NONNUMERIC)
>>> db.import_from_csv_file(s, delimiter=',', quotechar='"',
>>> qouting=csv.QOUTE_NONNUMERIC)
>>>
>>> -Thadeus
>>>
>>> On Wed, Jan 27, 2010 at 10:11 AM, mdipierro  wrote:
>>> > this sounds like a bug but more of a bug in the csv module than in
>>> > web2py.
>>> > Anyway, it needs some testing. I will put this in my queue but it
>>> > would help if somebody else can also look into this. The only export/
>>> > import functions are in gluon/sql.py (for Table and for SQLDB).
>>>
>>> > On Jan 27, 8:55 am, Praneeth  wrote:
>>> > > Hello folks,
>>>
>>> > > I was wondering if anyone faced this problem before. I was migrating a
>>> > > database from sqlite to MySQL and had to do a db.export_to_csv_file. My
>>> > > database contains strings with a carriage return. Seems like the export
>>> > > creates carriage returns in the CSV file resulting in a failure when
>>> > > doing a db.import_from_csv_file. I manually removed the carriage returns
>>> > > from my file for a successful import.
>>>
>>> > > --
>>> > > Praneeth
>>>
>>> > --
>>> > You received this message because you are subscribed to the Google Groups
>>> > "web2py-users" group.
>>> > To post to this group, send email to web...@googlegroups.com.
>>> > To unsubscribe from this group, send email to
>>> > web2py+unsubscr...@googlegroups.com
>>> > .
>>> > For more options, visit this group at
>>> >http://groups.google.com/group/web2py?hl=en.
>>>
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To post to this group, send email to web...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/web2py?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Postgresql interface buggy

2010-01-27 Thread Thadeus Burgess
This is most likely a bug, would you be willing to provide more
information on the matter?

For simplicities sake, drop your tables with the DAL by doing

db.table.drop()

Then you will have a fresh start when you remove this command.

-Thadeus





On Wed, Jan 27, 2010 at 3:37 PM, Johann Spies  wrote:
> How do I recreate a database setup using web2py?

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] crud newbie > getting invalid function

2010-01-27 Thread Thadeus Burgess
can you give an example of the more complex example?

-Thadeus





On Wed, Jan 27, 2010 at 2:20 PM, weheh  wrote:
> I'm a crud newbie. I've read the doc v2 on crud and think I understand
> it. So I tried the following:
>
> #model
> db = DAL('sqlite://storage.sqlite')
> from gluon.tools import *
> crud=Crud(globals(),db)
>
> db.define_table('test',Field('name','string'));
>
> #default.py controller
> def data:  return dict(form=crud())
>
> This works just fine with the various crud actions. But then I tried a
> more complex example and I get the "invalid function" page. I'm not
> sure what this means. Any hints?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread Thadeus Burgess
Bugs must be squashed!

You said so yourself a bug is not to be backwards compatible.

This isn't really a bug but a design oversight, since it was
figured two forms with the same field would never reside on the same
page.

I too have use for multiple same named fields, but since it doesn't
break browsers and the app is internal I have not bothered with w3c
validation.

Then again, I have lots of CSS that is based around the ID field, so
for me it requires making lots of little changes, so I am not
supporting this change lightly, but being a bug and in the spirit of
making web2py force w3c validity as much as possible I support it.

-Thadeus





On Wed, Jan 27, 2010 at 1:45 PM, mdipierro  wrote:
> I agree it is a bug that ids may not be unique. Yet fixing this will
> break backward compatibility.
> Perhaps we can add the same strings to the class attribute without
> breaking backward compatibility but we should not remove them from id.
> What do people think?
>
> On Jan 27, 1:36 pm, Jeremy Dillworth  wrote:
>> Thanks. But I wasn't too concerned about ambiguity in the CSS. I was
>> more concerned about there being duplicate IDs in the DOM. The w3c
>> HTML validator flags this kind of thing as a problem. As far as I know
>> it doesn't create a problem in any current browser (other than making
>> document.getElementById useless), but since these IDs are only used
>> for CSS, wouldn't it be safer to move these labels into the class
>> attributes and modify the default stylesheets as needed?
>>
>> Thanks
>>
>> Jeremy
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-27 Thread Thadeus Burgess
Doesn't that break backwards compatibility ?

-Thadeus





On Wed, Jan 27, 2010 at 1:38 PM, mdipierro  wrote:
> I just made this default in trunk.
>
> On Jan 27, 10:42 am, Thadeus Burgess  wrote:
>> You need to define the appropriate csv.QOUTES type. You probably have
>> csv.QOUTES_MINIMAL (which is the web2py default)
>>
>> Try the following
>>
>> import csv
>> db(query).select().export_to_csv_file(s, delimiter=',', quotechar='"',
>> quoting=csv.QUOTE_NONNUMERIC)
>> db.import_from_csv_file(s, delimiter=',', quotechar='"',
>> qouting=csv.QOUTE_NONNUMERIC)
>>
>> -Thadeus
>>
>> On Wed, Jan 27, 2010 at 10:11 AM, mdipierro  wrote:
>> > this sounds like a bug but more of a bug in the csv module than in
>> > web2py.
>> > Anyway, it needs some testing. I will put this in my queue but it
>> > would help if somebody else can also look into this. The only export/
>> > import functions are in gluon/sql.py (for Table and for SQLDB).
>>
>> > On Jan 27, 8:55 am, Praneeth  wrote:
>> > > Hello folks,
>>
>> > > I was wondering if anyone faced this problem before. I was migrating a
>> > > database from sqlite to MySQL and had to do a db.export_to_csv_file. My
>> > > database contains strings with a carriage return. Seems like the export
>> > > creates carriage returns in the CSV file resulting in a failure when
>> > > doing a db.import_from_csv_file. I manually removed the carriage returns
>> > > from my file for a successful import.
>>
>> > > --
>> > > Praneeth
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups
>> > "web2py-users" group.
>> > To post to this group, send email to web...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > web2py+unsubscr...@googlegroups.com
>> > .
>> > For more options, visit this group at
>> >http://groups.google.com/group/web2py?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] put line in variable in view

2010-01-27 Thread Thadeus Burgess
print f.write(line.xml())

the xml function returns a string which is the xml representation of
the helper object.

-Thadeus





On Wed, Jan 27, 2010 at 11:24 AM, Wes James  wrote:
> What is the best way to put this in to a variable so I can output it
> in a view and write it to a file:
>
> line=XML('Name:' + {{=schol.name}} + '')
>
> {{=line}}
>
> {{f = open('/tmp/workfile', 'w')
> print f.write(line)
> }}
>
>
> line=XML() is not plain text is it?  just can't do f.write on it - hmm
> looking at the manual it looks like I can.
>
> ??? not sure where I should write this file while rendering view -
> /tmp should be ok, right?
>
> -wes
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: db.export_to_csv_file and Carriage Return

2010-01-27 Thread Thadeus Burgess
You need to define the appropriate csv.QOUTES type. You probably have
csv.QOUTES_MINIMAL (which is the web2py default)

Try the following

import csv
db(query).select().export_to_csv_file(s, delimiter=',', quotechar='"',
quoting=csv.QUOTE_NONNUMERIC)
db.import_from_csv_file(s, delimiter=',', quotechar='"',
qouting=csv.QOUTE_NONNUMERIC)

-Thadeus




On Wed, Jan 27, 2010 at 10:11 AM, mdipierro  wrote:

> this sounds like a bug but more of a bug in the csv module than in
> web2py.
> Anyway, it needs some testing. I will put this in my queue but it
> would help if somebody else can also look into this. The only export/
> import functions are in gluon/sql.py (for Table and for SQLDB).
>
> On Jan 27, 8:55 am, Praneeth  wrote:
> > Hello folks,
> >
> > I was wondering if anyone faced this problem before. I was migrating a
> > database from sqlite to MySQL and had to do a db.export_to_csv_file. My
> > database contains strings with a carriage return. Seems like the export
> > creates carriage returns in the CSV file resulting in a failure when
> > doing a db.import_from_csv_file. I manually removed the carriage returns
> > from my file for a successful import.
> >
> > --
> > Praneeth
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread Thadeus Burgess
while im working on getting a patch together.

did you decide on how we want to handle markdown/__init__.py ?

-Thadeus




On Wed, Jan 27, 2010 at 10:00 AM, mdipierro  wrote:

> No objection. send me a patch.
>
> On Jan 27, 9:45 am, Thadeus Burgess  wrote:
> > On this same topic when you define an SQLFORM.factory() it appends
> > 'no_table' as the name.
> >
> > Would it be difficult to add a way to pass a tablename to factory, so
> that
> > my CSS will stay logical when I use SQLFORM or SQLFORM.factory?
> >
> > -Thadeus
> >
> > On Wed, Jan 27, 2010 at 8:31 AM, mdipierro 
> wrote:
> > > The ids are only used for CSS. you can do
> >
> > > form1=SQLFORM(...,_class='form1')
> > > form1.accepts(request.post_vars,formname=None)
> > > form2=SQLFORM(...,_class='form2')
> > > form2.accepts(request.post_vars,formname=None)
> > > return dict(form1=form1,form2=form2)
> >
> > > and you can use the class to refer to the id of the first or the
> > > second in CSS. There should be no ambiguity.
> >
> > > Massimo
> >
> > > On Jan 27, 12:23 am, Jeremy Dillworth  wrote:
> > > > I'm building an app where I am likely to want multiple SQLFORMs on
> the
> > > > same view.
> >
> > > > Reading the manual I can see how this works using the formname
> > > > argument on the SQLFORM.accepts method.
> >
> > > > I'm a little concerned about the HTML side of things, though. I've
> > > > noticed that the HTML generated by default contains lots ids that
> will
> > > > be duplicates if you have multiple forms (e.g.  > > > id="submit_record__row">).
> >
> > > >   I'll probably want to write custom forms in my own HTML in the
> long-
> > > > run anyway, but it looks like a lot of these ids could be CSS classes
> > > > and maybe save me some trouble in cases where the SQLFORM default
> HTML
> > > > is otherwise 'good enough' (in fact I've been having some fun and
> have
> > > > a short function using xml.dom.minidom.parseString to move the ids to
> > > > the class attribute and it seems to work ok).
> >
> > > > Is there any reason why the ids are needed (other than CSS perhaps)?
> >
> > > > If not, any chance of a future version of web2py using these as
> > > > classnames?
> >
> > > > Thanks in advance and thanks for a cool web framework,
> >
> > > > Jeremy
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "web2py-users" group.
> > > To post to this group, send email to web...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > web2py+unsubscr...@googlegroups.com
> 
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/web2py?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Issues with join...

2010-01-27 Thread Thadeus Burgess
for one, if that is your actual model, your fields have absolutely no
relationship to the other tables.

> >
> > db.define_table('order_que',
> > Field('customer_code', length=30),
> > Field('paint'),
> > Field('can_size', requires=IS_IN_SET(['½ Litre', '1 Litre', '10
> > Litre', '30 Litre'])),
> > Field('pickup_time'),
> > Field('que_letter',
> > requires=IS_IN_SET([None,"A","
B","C","D","E","F"])))

needs to be

db.define_table('order_que',
   Field('customer_code', length=30),
   Field('paint', db.paint),
   Field('que_letter', db.que_letter),
...etcetc...
)

Of course your joins would never work since they never have a relationship.

I am thinking you want all orders who have a queu letter no?

rows = db(db.order_que.que_letter != None).select()

for row in rows:
   row.paint.name
   row.paint.hex
   row.customer_code
   row.pickup_time

-Thadeus




On Wed, Jan 27, 2010 at 9:19 AM, Jason Brower  wrote:

> I have the paint table and the order_que...
> I wnat to join them to show only tables that have a que_letter. (Not
> none but anything else.)
> BR,
> Jason Brower
>
> On Wed, 2010-01-27 at 06:21 -0800, mdipierro wrote:
> > This is not a valid DAL query
> > plate_que = db((db.order_que.que_letter != None)==db.paint.name).select
> > ()
> > (a!=b)==c?
> >
> > can you say in words (or in SQL) what you need to do?
> >
> > Massimo
> >
> > On Jan 27, 12:49 am, Jason Brower  wrote:
> > > I have a database as follow:
> > > # coding: utf8
> > > from datetime import datetime, date, time
> > > now = datetime.utcnow()
> > > today = date.today()
> > >
> > > db = SQLDB('sqlite://paint.sqlite')
> > >
> > > db.define_table('order_que',
> > > Field('customer_code', length=30),
> > > Field('paint'),
> > > Field('can_size', requires=IS_IN_SET(['½ Litre', '1 Litre', '10
> > > Litre', '30 Litre'])),
> > > Field('pickup_time'),
> > > Field('que_letter',
> > > requires=IS_IN_SET([None,"A","B","C","D","E","F"])))
> > >
> > > db.define_table('paint',
> > > Field('name', length=30, requires=IS_NOT_EMPTY(), unique=True),
> > > Field('base_paint', length=3, requires=IS_NOT_EMPTY()),
> > > Field('hex_color', length=6))
> > >
> > > db.define_table('tint',
> > > Field('name', length=3, requires=IS_NOT_EMPTY()))
> > >
> > > db.define_table('paint_tints',
> > > Field('paint_id', db.paint),
> > > Field('tint_id', db.tint),
> > > Field('units', 'integer'))
> > >
> > > db.order_que.paint.requires = IS_IN_DB(db, 'paint.id',  '%(name)s')
> > > db.paint_tints.paint_id.requires=IS_IN_DB(db, 'paint.id', '%(name)s')
> > > db.paint_tints.tint_id.requires=IS_IN_DB(db, 'tint.id', '%(name)s')
> > > db.order_que.customer_code.requires=IS_NOT_EMPTY()
> > >
> > > And I am trying to do a join like this...
> > > plate_que = db((db.order_que.que_letter != None) ==
> > > db.paint.name).select()
> > > But no matter what I put into order_que.que_letter I don't get any
> > > results.  Any ideas?
> > > BR,
> > > Jason
> >
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Replacing template engine

2010-01-27 Thread Thadeus Burgess
I dislike django-like templating languages.

I can't sit down and write a single simple django app without the need to
make a templatetag whose whole purpose is to format the data so I can use
djangos other broken tag models to display this data.

Django has the arugment "well our designers arn't programmers so we cant
trust them to use python in the templates". Really? Seriously? I have yet to
come across a django developer that doesn't write his own views one way or
another. He might hire a web designer to make a site, but he still goes in
afterwords and hacks the design into his templating language. And even then
that web designer has their own knowledge of django.

/rant off

the template language is one of the most divine gifts that web2py has given
us.

-Thadeus




On Wed, Jan 27, 2010 at 9:36 AM, Timothy Farrell  wrote:

>  IIRC, response._caller acts like a function decorator.  So it takes a
> function and returns a function.  I used to use Genshi like this:
>
> def renderGenshi(func):
> def _render():
> output = func()
> if not isinstance(dict, output):
> return output
> else:
> # real Genshi render code goes here
> return Genshi.render(response._view, output)
> return _render
>
> response._caller = renderGenshi
>
> Naturally it was more complicated than that, but you get the idea.
>
> That said, make sure Jinja2 is really what you want.  I thought I liked it
> until I learned that its context is immutable.  (This means you can't set
> response.title in a template and expect that change to propagate to an
> included or extended template file.  This was a deal-breaker for me.)
>
> In case you're curious, I switched off of Genshi back to web2py templates
> because Genshi only works on normal cPython platforms.  It blows up on
> Jython or AIX Python.
>
> -tim
>
>
> On 1/26/2010 9:05 PM, Thadeus Burgess wrote:
>
> Its going to be your best bet in using a different templating language. YOu
> will have to make sure to only parse your HTML requests and not
> json/download etc.
>
> Basically, response._caller is a function, that returns a string which is
> the html.
>
> So you would instead of response.render(d) you would do jinja2.render(d)
> where d is the dict returned from the action, you will of course have to
> tell jinja where to find templates and which template to render based on
> action
>
> jinja.render(d, '/applications/init/views/' + request.action+'.html')
>
> -Thadeus
>
>
>
>
> On Tue, Jan 26, 2010 at 8:24 PM, Alexandre  wrote:
>
>> Hi,
>>
>>  I want to replace web2py's template engine with Jinja 
>> 2<http://jinja.pocoo.org/2/>,
>> anyone has some experience doing something similar? I'm trying to assign
>> response._caller with a custom function, but I'm not having much success, is
>> that the right way?
>>
>>  Thanks,
>> Alexandre Rosenfeld
>>
>> Eng Comp 06 - USP São Carlos
>> FoG - http://fog.icmc.usp.br
>> IM Team - AIESEC
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To post to this group, send email to web...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> web2py+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/web2py?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: SQLFORM generating duplicate ids in HTML

2010-01-27 Thread Thadeus Burgess
On this same topic when you define an SQLFORM.factory() it appends
'no_table' as the name.

Would it be difficult to add a way to pass a tablename to factory, so that
my CSS will stay logical when I use SQLFORM or SQLFORM.factory?

-Thadeus




On Wed, Jan 27, 2010 at 8:31 AM, mdipierro  wrote:

> The ids are only used for CSS. you can do
>
> form1=SQLFORM(...,_class='form1')
> form1.accepts(request.post_vars,formname=None)
> form2=SQLFORM(...,_class='form2')
> form2.accepts(request.post_vars,formname=None)
> return dict(form1=form1,form2=form2)
>
> and you can use the class to refer to the id of the first or the
> second in CSS. There should be no ambiguity.
>
> Massimo
>
>
> On Jan 27, 12:23 am, Jeremy Dillworth  wrote:
> > I'm building an app where I am likely to want multiple SQLFORMs on the
> > same view.
> >
> > Reading the manual I can see how this works using the formname
> > argument on the SQLFORM.accepts method.
> >
> > I'm a little concerned about the HTML side of things, though. I've
> > noticed that the HTML generated by default contains lots ids that will
> > be duplicates if you have multiple forms (e.g.  > id="submit_record__row">).
> >
> >   I'll probably want to write custom forms in my own HTML in the long-
> > run anyway, but it looks like a lot of these ids could be CSS classes
> > and maybe save me some trouble in cases where the SQLFORM default HTML
> > is otherwise 'good enough' (in fact I've been having some fun and have
> > a short function using xml.dom.minidom.parseString to move the ids to
> > the class attribute and it seems to work ok).
> >
> > Is there any reason why the ids are needed (other than CSS perhaps)?
> >
> > If not, any chance of a future version of web2py using these as
> > classnames?
> >
> > Thanks in advance and thanks for a cool web framework,
> >
> > Jeremy
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Question about SQLFORM flow

2010-01-27 Thread Thadeus Burgess
no.

its rendered as html, you can style it however you like with css

i think thats what you are asking?

-Thadeus




On Wed, Jan 27, 2010 at 8:27 AM, mdipierro  wrote:

> Please ask again. I do not understand.
>
> On Jan 27, 4:54 am, leone  wrote:
> > I have a question.
> > In flow SQLFORM, accepts etc. when SQLFORM (and the its field values)
> > is rendered as html script so that is updatable only by javascript
> > functions added to returned code?
> > Thanks
> > leone
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: bug in SQLFORM.factory?

2010-01-27 Thread Thadeus Burgess
because SQLFORM.accepts does alot more meta processing before it passes to
FORM.accepts.

-Thadeus




On Wed, Jan 27, 2010 at 8:24 AM, mdipierro  wrote:

> Why
>
> def test1():
>form=SQLFORM.factory(Field("bool","boolean"))
>
>if FORM.accepts(form, request.vars, session, keepvalues=True):
>db.test.insert(bool=request.vars.bool)
>
>return dict(form=form,list=db().select(db.test.ALL))
>
> and not
>
> def test1():
>form=SQLFORM.factory(Field("bool","boolean"))
>
> if form.accepts(request.vars, session, keepvalues=True):
> db.test.insert(bool=request.vars.bool)
>
>return dict(form=form,list=db().select(db.test.ALL))
>
> ?
>
> Please check the latter, it should work fine. I check why the former
> does not.
>
>
> On Jan 27, 1:50 am, Frederik Wagner  wrote:
> > Hi .*,
> >
> > it seems to me that there is a bug saving boolean fields with
> > SQLFORM.factory forms.
> > If I define a boolean field in a table and use the standard SQLFORM to
> > make an input form, the accept function will save 'T' of 'F' to the
> > DB.
> > Whereas in the case where I create a form with SQLFORM.factory, do a
> > FORM.accept and an explicit db.insert, instead of 'F' there will be a
> > NULL on the DB.
> >
> > Here a test setup:
> >
> > DB:
> > db.define_table('test',Field('bool','boolean'))
> >
> > CONTROLLER:
> > def test1():
> > form=SQLFORM.factory(Field("bool","boolean"))
> >
> > if FORM.accepts(form, request.vars, session, keepvalues=True):
> > db.test.insert(bool=request.vars.bool)
> >
> > return dict(form=form,list=db().select(db.test.ALL))
> >
> > def test2():
> > form=SQLFORM(db.test)
> >
> > if form.accepts(request.vars, session, keepvalues=True):
> > response.flash = 'done'
> >
> > return dict(form=form,list=db().select(db.test.ALL))
> >
> > test1 gives 'True' ('T') and 'None' (NULL) and test2 'True' ('T') and
> > 'False' ('F').
> >
> > A bug or my problem? :-)
> >
> > Bye
> > Frederik
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Web2py for PHP

2010-01-27 Thread Thadeus Burgess
**falls in love with redbean

-Thadeus




On Wed, Jan 27, 2010 at 7:43 AM, desfrenes  wrote:

> oh...
>
> "You must prepend '\' before global names (global class names,
> function names etc."
>
> Wrong, global functions names don't need this. But then that makes it
> another exception ;-)
>
> On 27 jan, 13:09, Beerc  wrote:
> > Don't mock the humpbacked, please :).
> >
> > The correct syntax is Windows-like, to ease the work of the PHP
> > interpreter:
> > namespaces\that\look\like\paths
> >
> > Quote: "Of course, it would be great if PHP used a ‘.’ period for
> > public methods, static methods, and namespaces. That would make it
> > consistent with Java, C#, JavaScript, Python and many other languages.
> > Unfortunately, PHP’s history and backwards compatibility makes that
> > difficult to achieve."
> >
> > According to PHP traditions, there are many exceptions in teh usage:
> > * Nested namespaces aren't allowed.
> > * Neither functions nor constants can be imported via the use
> > statement, use statements affects only namespaces and class names.
> > * You must prepend '\' before global names (global class names,
> > function names etc.).
> > * If you want to define a constant in a namespace, you will need to
> > specify the namespace in your call to define(), but class and function
> > names inside namespace are automatically prefixed with the namespace
> > name.
> > * The namespace declaration statement must be the very first statement
> > in the file.
> >
> > According to PHP traditions, there are some performance hits in teh
> > usage:
> > * Inside namespaces, calls to unqualified functions are resolved at
> > run-time.
> > * Inside namespaces, calls to unqualified or qualified class names
> > (not _fully_ qualified class names) are resolved at run-time.
> > * Calls to internal functions in namespaces are slower, because PHP
> > first looks for such function in the current namespace.
> > * Calls to static methods are slower, because PHP first tries to look
> > for corresponding function in namespace.
> >
> > On Jan 26, 4:57 pm, pistacchio  wrote:
> >
> > > you are right, desfrenes, it has namespace (indeed, it has gained
> > > namespaces only lately), but, talking about elegance, adding
> > > namespaces/that/look/like/paths is not what i consider a "wow" design
> > > decision :)
> >
> > > On Jan 26, 1:49 pm, desfrenes  wrote:
> >
> > > > You're right, Python is (much more) elegant. But you're wrong, PHP
> has
> > > > namespaces.
> >
> > > > On 25 jan, 18:27, pistacchio  wrote:
> >
> > > > > python is a very elegant and mature language. php has gained a huge
> > > > > popularity more for the moment when it came out that for the
> goodness
> > > > > of the language itself. it has a broken object system, no
> namespaces
> > > > > and so on.
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/web2py?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



<    5   6   7   8   9   10   11   12   13   14   >