[web2py] Tr.lời: Re: Site wide single sign on?

2011-04-27 Thread toan75
I can use one Auth (login,permission,...) for many app (same users)? 

Vào 02:38:21 UTC+7 Thứ tư, ngày 27 tháng hai năm 2008, mdipierro đã viết:


 Not sure what you are trying to do.

 other_session=gluon.fileutils.get_session('other_app')

 allow this app to steal the session vars of another app (if it is not  
 locked).

 Massimo

 On Feb 26, 2008, at 12:32 PM, Michael Wills wrote:

  With session ids stored separately for each app, would a good way  
  to implement site SSO be by, say
  - adding a 'site_session' field to a user
  - save the site_session after authentication
  - check the site_session in apps that need to check for SSO
 
  Something along those lines?
 
  Michael
 
  



[web2py] Re: How to search by date?

2011-04-27 Thread cyber
Thank you Brian!
It works perfectly. But there is one trouble.

If I use query with two dates:
   results=db(db.autos.dt=d1  db.autos.dt=d2).select()
there is no result at all.

But if I use only first date:
   results=db(db.autos.dt=d1).select()
there is correct result.

*

On 27 апр, 01:15, Brian M bmere...@gmail.com wrote:
 Tell web2py that those fields are supposed to be dates and it'll take care
 of the date format for you.

 Here's a form I use for finding stats between two dates, should be easy
 enough to modify for your purposes

 form = FORM(TABLE(TR(TD(First Date:),
                     TD(
                         INPUT(_type=text,
                             _name=start_date,
                             _id=start_date,
                             _class='date',
                             _value=start_date,
                             requires=[IS_DATE(error_message=Invalid Date
 Entered)]))),
                 TR(
                     TD(Second Date:),
                     TD(INPUT(_type=text,
                         _name=end_date,
                         _id=end_date,
                         _class='date',
                         _value=end_date,
                         requires=[IS_DATE(error_message=Invalid Date
 Entered)]))),
                 TR(INPUT(_type=submit, _value=Get Stats

 Then when you validate the form, your dates will be converted to python date
 objects for you  your query should work.

 if form.accepts(request.vars, session, keepvalues=True):
         start_date = form.vars.start_date
         end_date = form.vars.end_date

Re: [web2py] Re: How to search by date?

2011-04-27 Thread Vasile Ermicioi
I think it should be

db((db.autos.dt=d1)  (db.autos.dt=d2)).select()


[web2py] Re: Deploying DB

2011-04-27 Thread ron_m
The duplicate .table files from what I can tell come from using different 
database connection strings. I haven't looked for the code but I do know if 
I change the database type, user name etc in the DAL() connection string 
parameter it appears to generate a hash code from the string and prefix that 
onto the table name and then .table as the extension. 

If you were to look in your development environment I am guessing one of the 
prefixes in your production set matches and if the production db connection 
string is different I am reasonably sure it will be using the other set of 
.table files. Except for SQLite I have found it only makes sense to preserve 
the database directory across installation instances if you use the exact 
same database connection string in both installations. Then I copy the 
database across using the database specific dump restore. If I get the 
tables already created error because I changed something I drop the 
database, clear out the databases directory, create an empty database, run 
the application up once to create an empty table and relations set and then 
load the data using the import from cvs file method. Now that I know what 
fake_migrate does I might try that next time by just deleting the .table 
files.

My db is small containing configuration data for the application mostly so 
it isn't much of a hardship to toss these around. When the db is large it is 
a totally different matter that requires a lot more effort and time.


[web2py] Re: Janrain Alternative: SimpleAuth (And its totally free)

2011-04-27 Thread stefaan
 I just came across this site: simpleauth.com, its a Janrain
 alternative that allows for 3rd party authentication on websites, and
 the best part of it is that its totally free.

Maybe I'm just being paranoid, but how do we know it's not just
collecting people's
passwords?


[web2py] Re: How to search by date?

2011-04-27 Thread cyber
Hmm... the same result.
And it's due to my db.table I think.

db.define_table('autos',
...
   Field('dt', 'datetime', default=now,
requires=IS_DATETIME(format='%d/%m/%Y %H:%M:%S'))
...
)

How to restyle form.vars (2011-04-27) to required format?

**


[web2py] Re: How to search by date?

2011-04-27 Thread villas
If you're looking for rows between the two dates,  try:

db((db.autos.dt=d1)  (db.autos.dt=d2)).select()


On Apr 27, 10:13 am, cyber vlad.mul...@gmail.com wrote:
 Hmm... the same result.
 And it's due to my db.table I think.

 db.define_table('autos',
 ...
    Field('dt', 'datetime', default=now,
 requires=IS_DATETIME(format='%d/%m/%Y %H:%M:%S'))
 ...
 )

 How to restyle form.vars (2011-04-27) to required format?

 **


[web2py] Re: Tr.lời: Re: Site wide single sign on?

2011-04-27 Thread villas
Nothing stops you from sharing the same DB for auth across all apps.


On Apr 27, 7:15 am, toan75 toa...@gmail.com wrote:
 I can use one Auth (login,permission,...) for many app (same users)?

 Vào 02:38:21 UTC+7 Thứ tư, ngày 27 tháng hai năm 2008, mdipierro đã viết:



  Not sure what you are trying to do.

  other_session=gluon.fileutils.get_session('other_app')

  allow this app to steal the session vars of another app (if it is not  
  locked).

  Massimo

  On Feb 26, 2008, at 12:32 PM, Michael Wills wrote:

   With session ids stored separately for each app, would a good way  
   to implement site SSO be by, say
   - adding a 'site_session' field to a user
   - save the site_session after authentication
   - check the site_session in apps that need to check for SSO

   Something along those lines?

   Michael




[web2py] Short URL app

2011-04-27 Thread Francisco Costa
Does anyone know any short url application made in web2py?
If not, how would you do it?


[web2py] Re: web2py 1.95.1 and open issues

2011-04-27 Thread Iceberg
On Apr 25, 10:06 pm, Massimo Di Pierro mdipie...@cs.depaul.edu
wrote:
 Hello everybody,

 web2py 1.95.1 is out with lots of improvements and bug fixes:
 - ..

 Please check it out.

 I have many pending patches still to be applied and tested:
 - those documented in googlecode issues
 - the new custom_import

 Is there any outstanding issue that has not been submitted as an issue to 
 googlecode?

 Massimo


Nice job. I start using it now, so far so good.

But seems the latest suggestion for issue 221 is not in yet?
http://code.google.com/p/web2py/issues/detail?id=221

Regards,
Iceberg


Re: [web2py] Short URL app

2011-04-27 Thread Bruno Rocha
There was ru.ly app, but it appears to be offline.
Em 27/04/2011 08:25, Francisco Costa m...@franciscocosta.com escreveu:
 Does anyone know any short url application made in web2py?
 If not, how would you do it?


[web2py] Form submissions from dialog

2011-04-27 Thread Crow
I am trying to submit a form from a modal dialog through jQuery. Here
is the view loading the components.

library.py

@auth.requires_login()
def index():
return dict()

@auth.requires_login()
def add_book():
return dict(bform = crud.create(db.book),aform =
crud.create(db.author))

@auth.requires_login()
def show():
books = db().select(db.book.ALL)
return dict(books=books)

library/index.html

{{extend 'layout.html'}}
div id=booklist
{{=LOAD(c='library',f='show.load', ajax=True)}}
/div
div id=controls
{{=LOAD(c='library',f='add_book.load', ajax=True)}}
/div

library/add_book.load

script
$(document).ready(function(){
$(#add-book).button().click(function() {$(#add-book-
form).dialog(open);});
$(#add-book-form).dialog({
autoOpen: false,
width: 500,
modal: true,
buttons: { Cancel:function() { $(this).dialog(close);}}
});
});
/script
button id=add-bookAdd a book/button

div id=add-book-form title=Add a book
div id=bookform
{{=bform}}
/div
/div
script
$(document).ready(function(){
$(#add-author).button().click(function() {$(#add-author-
form).dialog(open);});
$(#add-author-form).dialog({
autoOpen: false,
width: 500,
modal: true,
buttons: { Cancel:function() { $(this).dialog(close);}}
});
});
/script
button id=add-authorAdd an author/button

div id=add-author-form title=Add an author
div id=authorform
{{=aform}}
/div
/div


The dialog loads correctly, and closes when submit is clicked. However
the data is not submitted into the database.
Please advise on what I am missing, or if you have any ideas on how it
can be improved.


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

2011-04-27 Thread toan75
Hi,
In new version: crud.update work only with deletable=False?



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

2011-04-27 Thread Massimo Di Pierro
I do not think so. It was not touched. Can you provide an example of
the problem?

On Apr 27, 7:17 am, toan75 toa...@gmail.com wrote:
 Hi,
 In new version: crud.update work only with deletable=False?


[web2py] Re: the '|' charachter i text fields

2011-04-27 Thread Massimo Di Pierro
My guess is that you are passing a list instead of a string of text.
In order to put a list into a text field, web2py joins the elements
using a '|'.

In your code I do not see where you do insert.

On Apr 27, 12:36 am, mart msenecal...@gmail.com wrote:
 woops! almost forgot, in the sqlite db, the log field will have
 something like this:

 |'', 'java.lang.NoClassDefFoundError: org/antlr/Tool\r|Caused by:
 java.lang.ClassNotFoundException: org.antlr.Tool\r|\tat
 java.net.URLClassLoader$1.run(Unknown Source)\r|\tat
 java.security.AccessController.doPrivileged(Native Method)\r|\tat
 java.net.URLClassLoader.findClass(Unknown Source)\r|\tat
 java.lang.ClassLoader.loadClass(Unknown Source)\r|\tat
 sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)\r|\tat
 java.lang.ClassLoader.loadClass(Unknown Source)\r|Could not find the
 main class: org.antlr.Tool.  Program will exit.\r|Exception in thread
 main '|

 On Apr 27, 1:33 am, mart msenecal...@gmail.com wrote:







  Hi,

  so, this part is done using DAL (scripted).

  I use subprocess like below to run external scripts and stuff. when
  failures, I want to dump the log in the DB.

  proc = subprocess.Popen(strCmd,shell=True,
                          stdin=subprocess.PIPE,
                          stdout=subprocess.PIPE,
                          stderr=subprocess.PIPE)

              if updStr is None:
                  out = proc.communicate()
                  ... bla bla
                  if len(out[1])0:

  so the resulting 'out[1] gets stored in the DB.

  here's an example of one of the tables:

          db.define_table('scriptCompiler',
                  Field('uuid',length=64,default=uuid.uuid4()),
                  Field('cmdName'),
                  Field('scriptCompiler_directory'),
                  Field('log','text'))
          db.commit()

  I use 'text' to provide for larger logs.

  thanks for your help! :)

  Mart

  On Apr 27, 12:03 am, Massimo Di Pierro massimo.dipie...@gmail.com
  wrote:

   No. Can you provide an example of code that make that happen?

   On Apr 26, 7:17 pm, mart msenecal...@gmail.com wrote:

Hi,

is it expected for a text field to split the text on line breaks and
insert the '|' character? If yes, is there a way to change that
behavior?

Thanks,
Mart :)


[web2py] Re: crud challenge

2011-04-27 Thread villas
Thanks Denes, this was an interesting exercise and it is good that you
are giving us the benefit of this knowledge.  I suppose like many,  I
thought about the challenge,  but couldn't figure it out.

On Apr 26, 7:49 pm, DenesL denes1...@yahoo.ca wrote:
 Since I have not received any answers here is how to do it.

 The problem is that to create the links as requested you need access
 to the whole subheading record, and the internal processing of crud
 and SQLTABLE only gives you access to the value of one of the fields
 at a time.

 So how can you get to all values in a record?.

 Using virtual fields, by adding these to the MODEL e.g.:

 class HeadSubs:
   def linksub(self):
     return A(self.heading.title,
 _href=URL('list_subheadings',args=[self.heading.id]))

 db.heading.virtualfields.append(HeadSubs())

 so now table 'heading' has a 'linksub' virtual field.
 Note how you can use any field from the same row to build the virtual
 one.

 Following one of Massimo's recent videos the CONTROLLER looks like
 this:

 def reload(target): # note1
   def js(form):
     response.js='web2py_component(%s,%s)' %(URL(target),target)
   return js

 def index():
   return dict()

 def list_headings():
   return dict(
     form=crud.select(
       db.heading,
       orderby=db.heading.sequence,
       columns=['heading.linksub'] ) # note2
     or 'no headings')

 def add_heading():
   return dict(
     form=crud.create(
       db.heading,
       onaccept=reload('list_headings'))) # note3

 note1: to understand how this works look up python nested functions,
 but it is akin to a closure.

 note2: with 'columns' we select only the virtual field which has the
 link in the requested format.

 note3: this will force a reload of 'list_headings' after a sucessfull
 insertion.

 To complete the use of components, the VIEW:

 {{extend 'layout.html'}}
 h2Headings/h2
 {{=LOAD(request.app, 'list_headings.load', ajax=True,
 target='list_headings')}} # note4
 h3Add heading/h3
 {{=LOAD(request.app, 'add_heading.load', ajax=True)}}

 note4: the target is what ties the reload code near note3.

 The use of virtual fields could be further expanded, for example
 creating elements that have onclick using web2py_component to load
 other parts.

 Hope you find it useful.


[web2py] Re: Documentation web2py

2011-04-27 Thread villas
It is tricky for book editors to write new sections for the book for
various reasons:
e.g.

- Editors do not usually know the full background and intent of new
features.

- As new features are always introduced as unstable, it is too early
to document them.  Typically there are relevant group postings
(sometimes split between the two groups),  but these are easily
fragmented and lost.

- Once features are documented in the book, Massimo tends to consider
them eligible for backward-compatibility. Therefore that decision is
very important and is beyond the scope of an editor and can only be
made by a core developer.

We do need to agree a new work-flow.  Here are a couple of questions
to move the discussion forward a little:

1. Does Massimo intend to review, overhaul and re-issue a new edition
of the book annually?

2. Perhaps we could add sections to the book (e.g. in a different
color) which are clearly identified as unstable/experimental?  Or
perhaps, the wiki idea (by VP) is better for that?

3. Can Massimo introduce some way of informing when a feature is
considered stable and therefore ready for formal inclusion in the
book?

Thanks, D


[web2py] Re: Documentation web2py

2011-04-27 Thread Massimo Di Pierro
I do not have definitive answers.

I will try review the book annually, usually in August. When I do this
is the process:
- I diff the online book with the printed book
- I go over the logs to see which features are undocumented and need
documenting
- If I add documentation then it becomes a stable backward compatible
feature (*)
- I publish the new book

(*) it is a bit of a chicken and egg issue. It is stable if I feel it
is useful and general enough based on my expectation, actual usage and
discussions on the mailing lists. There is no formula for making this
decision. If you feel something needs improvement you can always raise
up the issue on the mailing list and that will prevent the feature to
become stable.

Massimo


On Apr 27, 8:09 am, villas villa...@gmail.com wrote:
 It is tricky for book editors to write new sections for the book for
 various reasons:
 e.g.

 - Editors do not usually know the full background and intent of new
 features.

 - As new features are always introduced as unstable, it is too early
 to document them.  Typically there are relevant group postings
 (sometimes split between the two groups),  but these are easily
 fragmented and lost.

 - Once features are documented in the book, Massimo tends to consider
 them eligible for backward-compatibility. Therefore that decision is
 very important and is beyond the scope of an editor and can only be
 made by a core developer.

 We do need to agree a new work-flow.  Here are a couple of questions
 to move the discussion forward a little:

 1. Does Massimo intend to review, overhaul and re-issue a new edition
 of the book annually?

 2. Perhaps we could add sections to the book (e.g. in a different
 color) which are clearly identified as unstable/experimental?  Or
 perhaps, the wiki idea (by VP) is better for that?

 3. Can Massimo introduce some way of informing when a feature is
 considered stable and therefore ready for formal inclusion in the
 book?

 Thanks, D


[web2py] Re: Strange behavior in layout files

2011-04-27 Thread Anthony
On Tuesday, April 26, 2011 11:34:48 PM UTC-4, pbreit wrote: 

 Is there any advantage to the append approach? (besides being able to 
 trigger a load from somewhere else)

 
If you look at web2py_ajax.html, you can see it inserts jquery.js, 
calendar.css, and calendar.js as the first three linked files before any of 
the existing response.files, so I guess using response.files.append ensures 
your files come after jquery.js. It might also make it a little easier to 
dynamically control (from a controller) which files are included (rather 
than hard-coding or adding logic in the view).
 
Anthony


Re: [web2py] Re: Documentation web2py

2011-04-27 Thread Gilson Filho
But needing some help, we're here =)
_
*Gilson Filho*
*Web Developer
http://gilsondev.com*



2011/4/27 Massimo Di Pierro massimo.dipie...@gmail.com

 I do not have definitive answers.

 I will try review the book annually, usually in August. When I do this
 is the process:
 - I diff the online book with the printed book
 - I go over the logs to see which features are undocumented and need
 documenting
 - If I add documentation then it becomes a stable backward compatible
 feature (*)
 - I publish the new book

 (*) it is a bit of a chicken and egg issue. It is stable if I feel it
 is useful and general enough based on my expectation, actual usage and
 discussions on the mailing lists. There is no formula for making this
 decision. If you feel something needs improvement you can always raise
 up the issue on the mailing list and that will prevent the feature to
 become stable.

 Massimo


 On Apr 27, 8:09 am, villas villa...@gmail.com wrote:
  It is tricky for book editors to write new sections for the book for
  various reasons:
  e.g.
 
  - Editors do not usually know the full background and intent of new
  features.
 
  - As new features are always introduced as unstable, it is too early
  to document them.  Typically there are relevant group postings
  (sometimes split between the two groups),  but these are easily
  fragmented and lost.
 
  - Once features are documented in the book, Massimo tends to consider
  them eligible for backward-compatibility. Therefore that decision is
  very important and is beyond the scope of an editor and can only be
  made by a core developer.
 
  We do need to agree a new work-flow.  Here are a couple of questions
  to move the discussion forward a little:
 
  1. Does Massimo intend to review, overhaul and re-issue a new edition
  of the book annually?
 
  2. Perhaps we could add sections to the book (e.g. in a different
  color) which are clearly identified as unstable/experimental?  Or
  perhaps, the wiki idea (by VP) is better for that?
 
  3. Can Massimo introduce some way of informing when a feature is
  considered stable and therefore ready for formal inclusion in the
  book?
 
  Thanks, D



[web2py] Re: Documentation web2py

2011-04-27 Thread Massimo Di Pierro
I need you help. Mostly in editing the online book. Anybody can do
that, users just need to ask me to become editors.

Do not worry about creating new sections. Just add the text where it
seems more appropriate. When I review it (probably in August) I may
move the content.

New features, even if experimental, should be better documented. I
will add a page (section) on new experimental features. That section
will not go in the printed book but parts will be used in the printed
book.

Massimo

On Apr 27, 8:24 am, Gilson Filho cont...@gilsondev.com wrote:
 But needing some help, we're here =)
 _
 *Gilson Filho*
 *Web Developerhttp://gilsondev.com*

 2011/4/27 Massimo Di Pierro massimo.dipie...@gmail.com







  I do not have definitive answers.

  I will try review the book annually, usually in August. When I do this
  is the process:
  - I diff the online book with the printed book
  - I go over the logs to see which features are undocumented and need
  documenting
  - If I add documentation then it becomes a stable backward compatible
  feature (*)
  - I publish the new book

  (*) it is a bit of a chicken and egg issue. It is stable if I feel it
  is useful and general enough based on my expectation, actual usage and
  discussions on the mailing lists. There is no formula for making this
  decision. If you feel something needs improvement you can always raise
  up the issue on the mailing list and that will prevent the feature to
  become stable.

  Massimo

  On Apr 27, 8:09 am, villas villa...@gmail.com wrote:
   It is tricky for book editors to write new sections for the book for
   various reasons:
   e.g.

   - Editors do not usually know the full background and intent of new
   features.

   - As new features are always introduced as unstable, it is too early
   to document them.  Typically there are relevant group postings
   (sometimes split between the two groups),  but these are easily
   fragmented and lost.

   - Once features are documented in the book, Massimo tends to consider
   them eligible for backward-compatibility. Therefore that decision is
   very important and is beyond the scope of an editor and can only be
   made by a core developer.

   We do need to agree a new work-flow.  Here are a couple of questions
   to move the discussion forward a little:

   1. Does Massimo intend to review, overhaul and re-issue a new edition
   of the book annually?

   2. Perhaps we could add sections to the book (e.g. in a different
   color) which are clearly identified as unstable/experimental?  Or
   perhaps, the wiki idea (by VP) is better for that?

   3. Can Massimo introduce some way of informing when a feature is
   considered stable and therefore ready for formal inclusion in the
   book?

   Thanks, D


[web2py] Tr.lời: Re: Tr.lời: Re: Site wide single sign on?

2011-04-27 Thread toan75
Thank for reply.
- I need create only one DB for all app or one Auth db + others app db?
- Please explain to me how to automatically login when switching to another 
application?
Many thanks.


[web2py] Re: crud challenge

2011-04-27 Thread DenesL

It takes some time to figure out and understand everything that goes
on, that is why I thought of sharing it via an exercise first, maybe
somebody else could come up with a different solution.

Anyway, it is good to hear that there were people trying and that the
info might be useful.
Thanks for the input. Further discussion is always welcome.


On Apr 27, 8:37 am, villas villa...@gmail.com wrote:
 Thanks Denes, this was an interesting exercise and it is good that you
 are giving us the benefit of this knowledge.  I suppose like many,  I
 thought about the challenge,  but couldn't figure it out.


[web2py] Re: Filtering by date range (SQL date tye)

2011-04-27 Thread DenesL

Nice tip!, thanks.


On Apr 26, 10:09 pm, Brian M bmere...@gmail.com wrote:
 Also try the dateutil module fromhttp://niemeyer.net/python-dateutil

 examples:

  NOW = datetime.now()
  NOW+relativedelta(months=+1, weeks=+1)

 datetime.datetime(2003, 10, 24, 20, 54, 47, 282310)

  relativedelta(datetime(2003, 10, 24, 10, 0), TODAY)

 relativedelta(months=+1, days=+7, hours=+10)


Re: [web2py] Re: Janrain Alternative: SimpleAuth (And its totally free)

2011-04-27 Thread Tom Atkins
I just emailed SImpleAuth support and got this reply back from Mike (which
he agreed I could post here):

-

We completely understand the concerns. The founders (I'm one of them) are
all developers and we built SimpleAuth because it's just what we needed as
well. Every developer needs this at some point for most sites.

I can't go much into the specifics just yet, but we've got some pretty neat
stuff in the pipeline that will be the revenue driver, but the
SSO/Sharing/Contacts will always be free in their full glory.
SimpleAuth also addresses a major issue with the largest commercial player
in the market -- the fact that with other services, your provider API Keys
are tied to their domain (YOURNAME.THEIRDOMAIN.COM). With SimpleAuth, you
create a CNAME and all the API Keys from the providers are tied to your
domain. Should the unthinkable happen, you won't be left out in the cold
asking your users to re-register.
We're like the SimpleGeo of SSO/sharing/contacts.
I'm aware that the answer is a bit vague, but that's all I can share at the
moment about what's coming in the future.
If you have questions during implementation, feel free to shoot us an email
(our only support method at this time) and we'll be glad to help.

And, to alleviate the concerns about grabbing passwords, villas is
absolutely correct - no password is ever entered by anyone on SimpleAuth (or
sites that integrate SimpleAuth). Users are always redirected to the
selected provider and everything from that point forward happens with the
beautiful token dance.

If I'm not overextending my welcome... There's sample code on the site in
PHP. If anyone from your community comes up with wrappers, sample code, etc
for web2py... though we can't officially support it, we'd be happy to set
up a wiki or forum for that to be shared with future users, too.

---

All sounds pretty good to me!

On 27 April 2011 11:35, villas villa...@gmail.com wrote:

 Your password should only be entered into the authentication site,
 e.g. if you log in via Google you should only enter your password into
 a browser window which shows a Google url.

 On Apr 27, 9:57 am, stefaan stefaan.hi...@gmail.com wrote:
   I just came across this site: simpleauth.com, its a Janrain
   alternative that allows for 3rd party authentication on websites, and
   the best part of it is that its totally free.
 
  Maybe I'm just being paranoid, but how do we know it's not just
  collecting people's
  passwords?



[web2py] Code insert-er for Pydev Eclipse users

2011-04-27 Thread pierreth
Hello,

I made a tool to automatically insert the code necessary to avoid the
errors and warnings reported by Eclipse Pydev cause by the automatic
imports of web2py.

http://code.google.com/p/neo-insert-imports/

Tell me if you like.


[web2py] Re: Janrain Alternative: SimpleAuth (And its totally free)

2011-04-27 Thread Massimo Di Pierro
If they have php examples, chances are it works like janrain. It
should be possible to modify

   gluon/contrib/login_methods/rpx_account.py

and just change the URLs and variable names in there.
If you could start working on this it would be great. If you want me
to take a look, it would save me time if you could point me to the php
example.

Massimo

On Apr 27, 9:40 am, Tom Atkins minkto...@gmail.com wrote:
 I just emailed SImpleAuth support and got this reply back from Mike (which
 he agreed I could post here):

 -

 We completely understand the concerns. The founders (I'm one of them) are
 all developers and we built SimpleAuth because it's just what we needed as
 well. Every developer needs this at some point for most sites.

 I can't go much into the specifics just yet, but we've got some pretty neat
 stuff in the pipeline that will be the revenue driver, but the
 SSO/Sharing/Contacts will always be free in their full glory.
 SimpleAuth also addresses a major issue with the largest commercial player
 in the market -- the fact that with other services, your provider API Keys
 are tied to their domain (YOURNAME.THEIRDOMAIN.COM). With SimpleAuth, you
 create a CNAME and all the API Keys from the providers are tied to your
 domain. Should the unthinkable happen, you won't be left out in the cold
 asking your users to re-register.
 We're like the SimpleGeo of SSO/sharing/contacts.
 I'm aware that the answer is a bit vague, but that's all I can share at the
 moment about what's coming in the future.
 If you have questions during implementation, feel free to shoot us an email
 (our only support method at this time) and we'll be glad to help.

 And, to alleviate the concerns about grabbing passwords, villas is
 absolutely correct - no password is ever entered by anyone on SimpleAuth (or
 sites that integrate SimpleAuth). Users are always redirected to the
 selected provider and everything from that point forward happens with the
 beautiful token dance.

 If I'm not overextending my welcome... There's sample code on the site in
 PHP. If anyone from your community comes up with wrappers, sample code, etc
 for web2py... though we can't officially support it, we'd be happy to set
 up a wiki or forum for that to be shared with future users, too.

 ---

 All sounds pretty good to me!

 On 27 April 2011 11:35, villas villa...@gmail.com wrote:







  Your password should only be entered into the authentication site,
  e.g. if you log in via Google you should only enter your password into
  a browser window which shows a Google url.

  On Apr 27, 9:57 am, stefaan stefaan.hi...@gmail.com wrote:
I just came across this site: simpleauth.com, its a Janrain
alternative that allows for 3rd party authentication on websites, and
the best part of it is that its totally free.

   Maybe I'm just being paranoid, but how do we know it's not just
   collecting people's
   passwords?


[web2py] Re: Documentation web2py

2011-04-27 Thread villas
I certainly wouldn't wish to discourage anyone from editing etc by
introducing unnecessary procedures. However,  I think we need a little
more clarity.

Problem 1. If Massimo is only going to make a final decision about
backwards-compatibility on an annual basis, this is a very long time.
Could we not include this question of stability and backwards-
compatibility within the version numbering?  e.g. can we not have LTS
versions periodically?

Problem 2. The online book is currently not authoritative in any way.
The only way in which we can currently see what is really stable and
correct is by seeing what is in the printed version. Ideally the
online book would be color-coded,  or at least a diff available online
so we can see what may have been added/amended.

Problem 3. The online book may have been edited by someone with as
little knowledge as I!!  Of course I am cautious when editing,  but
shouldn't there be some guidelines for reviews by someone more
senior?

Typos and minor corrections = everyone.
Major corrections, additional examples = review by active member of
developer group.

Problem 4:  We never know what might have changed.  I believe it would
be very helpful if there was a change diff or log available for edits
so that we may see what has changed and then perhaps we can review
each other's edits more easily. In any case, I am sure that many of us
would like to know what has changed as any new examples and such can
be very interesting.

Sorry if these ideas are unpractical or burdensome, it is just my 2
cts.
Thanks,  D


Re: [web2py] Re: Janrain Alternative: SimpleAuth (And its totally free)

2011-04-27 Thread Tom Atkins
Their documentation is available after signing up (very easy as you can use
your Google (etc) account).  There's a very clear step by step PHP example
inside. Sorry I don't have time to look into this for web2py just now.

On 27 April 2011 15:47, Massimo Di Pierro massimo.dipie...@gmail.comwrote:

 If they have php examples, chances are it works like janrain. It
 should be possible to modify

   gluon/contrib/login_methods/rpx_account.py

 and just change the URLs and variable names in there.
 If you could start working on this it would be great. If you want me
 to take a look, it would save me time if you could point me to the php
 example.

 Massimo

 On Apr 27, 9:40 am, Tom Atkins minkto...@gmail.com wrote:
  I just emailed SImpleAuth support and got this reply back from Mike
 (which
  he agreed I could post here):
 
  -
 
  We completely understand the concerns. The founders (I'm one of them)
 are
  all developers and we built SimpleAuth because it's just what we needed
 as
  well. Every developer needs this at some point for most sites.
 
  I can't go much into the specifics just yet, but we've got some pretty
 neat
  stuff in the pipeline that will be the revenue driver, but the
  SSO/Sharing/Contacts will always be free in their full glory.
  SimpleAuth also addresses a major issue with the largest commercial
 player
  in the market -- the fact that with other services, your provider API
 Keys
  are tied to their domain (YOURNAME.THEIRDOMAIN.COM). With SimpleAuth,
 you
  create a CNAME and all the API Keys from the providers are tied to your
  domain. Should the unthinkable happen, you won't be left out in the cold
  asking your users to re-register.
  We're like the SimpleGeo of SSO/sharing/contacts.
  I'm aware that the answer is a bit vague, but that's all I can share at
 the
  moment about what's coming in the future.
  If you have questions during implementation, feel free to shoot us an
 email
  (our only support method at this time) and we'll be glad to help.
 
  And, to alleviate the concerns about grabbing passwords, villas is
  absolutely correct - no password is ever entered by anyone on SimpleAuth
 (or
  sites that integrate SimpleAuth). Users are always redirected to the
  selected provider and everything from that point forward happens with the
  beautiful token dance.
 
  If I'm not overextending my welcome... There's sample code on the site in
  PHP. If anyone from your community comes up with wrappers, sample code,
 etc
  for web2py... though we can't officially support it, we'd be happy to
 set
  up a wiki or forum for that to be shared with future users, too.
 
  ---
 
  All sounds pretty good to me!
 
  On 27 April 2011 11:35, villas villa...@gmail.com wrote:
 
 
 
 
 
 
 
   Your password should only be entered into the authentication site,
   e.g. if you log in via Google you should only enter your password into
   a browser window which shows a Google url.
 
   On Apr 27, 9:57 am, stefaan stefaan.hi...@gmail.com wrote:
 I just came across this site: simpleauth.com, its a Janrain
 alternative that allows for 3rd party authentication on websites,
 and
 the best part of it is that its totally free.
 
Maybe I'm just being paranoid, but how do we know it's not just
collecting people's
passwords?



Re: [web2py] Re: Documentation web2py

2011-04-27 Thread Gilson Filho
That makes sense.
_
*Gilson Filho*
*Web Developer
http://gilsondev.com*



2011/4/27 villas villa...@gmail.com

 I certainly wouldn't wish to discourage anyone from editing etc by
 introducing unnecessary procedures. However,  I think we need a little
 more clarity.

 Problem 1. If Massimo is only going to make a final decision about
 backwards-compatibility on an annual basis, this is a very long time.
 Could we not include this question of stability and backwards-
 compatibility within the version numbering?  e.g. can we not have LTS
 versions periodically?

 Problem 2. The online book is currently not authoritative in any way.
 The only way in which we can currently see what is really stable and
 correct is by seeing what is in the printed version. Ideally the
 online book would be color-coded,  or at least a diff available online
 so we can see what may have been added/amended.

 Problem 3. The online book may have been edited by someone with as
 little knowledge as I!!  Of course I am cautious when editing,  but
 shouldn't there be some guidelines for reviews by someone more
 senior?

 Typos and minor corrections = everyone.
 Major corrections, additional examples = review by active member of
 developer group.

 Problem 4:  We never know what might have changed.  I believe it would
 be very helpful if there was a change diff or log available for edits
 so that we may see what has changed and then perhaps we can review
 each other's edits more easily. In any case, I am sure that many of us
 would like to know what has changed as any new examples and such can
 be very interesting.

 Sorry if these ideas are unpractical or burdensome, it is just my 2
 cts.
 Thanks,  D


[web2py] Re: Documentation web2py

2011-04-27 Thread Ross Peoples
Just tossing my two cents in here, but documentation (especially that of 
experimental features) is really important and can make a huge difference. 
Django actually had http://www.djangobook.com/en/2.0/ which was pretty cool, 
but they haven't maintained it. It gives you two versions, a stable book, 
and an always changing book. Each section of the book can have comments 
added to it, which an editor later goes back to review and add it to the 
documentation if needed.

Maybe web2py could benefit from something like this.


[web2py] Re: Tr.lời: Re: Tr.lời: Re: Site wide single sign on?

2011-04-27 Thread villas
The design is of course your decision,  but for example,  you could
have one DB just for auth across all your apps.  Then you might have
separate DBs for each app's data.

I have never shared login sessions between apps. However, maybe
Massimo's suggestion above is helpful.

If you need such flexibility maybe you might also be interested in a
remote authentication method, e.g. Janrain (now maybe SimpleAuth
too).


On Apr 27, 3:09 pm, toan75 toa...@gmail.com wrote:
 Thank for reply.
 - I need create only one DB for all app or one Auth db + others app db?
 - Please explain to me how to automatically login when switching to another
 application?
 Many thanks.


[web2py] Re: Documentation web2py

2011-04-27 Thread Massimo Di Pierro


On Apr 27, 9:52 am, villas villa...@gmail.com wrote:
 I certainly wouldn't wish to discourage anyone from editing etc by
 introducing unnecessary procedures. However,  I think we need a little
 more clarity.

 Problem 1. If Massimo is only going to make a final decision about
 backwards-compatibility on an annual basis, this is a very long time.
 Could we not include this question of stability and backwards-
 compatibility within the version numbering?  e.g. can we not have LTS
 versions periodically?

It is not like a make the decision annually. The decision is a
process. The book is printed annulally thus making it officially.

 Problem 2. The online book is currently not authoritative in any way.
 The only way in which we can currently see what is really stable and
 correct is by seeing what is in the printed version. Ideally the
 online book would be color-coded,  or at least a diff available online
 so we can see what may have been added/amended.

I disagree.

 Problem 3. The online book may have been edited by someone with as
 little knowledge as I!!  Of course I am cautious when editing,  but
 shouldn't there be some guidelines for reviews by someone more
 senior?

So far we did not have the problem. Edits have been good and helpful.

 Typos and minor corrections = everyone.
 Major corrections, additional examples = review by active member of
 developer group.

 Problem 4:  We never know what might have changed.  I believe it would
 be very helpful if there was a change diff or log available for edits
 so that we may see what has changed and then perhaps we can review
 each other's edits more easily. In any case, I am sure that many of us
 would like to know what has changed as any new examples and such can
 be very interesting.

This is a good point. I could edit the app and publish diffs. It would
be useful but it not going to happen overnight.


[web2py] Login problems with _formkey changing

2011-04-27 Thread Ed Greenberg
I have a user of my app that is unable to log in with his (Ubuntu)
Firefox browser. He can log in with Chrome, and others can log in with
various flavors of Firefox.  He's cleared his caches, cleared his
cookies, and done all sorts of similar browser cleansing things.

I found that his session._formkey[login] does not match his submitted
_formkey. I've determined that form.accepts is returning false, and
doing so at the test of the two _formkey variables.

I put a few lines of syslog into db.py and gluon/tools.py and logged
this:

Apr 27 09:46:35 cloud1 apache2: db.py:328:session: Storage {'auth':
None}
Apr 27 09:46:35 cloud1 apache2: db.py:329:auth: None
Apr 27 09:46:35 cloud1 apache2: gluon/tools.py:1441:before form
accepted. form.vars: Storage {}
Apr 27 09:46:36 cloud1 apache2: db.py:328:session: Storage {'auth':
None, '_formkey[login]': '7fc06654-b766-4427-becf-212a27094483',
'_secure': True}
Apr 27 09:46:36 cloud1 apache2: db.py:329:auth: None
Apr 27 09:46:36 cloud1 apache2: gluon/tools.py:1441:before form
accepted. form.vars: Storage {}


Now, he types in a valid userid and password, and submits.
---Above shows the _formkey in the session 7fc0... Below, on the
submit, the session now has formkey ad22...  Yet the request.vars
still has 7fc0...


Apr 27 09:48:52 cloud1 apache2: db.py:328:session: Storage
{'_formkey[login]': 'ad2250fa-b3f6-4c23-8672-6b89b38e079f', 'auth':
None, '_secure': True}
Apr 27 09:48:52 cloud1 apache2: db.py:329:auth: None
Apr 27 09:48:52 cloud1 apache2: gluon/tools.py:1441:before form
accepted. form.vars: Storage {'username': 'cust1', '_formkey':
'7fc06654-b766-4427-becf-212a27094483', 'password': '*',
'_formname': 'login', '_next': '/InsuranceInventory/default/index'}

So on submit, something reset his session._formkey

-- having had form.accepts() returned false, tools now returns a new
form, having installed a new formkey in both the session and the form
(as confirmed by the user).

Apr 27 09:48:53 cloud1 apache2: db.py:328:session: Storage {'auth':
None, '_formkey[login]': 'c1e5-82fc-4748-b973-8306e246ffe6',
'_secure': True}
Apr 27 09:48:53 cloud1 apache2: db.py:329:auth: None
Apr 27 09:48:53 cloud1 apache2: gluon/tools.py:1441:before form
accepted. form.vars: Storage {}

-- but when the form submits, the session._formkey[login] has changed
again, while the user reports that it HASN'T changed in the browser. .

Apr 27 09:49:32 cloud1 apache2: db.py:328:session: Storage
{'_formkey[login]': 'f83c9ea3-a94b-4748-81f5-5fccf4b353fa', 'auth':
None, '_secure': True}
Apr 27 09:49:32 cloud1 apache2: db.py:329:auth: NonApr 27 09:49:32
cloud1 apache2: gluon/tools.py:1441:before form accepted. form.vars:
Storage {'username': 'cust1', '_formkey': 'c1e5-82fc-4748-
b973-8306e246ffe6', 'password': '*', '_formname': 'login',
'_next': '/InsuranceInventory/default/index'}

-- and here is a new formkey applied when the page reloads again.

Apr 27 09:49:33 cloud1 apache2: db.py:328:session: Storage {'auth':
None, '_formkey[login]': '70382e5c-08d6-4233-924c-90d646c425bd',
'_secure': True}
Apr 27 09:49:33 cloud1 apache2: db.py:329:auth: None
Apr 27 09:49:33 cloud1 apache2: gluon/tools.py:1441:before form
accepted. form.vars: Storage {}

I can't find anyplace where the session is being reset within my
code.

Can anybody tell me how to enable this user/browser? Or where else to
look?

Thanks,

Ed G


[web2py] Creating an iTunes Compatible Podcast with Web2py

2011-04-27 Thread Nite
I am attempting to create an itunes compatible podcast using the RSS
capabilities of Web2py.

Per the Book (http://web2py.com/book/default/chapter/09#RSS) the
format is as follows:

def feed():
return dict(title=my feed,
link=http://feed.example.com;,
description=my first feed,
entries=[
  dict(title=my feed,
  link=http://feed.example.com;,
  description=my first feed)
])

The issue is that iTunes compatible podcasts have XML files with
':' (colons) in the field name which is disallowed by python syntax
('itunes:name = foo' is disallowed).

Here's an example itunes podcast from the Apple site(http://
www.apple.com/itunes/podcasts/specs.html#example):

itunes:nameJohn Doe/itunes:name

Is there a way to use Web2py RSS capability to generate fields with a
colon in the name or do I need to write my own view and simply
populate the fields?







[web2py] Re: Janrain Alternative: SimpleAuth (And its totally free)

2011-04-27 Thread Nite
The Quickstart guide is accessible without logging in.

https://www.simpleauth.com/docs/quickstart

I would give it a shot, but this is beyond me...

On Apr 27, 10:52 am, Tom Atkins minkto...@gmail.com wrote:
 Their documentation is available after signing up (very easy as you can use
 your Google (etc) account).  There's a very clear step by step PHP example
 inside. Sorry I don't have time to look into this for web2py just now.

 On 27 April 2011 15:47, Massimo Di Pierro massimo.dipie...@gmail.comwrote:







  If they have php examples, chances are it works like janrain. It
  should be possible to modify

    gluon/contrib/login_methods/rpx_account.py

  and just change the URLs and variable names in there.
  If you could start working on this it would be great. If you want me
  to take a look, it would save me time if you could point me to the php
  example.

  Massimo

  On Apr 27, 9:40 am, Tom Atkins minkto...@gmail.com wrote:
   I just emailed SImpleAuth support and got this reply back from Mike
  (which
   he agreed I could post here):

   -

   We completely understand the concerns. The founders (I'm one of them)
  are
   all developers and we built SimpleAuth because it's just what we needed
  as
   well. Every developer needs this at some point for most sites.

   I can't go much into the specifics just yet, but we've got some pretty
  neat
   stuff in the pipeline that will be the revenue driver, but the
   SSO/Sharing/Contacts will always be free in their full glory.
   SimpleAuth also addresses a major issue with the largest commercial
  player
   in the market -- the fact that with other services, your provider API
  Keys
   are tied to their domain (YOURNAME.THEIRDOMAIN.COM). With SimpleAuth,
  you
   create a CNAME and all the API Keys from the providers are tied to your
   domain. Should the unthinkable happen, you won't be left out in the cold
   asking your users to re-register.
   We're like the SimpleGeo of SSO/sharing/contacts.
   I'm aware that the answer is a bit vague, but that's all I can share at
  the
   moment about what's coming in the future.
   If you have questions during implementation, feel free to shoot us an
  email
   (our only support method at this time) and we'll be glad to help.

   And, to alleviate the concerns about grabbing passwords, villas is
   absolutely correct - no password is ever entered by anyone on SimpleAuth
  (or
   sites that integrate SimpleAuth). Users are always redirected to the
   selected provider and everything from that point forward happens with the
   beautiful token dance.

   If I'm not overextending my welcome... There's sample code on the site in
   PHP. If anyone from your community comes up with wrappers, sample code,
  etc
   for web2py... though we can't officially support it, we'd be happy to
  set
   up a wiki or forum for that to be shared with future users, too.

   ---

   All sounds pretty good to me!

   On 27 April 2011 11:35, villas villa...@gmail.com wrote:

Your password should only be entered into the authentication site,
e.g. if you log in via Google you should only enter your password into
a browser window which shows a Google url.

On Apr 27, 9:57 am, stefaan stefaan.hi...@gmail.com wrote:
  I just came across this site: simpleauth.com, its a Janrain
  alternative that allows for 3rd party authentication on websites,
  and
  the best part of it is that its totally free.

 Maybe I'm just being paranoid, but how do we know it's not just
 collecting people's
 passwords?


[web2py] Re: Creating an iTunes Compatible Podcast with Web2py

2011-04-27 Thread Anthony
Instead of using dict(), can you use {} notation to create the dictionary? 
For example:
 
{'itunes:name':'foo'}
 
Anthony

On Wednesday, April 27, 2011 11:30:05 AM UTC-4, Nite wrote:

 I am attempting to create an itunes compatible podcast using the RSS 
 capabilities of Web2py. 

 Per the Book (http://web2py.com/book/default/chapter/09#RSS) the 
 format is as follows: 

 def feed(): 
 return dict(title=my feed, 
 link=http://feed.example.com;, 
 description=my first feed, 
 entries=[ 
   dict(title=my feed, 
   link=http://feed.example.com;, 
   description=my first feed) 
 ]) 

 The issue is that iTunes compatible podcasts have XML files with 
 ':' (colons) in the field name which is disallowed by python syntax 
 ('itunes:name = foo' is disallowed). 

 Here's an example itunes podcast from the Apple site(http:// 
 www.apple.com/itunes/podcasts/specs.html#example): 

 itunes:nameJohn Doe/itunes:name 

 Is there a way to use Web2py RSS capability to generate fields with a 
 colon in the name or do I need to write my own view and simply 
 populate the fields? 







Re: [web2py] Creating an iTunes Compatible Podcast with Web2py

2011-04-27 Thread Jonathan Lundell
On Apr 27, 2011, at 8:30 AM, Nite wrote:
 
 def feed():
return dict(title=my feed,
link=http://feed.example.com;,
description=my first feed,
entries=[
  dict(title=my feed,
  link=http://feed.example.com;,
  description=my first feed)
])
 
 The issue is that iTunes compatible podcasts have XML files with
 ':' (colons) in the field name which is disallowed by python syntax
 ('itunes:name = foo' is disallowed).

If you're referring to the dict, you can use this syntax:

entries = [
  { 'itunes:name': foo,
...
  }
]


[web2py] Re: Creating an iTunes Compatible Podcast with Web2py

2011-04-27 Thread Nite
entries = [
  { 'itunes:name': foo,
...
  }
]

Results in the following:

   'itunes:owner' = [
SyntaxError: keyword can't be an expression

Curly Brace dictionary notation seemed to work for the html view:

  !-- content --
  div id=content style=width: 100% 


h2Feed/h2

{#x27;description#x27;: #x27;My Description#x27;,
#x27;language#x27;: #x27;en#x27;, #x27;title#x27;: #x27;My
Title#x27;, #x27;itunes:owner#x27;: {#x27;itunes:name#x27;:
#x27;Webmaster#x27;, #x27;itunes:email#x27;:
#x27;webmas...@example.com#x27;}, #x27;link#x27;: #x27;http://
example.com#x27;, #x27;copyright#x27;: #x27;(c) 2011
Example#x27;}


  /div
  !-- content --

However, in RSS view I received this:

RSS error!--

 //--


Seems odd that it didn't generate a ticket.

I'll do a bit of digging to see if I can find why... Any help is
appreciated.

On Apr 27, 11:51 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 27, 2011, at 8:30 AM, Nite wrote:



  def feed():
     return dict(title=my feed,
                 link=http://feed.example.com;,
                 description=my first feed,
                 entries=[
                   dict(title=my feed,
                   link=http://feed.example.com;,
                   description=my first feed)
                 ])

  The issue is that iTunes compatible podcasts have XML files with
  ':' (colons) in the field name which is disallowed by python syntax
  ('itunes:name = foo' is disallowed).

 If you're referring to the dict, you can use this syntax:

 entries = [
   { 'itunes:name': foo,
 ...
   }
 ]


[web2py] Re: Login problems with _formkey changing

2011-04-27 Thread pbreit
Is this the standard login code or has it been customized in any way?

[web2py] Re: Creating an iTunes Compatible Podcast with Web2py

2011-04-27 Thread Anthony
On Wednesday, April 27, 2011 12:01:29 PM UTC-4, Nite wrote: 

 entries = [ 
   { 'itunes:name': foo, 
 ... 
   } 
 ] 

 Results in the following: 

'itunes:owner' = [ 
 SyntaxError: keyword can't be an expression

 
I'm not sure this is the problem, but is foo a variable? If not, you 
probably have to put it in quotes (i.e., 'foo').
 

 However, in RSS view I received this: 

 RSS error!-- 
 
  
 //-- 
 

 
What version of web2py are you using? I think when the response body is less 
than 512 characters, web2py appends an HTML comment full of x's in order to 
trick IE. However, this is only necessary for HTML responses (and generates 
an error with RSS, as you have observed). This was fixed recently, though 
(see 
http://code.google.com/p/web2py/source/detail?r=e46809139d9f9f8b91e6ab6f34c41fd5786b7eca),
 
so maybe try the most recent version of web2py.
 
Anthony
 


[web2py] Menus in the model don't update at the right time...

2011-04-27 Thread Jason Brower
It's a bummer, but I currently have to refresh the page after adding an 
item to the menus with a database insert.
Is there any way I can have the menu's refresh manually before any page 
rendered? I have many controllers, and it would be weird to put the 
command into each one.  That and I always thought it was nice to have 
the menus as part of the model.  It made sence to me. :)

Best regards,
Jason


Re: [web2py] CNAME and routes.py file

2011-04-27 Thread Jonathan Lundell
On Apr 27, 2011, at 9:26 AM, Oscar wrote:
 
 I'm using dotcloud service for host my web2py application, I
 configured a routes.py file to change the default application,
 function and controller for my app. I configured a CNAME record with
 my domain pointing to dotcloud service so my real URL access is:
 
 www.myapp.dotcloud.com it change to www.myapp.dotcloud.com/myapp/w/index-
 (because of routes.py)
 
 If I access using the domain it shows the page without issue but the
 URL don´t show /myapp/w/index so If i do clic in static URL it just
 don't work. Some one knows how to fix this?

What do you have in routes.py, and what exactly is the static URL that doesn't 
work?

[web2py] CNAME and routes.py file

2011-04-27 Thread Oscar
Hi,

I'm using dotcloud service for host my web2py application, I
configured a routes.py file to change the default application,
function and controller for my app. I configured a CNAME record with
my domain pointing to dotcloud service so my real URL access is:

www.myapp.dotcloud.com it change to www.myapp.dotcloud.com/myapp/w/index-
(because of routes.py)

If I access using the domain it shows the page without issue but the
URL don´t show /myapp/w/index so If i do clic in static URL it just
don't work. Some one knows how to fix this?

Thanks in advance,

Oscar.


[web2py] Re: Menus in the model don't update at the right time...

2011-04-27 Thread ron_m
The web2py request work flow runs the model files first, then the 
controller, then renders the view. I had a similar problem, the only way I 
could figure out how to change the menu after the model files have run was 
to add a menu update function to the model and call it from the controller 
when necessary.


[web2py] Re: Creating an iTunes Compatible Podcast with Web2py

2011-04-27 Thread Nite
Upgraded to 1.95.1 which is current.

Still no joy.

It doesn't appear that curly brace notation will work for generating
RSS feeds or I am doing something wrong.

From the book here is the example:

def feed():
return dict(title=my feed,
link=http://feed.example.com;,
description=my first feed,
entries=[
  dict(title=my feed,
  link=http://feed.example.com;,
  description=my first feed)
])

Here is my test of the same with curly brace notation:

def feed():
a = dict()
a = { title:my feed,
link:http://feed.example.com;,
description:my first feed,
entries:{'title':my feed,
  link:http://feed.example.com;,
  description:my first feed
}
}
return a

The html result of the curly brace test is a correctly parsed
dictionary in html format.

The rss result is:

RSS error!--

 //--


After striping the try/except from generic.rss I found this traceback:
Traceback (most recent call last):
  File gluon/restricted.py, line 181, in restricted
  File /Applications/DigitalAudioLibrary.app/Contents/Resources/
applications/DAL/views/generic.rss, line 11, in module
  File gluon/serializers.py, line 71, in rss
TypeError: string indices must be integers

Function argument list
(feed={'description': 'my first feed', 'entries': {'description': 'my
first feed', 'link': 'http://feed.example.com', 'title': 'my feed'},
'link': 'http://feed.example.com', 'title': 'my feed'})

My version of web2py:

Version 1.95.1 (2011-04-25 15:04:14)
web2py is up to date

On Apr 27, 12:25 pm, Anthony abasta...@gmail.com wrote:
 On Wednesday, April 27, 2011 12:01:29 PM UTC-4, Nite wrote:

  entries = [
    { 'itunes:name': foo,
  ...
    }
  ]

  Results in the following:

     'itunes:owner' = [
  SyntaxError: keyword can't be an expression

 I'm not sure this is the problem, but is foo a variable? If not, you
 probably have to put it in quotes (i.e., 'foo').

  However, in RSS view I received this:

  RSS error!--
  xxx 
  xxx 
  xxx 
  xxx 
  xxx 
  xxx 
  xx
  //--

 What version of web2py are you using? I think when the response body is less
 than 512 characters, web2py appends an HTML comment full of x's in order to
 trick IE. However, this is only necessary for HTML responses (and generates
 an error with RSS, as you have observed). This was fixed recently, though
 (seehttp://code.google.com/p/web2py/source/detail?r=e46809139d9f9f8b91e6a...),
 so maybe try the most recent version of web2py.

 Anthony


[web2py] Re: CNAME and routes.py file

2011-04-27 Thread pbreit
If you set default_application in routes.py, it's going to hide /app 
(and /default) which is usually what you want. But everything should still 
work. Do you generate all of your URLs with the URL() tag? (you should)

[web2py] Question about custom registration form

2011-04-27 Thread salbefe
Hello,

In the application were are developing a user with the admin role has
to register the 'other users' that will have access to it.  We would
like to make a view that must have a form for registering users and a
list of the users that are currently registered (all in the same view)

For testing we did:

In the controlusers.py controller:

def index():

   form = auth.register()
   return dict(form=form)

In the view:

   {{if request.args(0)=='register':}}
 custom registration form
   {{pass}}

But this not work. When we try http://127.0.0.1/init/controlusers/ the
browser redirects to http://127.0.0.1/init/default/user/login

How could we make this kind of registration process??

Thanks in advance



[web2py] How to run a daemon/service??

2011-04-27 Thread Ialejandro
Hi! Developing my school project app, I have this:

I have a dir called _configdir with some .ini files, these files have
this structure:

[ROOMNAME]
owner=somename
data1=somedata
data2=somedata
data3=sometada

Those inis are sent to my sever from many other pcs trough ftp. I made
this script for parsing and saving the values into a db:

import os
import ConfigParser
import traceback
import pymysql
import time

_configDir = _configuploads


def save(val):


connection = pymysql.connect(host='127.0.0.1', port=3306,
user='script', passwd=123, db='hotel')
cursor = connection.cursor()

doop = val['roomname']

cursor.execute(SELECT * FROM rooms WHERE roomname = '%s'%doop)
row = cursor.fetchone()

if row == None:
print doop,'Not in db... Inserting'

keys = val.keys()

values = []

for each in keys:
values.append(val[each])

s1 = ','.join(keys)

count = len(val)

per = (%s,*count)[:-1]

command = insert into rooms (%s)%s1+ values (%s)%per
args =  tuple(values)
cursor.execute(command,args)


else:
print doop,'Already in DB... Updating'
keys = val.keys()

values = []

for each in keys:
values.append(val[each])

listy = []
for key,value in val.items():
listy.append(%s='%s'%(key,value))

sready = , .join(listy)


command = update rooms set %s%sready+where roomname =
'%s'%doop

cursor.execute(command)



cursor.close()
connection.close()

def parse(filename):
try:
config = ConfigParser.ConfigParser()

config.read(filename)
rooms = config.sections()

dictio = {}
for room in rooms:
dictio[room] = {}
options = config.options(room)

for option in options:
dictio[room][option] = config.get(room,option)

rrom = dictio.keys()[0]

valdict = dictio.values()[0]
valdict['room'] = '%s'%rrom


save(valdict)

return 0
except:
print Something failed!
print traceback.format_exc()
return 1



def main():
objects = os.listdir(_configDir)
for item in objects:
fitem = os.path.join(os.getcwd(),_configDir,item)
parse(fitem)


while True:
time.sleep(5)
main()



And it works fantastic!!

But I need to have the same functionality of that script into my
web2py app...

How could I do it???


[web2py] Re: Creating an iTunes Compatible Podcast with Web2py

2011-04-27 Thread Nite
Ok, found the syntax issue with the curly brace conversion...

def feed():
a = dict()
a = { title:my feed,
link:http://feed.example.com;,
description:my first feed,
entries:[{'title':my feed,
  link:http://feed.example.com;,
  description:my first feed
}]
}
return a

I was missing the fact that entries requires a list.

It seems that the RSS functionality requires certain fields (title,
description, link, entries (which must be a list))

As a result I am guessing this is incompatible with the iTunes podcast
specification and I will need a different view to generate the
required file.


On Apr 27, 12:52 pm, Nite nitese...@gmail.com wrote:
 Upgraded to 1.95.1 which is current.

 Still no joy.

 It doesn't appear that curly brace notation will work for generating
 RSS feeds or I am doing something wrong.

 From the book here is the example:

 def feed():
     return dict(title=my feed,
                 link=http://feed.example.com;,
                 description=my first feed,
                 entries=[
                   dict(title=my feed,
                   link=http://feed.example.com;,
                   description=my first feed)
                 ])

 Here is my test of the same with curly brace notation:

 def feed():
     a = dict()
     a = { title:my feed,
                 link:http://feed.example.com;,
                 description:my first feed,
                 entries:{'title':my feed,
                   link:http://feed.example.com;,
                   description:my first feed
                 }
     }
     return a

 The html result of the curly brace test is a correctly parsed
 dictionary in html format.

 The rss result is:

 RSS error!--
 xxx 
 xxx 
 xxx 
 xxx 
 xxx 
 xxx 
 xx //--



 After striping the try/except from generic.rss I found this traceback:
 Traceback (most recent call last):
   File gluon/restricted.py, line 181, in restricted
   File /Applications/DigitalAudioLibrary.app/Contents/Resources/
 applications/DAL/views/generic.rss, line 11, in module
   File gluon/serializers.py, line 71, in rss
 TypeError: string indices must be integers

 Function argument list
 (feed={'description': 'my first feed', 'entries': {'description': 'my
 first feed', 'link': 'http://feed.example.com', 'title': 'my feed'},
 'link': 'http://feed.example.com', 'title': 'my feed'})

 My version of web2py:

 Version 1.95.1 (2011-04-25 15:04:14)
 web2py is up to date

 On Apr 27, 12:25 pm, Anthony abasta...@gmail.com wrote:







  On Wednesday, April 27, 2011 12:01:29 PM UTC-4, Nite wrote:

   entries = [
     { 'itunes:name': foo,
   ...
     }
   ]

   Results in the following:

      'itunes:owner' = [
   SyntaxError: keyword can't be an expression

  I'm not sure this is the problem, but is foo a variable? If not, you
  probably have to put it in quotes (i.e., 'foo').

   However, in RSS view I received this:

   RSS error!--
   xxx

   xxx

   xxx

   xxx

   xxx

   xxx
xx
   //--

  What version of web2py are you using? I think when the response body is less
  than 512 characters, web2py appends an HTML comment full of x's in order to
  trick IE. However, this is only necessary for HTML responses (and generates
  an error with RSS, as you have observed). This was fixed recently, though
  (seehttp://code.google.com/p/web2py/source/detail?r=e46809139d9f9f8b91e6a...),
  so maybe try the most recent version of web2py.

  Anthony


[web2py] Best practice to start background process

2011-04-27 Thread teemu
Hi,

I would like to know what would be the best way to start background
process in production environment. I have implemented background
process by using the web2py book chapter as a template (http://
www.web2py.com/book/default/chapter/04#Background-Processes-and-Task-Queues).
I start background process manually on my development machine
(Winddows 7, web2py webserver) and it works great. Now it is time to
publish my app on production server (debian linux, apache2, mod_wsgi).
I was wondering what would be the best and the most simple way to
start this background process together with apache/mod_wsgi? Ideal
solution would be cross-platform compatible but this is not
mandatory.

As far as i know there are several different options but I do not know
what is the best and what are advantages and disadvantages of
different methods:

1) manually from shell:
- laborious and should be done upon every server reboot

2) init script:
- good option and can be integrated with apache2 init script

3) web2py-cron-@reboot:
- is this even possible or recommended? However, this would be the
only cross-platform alternative

3) system cron:
- cron job could check if background process is still running and
restart process if it has been crashed

How have you guys done this? Any suggestions?

Teemu


Re: [web2py] Code insert-er for Pydev Eclipse users

2011-04-27 Thread José Luis Redrejo Rodríguez
2011/4/27 pierreth pierre.thibau...@gmail.com:
 Hello,

 I made a tool to automatically insert the code necessary to avoid the
 errors and warnings reported by Eclipse Pydev cause by the automatic
 imports of web2py.

 http://code.google.com/p/neo-insert-imports/

 Tell me if you like.

I do like it a lot :) It works perfectly, thanks very much.


Re: [web2py] Re: CNAME and routes.py file

2011-04-27 Thread Jonathan Lundell
On Apr 27, 2011, at 9:41 AM, pbreit wrote:
 If you set default_application in routes.py, it's going to hide /app (and 
 /default) which is usually what you want. But everything should still work. 
 Do you generate all of your URLs with the URL() tag? (you should)

And when using URL() to create a URL for a static object, make 'static' the 
controller, and put the file name (or the rest of the path to the file) in the 
function field.

[web2py] Re: Best practice to start background process

2011-04-27 Thread Stodge
I don't know about web2py specific processes, but I believe py2exe can
install your python application as a Windows service.

On Apr 27, 1:04 pm, teemu teemu.kuulas...@gmail.com wrote:
 Hi,

 I would like to know what would be the best way to start background
 process in production environment. I have implemented background
 process by using the web2py book chapter as a template 
 (http://www.web2py.com/book/default/chapter/04#Background-Processes-and-Task-...;).
 I start background process manually on my development machine
 (Winddows 7, web2py webserver) and it works great. Now it is time to
 publish my app on production server (debian linux, apache2, mod_wsgi).
 I was wondering what would be the best and the most simple way to
 start this background process together with apache/mod_wsgi? Ideal
 solution would be cross-platform compatible but this is not
 mandatory.

 As far as i know there are several different options but I do not know
 what is the best and what are advantages and disadvantages of
 different methods:

 1) manually from shell:
 - laborious and should be done upon every server reboot

 2) init script:
 - good option and can be integrated with apache2 init script

 3) web2py-cron-@reboot:
 - is this even possible or recommended? However, this would be the
 only cross-platform alternative

 3) system cron:
 - cron job could check if background process is still running and
 restart process if it has been crashed

 How have you guys done this? Any suggestions?

 Teemu


[web2py] Re: CNAME and routes.py file

2011-04-27 Thread Oscar
default_application = 'myapp'# ordinarily set in base routes.py
default_controller = 'w'  # ordinarily set in app-specific routes.py
default_function = 'index'  # ordinarily set in app-specific
routes.py

There is not static URL at all, just the call to some controllers.


On 27 abr, 12:40, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 27, 2011, at 9:26 AM, Oscar wrote:



  I'm using dotcloud service for host my web2py application, I
  configured a routes.py file to change the default application,
  function and controller for my app. I configured a CNAME record with
  my domain pointing to dotcloud service so my real URL access is:

 www.myapp.dotcloud.comit change towww.myapp.dotcloud.com/myapp/w/index-
  (because of routes.py)

  If I access using the domain it shows the page without issue but the
  URL don´t show /myapp/w/index so If i do clic in static URL it just
  don't work. Some one knows how to fix this?

 What do you have in routes.py, and what exactly is the static URL that 
 doesn't work?


[web2py] Re: CNAME and routes.py file

2011-04-27 Thread Oscar
Thanks for the tip.


On 27 abr, 13:19, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 27, 2011, at 9:41 AM, pbreit wrote:

  If you set default_application in routes.py, it's going to hide /app 
  (and /default) which is usually what you want. But everything should still 
  work. Do you generate all of your URLs with the URL() tag? (you should)

 And when using URL() to create a URL for a static object, make 'static' the 
 controller, and put the file name (or the rest of the path to the file) in 
 the function field.


[web2py] Re: CNAME and routes.py file

2011-04-27 Thread Oscar
Nope,

I didn't use URL tag, but i was suspecting it.

There is a Way to invoke the default application without hide the
entire URL?


On 27 abr, 12:41, pbreit pbreitenb...@gmail.com wrote:
 If you set default_application in routes.py, it's going to hide /app
 (and /default) which is usually what you want. But everything should still
 work. Do you generate all of your URLs with the URL() tag? (you should)


[web2py] typo

2011-04-27 Thread selecta
File /home/select/Dev/web2py/gluon/sqlhtml.py, line 944, in
createform
raise RuntimeError, 'formsyle not supported'
RuntimeError: formsyle not supported


[web2py] Is there a way to set jqui dialog options using clienttools?

2011-04-27 Thread james c.
Is there a way to set Jqueryui Dialog options using web2py
clienttools?

thanks in advance, James C.


Re: [web2py] Code insert-er for Pydev Eclipse users

2011-04-27 Thread danto
I still don't know what issues are all talking about regarding pydev and
web2py. I'm using it on archlinux and imports, autocomplete and functions
are all working pretty well.

just go to:

window  preferences  pydev  interpreter-python  libraries

and add a [new folder] in system pythonpath pointing to the web2py/gluon
folder of your web2py installation.

please tell me if this (kind of obvious) thing works for you or I may be
missing some more magic from web2py (?). I have autocomplete from DAL and
even from HTML helpers atm

regards


[web2py] Re: Menus in the model don't update at the right time...

2011-04-27 Thread Anthony
On Wednesday, April 27, 2011 12:39:41 PM UTC-4, encompass wrote: 

 It's a bummer, but I currently have to refresh the page after adding an 
 item to the menus with a database insert.
 Is there any way I can have the menu's refresh manually before any page 
 rendered?

 
Maybe put a menu update function in a model file and then call it from your 
layout.html view. Or perhaps you could turn the menu into a component and 
insert it via LOAD (with our without Ajax).
 
Anthony


[web2py] web2py development jobs

2011-04-27 Thread Gilson Filho
We are looking for one or more web2py developers to help with a web2py
project.

We posted two small jobs related to the project on the sites elance, oDesk
and
vWorker. The jobs give us an opportunity to work together with low risk and
short-term commitment. If you're interested here are the jobs:

elance.com
   1.
http://www.elance.com/j/web2py-javascript-page-not-working-internet-explorer/24014808/
   2. http://www.elance.com/j/web2py-client-crud-embedded-search/24014755/

oDesk.com
   1.
https://www.odesk.com/jobs/web2py-javascript-debugger_%7E%7Eb5808064eca3228a
   2. https://www.odesk.com/jobs/web2py-developer_%7E%7E809aa4098804f674

vworker.com
   1.
http://www.vworker.com/RentACoder/misc/BidRequests/ShowBidRequest.asp?lngBidRequestId=1650177
   2.
http://www.vworker.com/RentACoder/misc/BidRequests/ShowBidRequest.asp?lngBidRequestId=1650438

As well, feel free to contact me directly via this email address.

Regards,
Jim Karsten


[web2py] Confusion using experts4solutions

2011-04-27 Thread Jim Karsten
We are working on a new web2py project. We are making progress and web2py 
has certainly improved our production but we could use some help. The 
experts4solutions site looks very promising but currently it doesn't provide 
details for handling various issues. 

We posted a couple of small jobs on elance, oDesk and vWorker, then sent the 
links each member of experts4solutions. 

Some of the issues the freelancing sites handle that we have a concern about 
include: job posting tools, contractor filtering tools, payment processing, 
commitment guarantees (for example, payment held in escrow), dispute 
settlements and arbitration, legal terms and software licences. 

Is our approach acceptable? What have others done in the past? 

Regards, 
Jim Karsten 

Re: [web2py] Re: CNAME and routes.py file

2011-04-27 Thread Jonathan Lundell
On Apr 27, 2011, at 10:33 AM, Oscar wrote:
 
 default_application = 'myapp'# ordinarily set in base routes.py
 default_controller = 'w'  # ordinarily set in app-specific routes.py
 default_function = 'index'  # ordinarily set in app-specific
 routes.py
 
 There is not static URL at all, just the call to some controllers.

Then, whatever you meant by static URL below.

 
 
 On 27 abr, 12:40, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 27, 2011, at 9:26 AM, Oscar wrote:
 
 
 
 I'm using dotcloud service for host my web2py application, I
 configured a routes.py file to change the default application,
 function and controller for my app. I configured a CNAME record with
 my domain pointing to dotcloud service so my real URL access is:
 
 www.myapp.dotcloud.comit change towww.myapp.dotcloud.com/myapp/w/index-
 (because of routes.py)
 
 If I access using the domain it shows the page without issue but the
 URL don´t show /myapp/w/index so If i do clic in static URL it just
 don't work. Some one knows how to fix this?
 
 What do you have in routes.py, and what exactly is the static URL that 
 doesn't work?




Re: [web2py] Re: CNAME and routes.py file

2011-04-27 Thread Jonathan Lundell
On Apr 27, 2011, at 10:34 AM, Oscar wrote:
 
 Nope,
 
 I didn't use URL tag, but i was suspecting it.
 
 There is a Way to invoke the default application without hide the
 entire URL?

Sure, just don't specify the defaults. Or don't use routing at all, if you 
don't want to hide anything.

You need to explain a little more specifically what's working, what's not, and 
what your URLs ought to look like.

 
 
 On 27 abr, 12:41, pbreit pbreitenb...@gmail.com wrote:
 If you set default_application in routes.py, it's going to hide /app
 (and /default) which is usually what you want. But everything should still
 work. Do you generate all of your URLs with the URL() tag? (you should)




[web2py] Re: Janrain Alternative: SimpleAuth (And its totally free)

2011-04-27 Thread Stefaan Himpe

villas wrote:

Your password should only be entered into the authentication site,
e.g. if you log in via Google you should only enter your password into
a browser window which shows a Google url.


Thanks for clearing that up. My n00bieness to web stuff obviously shines 
through :)




[web2py] Re: Creating an iTunes Compatible Podcast with Web2py

2011-04-27 Thread Nite
Ok, last post on this subject.

After reviewing the source for PyRSS2Gen I'm going to conclude (unless
someone who actually knows can clue me in) that PyRSS2Gen is not setup
to handle custom namespaces (itunes:blah). I've tried with both the
xml and the rss views and end up with the same issues. By an large the
feed works until I try to update the rss_attrs and use the itunes
namespace which is required for a proper iTunes podcast.

I'm going to write a simple view that can handle what I need without
resorting to using this module.

On Apr 27, 1:01 pm, Nite nitese...@gmail.com wrote:
 Ok, found the syntax issue with the curly brace conversion...

 def feed():
     a = dict()
     a = { title:my feed,
                 link:http://feed.example.com;,
                 description:my first feed,
                 entries:[{'title':my feed,
                   link:http://feed.example.com;,
                   description:my first feed
                 }]
     }
     return a

 I was missing the fact that entries requires a list.

 It seems that the RSS functionality requires certain fields (title,
 description, link, entries (which must be a list))

 As a result I am guessing this is incompatible with the iTunes podcast
 specification and I will need a different view to generate the
 required file.

 On Apr 27, 12:52 pm, Nite nitese...@gmail.com wrote:







  Upgraded to 1.95.1 which is current.

  Still no joy.

  It doesn't appear that curly brace notation will work for generating
  RSS feeds or I am doing something wrong.

  From the book here is the example:

  def feed():
      return dict(title=my feed,
                  link=http://feed.example.com;,
                  description=my first feed,
                  entries=[
                    dict(title=my feed,
                    link=http://feed.example.com;,
                    description=my first feed)
                  ])

  Here is my test of the same with curly brace notation:

  def feed():
      a = dict()
      a = { title:my feed,
                  link:http://feed.example.com;,
                  description:my first feed,
                  entries:{'title':my feed,
                    link:http://feed.example.com;,
                    description:my first feed
                  }
      }
      return a

  The html result of the curly brace test is a correctly parsed
  dictionary in html format.

  The rss result is:

  RSS error!--
  xxx 
  xxx 
  xxx 
  xxx 
  xxx 
  xxx 
  xx //--

  After striping the try/except from generic.rss I found this traceback:
  Traceback (most recent call last):
    File gluon/restricted.py, line 181, in restricted
    File /Applications/DigitalAudioLibrary.app/Contents/Resources/
  applications/DAL/views/generic.rss, line 11, in module
    File gluon/serializers.py, line 71, in rss
  TypeError: string indices must be integers

  Function argument list
  (feed={'description': 'my first feed', 'entries': {'description': 'my
  first feed', 'link': 'http://feed.example.com', 'title': 'my feed'},
  'link': 'http://feed.example.com', 'title': 'my feed'})

  My version of web2py:

  Version 1.95.1 (2011-04-25 15:04:14)
  web2py is up to date

  On Apr 27, 12:25 pm, Anthony abasta...@gmail.com wrote:

   On Wednesday, April 27, 2011 12:01:29 PM UTC-4, Nite wrote:

entries = [
  { 'itunes:name': foo,
...
  }
]

Results in the following:

   'itunes:owner' = [
SyntaxError: keyword can't be an expression

   I'm not sure this is the problem, but is foo a variable? If not, you
   probably have to put it in quotes (i.e., 'foo').

However, in RSS view I received this:

RSS error!--
xxx
 
xxx
 
xxx
 
xxx
 
xxx
 
xxx
 xx
//--

   What version of web2py are you using? I think when the response body is 
   less
   than 512 characters, web2py appends an HTML comment full of x's in order 
   to
   trick IE. However, this is only necessary for HTML responses (and 
   generates

Re: [web2py] Re: Documentation web2py

2011-04-27 Thread Martín Mulone
Also we can setup a powerpack app to make hierachy documentation, the
content index can be render like the menu, but to a page. If the current
documentation is in markmin I think is no problem.

2011/4/27 Massimo Di Pierro massimo.dipie...@gmail.com



 On Apr 27, 9:52 am, villas villa...@gmail.com wrote:
  I certainly wouldn't wish to discourage anyone from editing etc by
  introducing unnecessary procedures. However,  I think we need a little
  more clarity.
 
  Problem 1. If Massimo is only going to make a final decision about
  backwards-compatibility on an annual basis, this is a very long time.
  Could we not include this question of stability and backwards-
  compatibility within the version numbering?  e.g. can we not have LTS
  versions periodically?

 It is not like a make the decision annually. The decision is a
 process. The book is printed annulally thus making it officially.

  Problem 2. The online book is currently not authoritative in any way.
  The only way in which we can currently see what is really stable and
  correct is by seeing what is in the printed version. Ideally the
  online book would be color-coded,  or at least a diff available online
  so we can see what may have been added/amended.

 I disagree.

  Problem 3. The online book may have been edited by someone with as
  little knowledge as I!!  Of course I am cautious when editing,  but
  shouldn't there be some guidelines for reviews by someone more
  senior?

 So far we did not have the problem. Edits have been good and helpful.

  Typos and minor corrections = everyone.
  Major corrections, additional examples = review by active member of
  developer group.
 
  Problem 4:  We never know what might have changed.  I believe it would
  be very helpful if there was a change diff or log available for edits
  so that we may see what has changed and then perhaps we can review
  each other's edits more easily. In any case, I am sure that many of us
  would like to know what has changed as any new examples and such can
  be very interesting.

 This is a good point. I could edit the app and publish diffs. It would
 be useful but it not going to happen overnight.




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


[web2py] help.with using auth_user in db

2011-04-27 Thread Resa
I user janrain  for login... in globals i see persons information
all i want to do is to  grab that information  that i am seeing in the
globals  and put in a variable and use it eg i was trying to grab the
data and put it in a database:

def insert_into_db():
#session.correct=request.vars(0)
#session.numquest=request.vars(1)
#session.time_quest=request.vars(2)
#session.mgp=request.vars(3)

session.correct=5
session.numquest=5
session.time_quest=1
session.mgp=100


if db.Matworksheetdb.email==auth_user.email:
 
if(db.Matworksheeetdb.email==auth_user.email)(db.Matworksheeetdb.mgpsession.mpg):
 
db(db.Matworksheeetdb.email==auth_user.email).update(mgp=session.mpg,
 
numberquest=session.numquest,
 
correct=session.correct,
 
time_quest=session.time_quest)
else:
db.Matworksheetdb.insert(First=auth_user.first_name,
  Last=auth_user.last_name,
  email=auth_user.email,
  correct=session.correct,
  numberquest=session.numquest,
  time_quest=session.time_quest,
  mgp=session.mpg)
redirect(URL(f='mathgen'))
return()

ERROR: NameError: global name 'auth_user' is not defined

When i use auth.user.email i get this error:

 if db.Matworksheetdb.email==auth.user.email:
AttributeError: 'NoneType' object has no attribute 'email'

the problem is this is what i am seeing in globals. Any form of help
would be most greatful...


[web2py] Re: Documentation web2py

2011-04-27 Thread Massimo Di Pierro
No objection of course.

On Apr 27, 1:58 pm, Martín Mulone mulone.mar...@gmail.com wrote:
 Also we can setup a powerpack app to make hierachy documentation, the
 content index can be render like the menu, but to a page. If the current
 documentation is in markmin I think is no problem.

 2011/4/27 Massimo Di Pierro massimo.dipie...@gmail.com











  On Apr 27, 9:52 am, villas villa...@gmail.com wrote:
   I certainly wouldn't wish to discourage anyone from editing etc by
   introducing unnecessary procedures. However,  I think we need a little
   more clarity.

   Problem 1. If Massimo is only going to make a final decision about
   backwards-compatibility on an annual basis, this is a very long time.
   Could we not include this question of stability and backwards-
   compatibility within the version numbering?  e.g. can we not have LTS
   versions periodically?

  It is not like a make the decision annually. The decision is a
  process. The book is printed annulally thus making it officially.

   Problem 2. The online book is currently not authoritative in any way.
   The only way in which we can currently see what is really stable and
   correct is by seeing what is in the printed version. Ideally the
   online book would be color-coded,  or at least a diff available online
   so we can see what may have been added/amended.

  I disagree.

   Problem 3. The online book may have been edited by someone with as
   little knowledge as I!!  Of course I am cautious when editing,  but
   shouldn't there be some guidelines for reviews by someone more
   senior?

  So far we did not have the problem. Edits have been good and helpful.

   Typos and minor corrections = everyone.
   Major corrections, additional examples = review by active member of
   developer group.

   Problem 4:  We never know what might have changed.  I believe it would
   be very helpful if there was a change diff or log available for edits
   so that we may see what has changed and then perhaps we can review
   each other's edits more easily. In any case, I am sure that many of us
   would like to know what has changed as any new examples and such can
   be very interesting.

  This is a good point. I could edit the app and publish diffs. It would
  be useful but it not going to happen overnight.

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


[web2py] GAE deployment routing to welcome app, not my own app.

2011-04-27 Thread Johan
Hi,

I'm trying to deploy my app on GAE, but I don't know how to configure
the app.yaml so that the request is routed to my app and not the
welcome app.

Current behaviour:

http://localhost:8081 results in:

http://localhost:8081/welcome/default/index

but I expected

http://localhost:8081/kiekjs/default/index

I searched in chapter 11 and in the group mails, but can't find any
reference to what to change.

Johan

See my current app.yaml settings:

application: kiekjs
version: 1
api_version: 1
runtime: python

default_expiration: 24h

derived_file_type:
- python_precompiled

handlers:

- url: /_ah/stats.*
  script: $PYTHON_LIB/google/appengine/ext/appstats/ui.py
  login: admin

- url: /(?Pa.+?)/static/(?Pb.+)
  static_files: applications/\1/static/\2
  upload: applications/(.+?)/static/(.+)
  secure: optional

- url: /favicon.ico
  static_files: applications/welcome/static/favicon.ico
  upload: applications/welcome/static/favicon.ico

- url: /robots.txt
  static_files: applications/welcome/static/robots.txt
  upload: applications/welcome/static/robots.txt

- url: /_ah/admin/.*
  script: $PYTHON_LIB/google/appengine/ext/admin
  login: admin

- url: /_ah/queue/default
  script: gaehandler.py
  login: admin

- url: .*
  script: gaehandler.py
  secure: optional

admin_console:
  pages:
  - name: Appstats
url: /_ah/stats

skip_files: |
 ^(.*/)?(
 (app\.yaml)|
 (app\.yml)|
 (index\.yaml)|
 (index\.yml)|
 (#.*#)|
 (.*~)|
 (.*\.py[co])|
 (.*/RCS/.*)|
 (\..*)|
 #(applications/(admin|examples)/.*)|
 ((admin|examples|welcome)\.(w2p|tar))|
 (applications/.*?/(cron|databases|errors|cache|sessions)/.*)|
 ((logs|scripts)/.*)|
 (anyserver\.py)|
 (web2py\.py)|
 ((cgi|fcgi|modpython|wsgi)handler\.py)|
 (epydoc\.(conf|css))|
 (httpserver\.log)|
 (logging\.example\.conf)|
 (route[rs]\.example\.py)|
 (setup_(app|exe)\.py)|
 (splashlogo\.gif)|
 (parameters_\d+\.py)|
 (options_std.py)|
 (gluon/tests/.*)|
 (gluon/(rocket|winservice)\.py)|
 (contrib/(gateways|markdown|memcache|pymysql)/.*)|
 (contrib/(populate|taskbar_widget)\.py)|
 (google_appengine/.*)|
 (.*\.(bak|orig))|
 )$

builtins:
- remote_api: on
- datastore_admin: on



Re: [web2py] GAE deployment routing to welcome app, not my own app.

2011-04-27 Thread Jonathan Lundell
On Apr 27, 2011, at 12:27 PM, Johan wrote:
 
 Hi,
 
 I'm trying to deploy my app on GAE, but I don't know how to configure
 the app.yaml so that the request is routed to my app and not the
 welcome app.
 
 Current behaviour:
 
 http://localhost:8081 results in:
 
 http://localhost:8081/welcome/default/index
 
 but I expected
 
 http://localhost:8081/kiekjs/default/index
 
 I searched in chapter 11 and in the group mails, but can't find any
 reference to what to change.

'welcome' is the built-in default when 'init' doesn't exist. You can rename 
your app to 'init', or create a routes.py with, at a minimum, a 
default_application definition.

 
 Johan
 
 See my current app.yaml settings:
 
 application: kiekjs
 version: 1
 api_version: 1
 runtime: python
 
 default_expiration: 24h
 
 derived_file_type:
 - python_precompiled
 
 handlers:
 
 - url: /_ah/stats.*
  script: $PYTHON_LIB/google/appengine/ext/appstats/ui.py
  login: admin
 
 - url: /(?Pa.+?)/static/(?Pb.+)
  static_files: applications/\1/static/\2
  upload: applications/(.+?)/static/(.+)
  secure: optional
 
 - url: /favicon.ico
  static_files: applications/welcome/static/favicon.ico
  upload: applications/welcome/static/favicon.ico
 
 - url: /robots.txt
  static_files: applications/welcome/static/robots.txt
  upload: applications/welcome/static/robots.txt
 
 - url: /_ah/admin/.*
  script: $PYTHON_LIB/google/appengine/ext/admin
  login: admin
 
 - url: /_ah/queue/default
  script: gaehandler.py
  login: admin
 
 - url: .*
  script: gaehandler.py
  secure: optional
 
 admin_console:
  pages:
  - name: Appstats
url: /_ah/stats
 
 skip_files: |
 ^(.*/)?(
 (app\.yaml)|
 (app\.yml)|
 (index\.yaml)|
 (index\.yml)|
 (#.*#)|
 (.*~)|
 (.*\.py[co])|
 (.*/RCS/.*)|
 (\..*)|
 #(applications/(admin|examples)/.*)|
 ((admin|examples|welcome)\.(w2p|tar))|
 (applications/.*?/(cron|databases|errors|cache|sessions)/.*)|
 ((logs|scripts)/.*)|
 (anyserver\.py)|
 (web2py\.py)|
 ((cgi|fcgi|modpython|wsgi)handler\.py)|
 (epydoc\.(conf|css))|
 (httpserver\.log)|
 (logging\.example\.conf)|
 (route[rs]\.example\.py)|
 (setup_(app|exe)\.py)|
 (splashlogo\.gif)|
 (parameters_\d+\.py)|
 (options_std.py)|
 (gluon/tests/.*)|
 (gluon/(rocket|winservice)\.py)|
 (contrib/(gateways|markdown|memcache|pymysql)/.*)|
 (contrib/(populate|taskbar_widget)\.py)|
 (google_appengine/.*)|
 (.*\.(bak|orig))|
 )$
 
 builtins:
 - remote_api: on
 - datastore_admin: on
 




[web2py] Re: GAE deployment routing to welcome app, not my own app.

2011-04-27 Thread Johan
Thanks!

Used router and changed default app to kiekjs.


On Apr 27, 9:33 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 27, 2011, at 12:27 PM, Johan wrote:











  Hi,

  I'm trying to deploy my app on GAE, but I don't know how to configure
  the app.yaml so that the request is routed to my app and not the
  welcome app.

  Current behaviour:

 http://localhost:8081results in:

 http://localhost:8081/welcome/default/index

  but I expected

 http://localhost:8081/kiekjs/default/index

  I searched in chapter 11 and in the group mails, but can't find any
  reference to what to change.

 'welcome' is the built-in default when 'init' doesn't exist. You can rename 
 your app to 'init', or create a routes.py with, at a minimum, a 
 default_application definition.









  Johan

  See my current app.yaml settings:

  application: kiekjs
  version: 1
  api_version: 1
  runtime: python

  default_expiration: 24h

  derived_file_type:
  - python_precompiled

  handlers:

  - url: /_ah/stats.*
   script: $PYTHON_LIB/google/appengine/ext/appstats/ui.py
   login: admin

  - url: /(?Pa.+?)/static/(?Pb.+)
   static_files: applications/\1/static/\2
   upload: applications/(.+?)/static/(.+)
   secure: optional

  - url: /favicon.ico
   static_files: applications/welcome/static/favicon.ico
   upload: applications/welcome/static/favicon.ico

  - url: /robots.txt
   static_files: applications/welcome/static/robots.txt
   upload: applications/welcome/static/robots.txt

  - url: /_ah/admin/.*
   script: $PYTHON_LIB/google/appengine/ext/admin
   login: admin

  - url: /_ah/queue/default
   script: gaehandler.py
   login: admin

  - url: .*
   script: gaehandler.py
   secure: optional

  admin_console:
   pages:
   - name: Appstats
     url: /_ah/stats

  skip_files: |
  ^(.*/)?(
  (app\.yaml)|
  (app\.yml)|
  (index\.yaml)|
  (index\.yml)|
  (#.*#)|
  (.*~)|
  (.*\.py[co])|
  (.*/RCS/.*)|
  (\..*)|
  #(applications/(admin|examples)/.*)|
  ((admin|examples|welcome)\.(w2p|tar))|
  (applications/.*?/(cron|databases|errors|cache|sessions)/.*)|
  ((logs|scripts)/.*)|
  (anyserver\.py)|
  (web2py\.py)|
  ((cgi|fcgi|modpython|wsgi)handler\.py)|
  (epydoc\.(conf|css))|
  (httpserver\.log)|
  (logging\.example\.conf)|
  (route[rs]\.example\.py)|
  (setup_(app|exe)\.py)|
  (splashlogo\.gif)|
  (parameters_\d+\.py)|
  (options_std.py)|
  (gluon/tests/.*)|
  (gluon/(rocket|winservice)\.py)|
  (contrib/(gateways|markdown|memcache|pymysql)/.*)|
  (contrib/(populate|taskbar_widget)\.py)|
  (google_appengine/.*)|
  (.*\.(bak|orig))|
  )$

  builtins:
  - remote_api: on
  - datastore_admin: on


[web2py] Re: CNAME and routes.py file

2011-04-27 Thread Oscar
I just want to configure myapp as default without rename it to init.
That's all.



On 27 abr, 14:28, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 27, 2011, at 10:34 AM, Oscar wrote:



  Nope,

  I didn't use URL tag, but i was suspecting it.

  There is a Way to invoke the default application without hide the
  entire URL?

 Sure, just don't specify the defaults. Or don't use routing at all, if you 
 don't want to hide anything.

 You need to explain a little more specifically what's working, what's not, 
 and what your URLs ought to look like.









  On 27 abr, 12:41, pbreit pbreitenb...@gmail.com wrote:
  If you set default_application in routes.py, it's going to hide /app
  (and /default) which is usually what you want. But everything should still
  work. Do you generate all of your URLs with the URL() tag? (you should)


Re: [web2py] Re: CNAME and routes.py file

2011-04-27 Thread Jonathan Lundell
On Apr 27, 2011, at 1:17 PM, Oscar wrote:
 
 I just want to configure myapp as default without rename it to init.
 That's all.

Just set default_application in routes.py.

 
 
 
 On 27 abr, 14:28, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 27, 2011, at 10:34 AM, Oscar wrote:
 
 
 
 Nope,
 
 I didn't use URL tag, but i was suspecting it.
 
 There is a Way to invoke the default application without hide the
 entire URL?
 
 Sure, just don't specify the defaults. Or don't use routing at all, if you 
 don't want to hide anything.
 
 You need to explain a little more specifically what's working, what's not, 
 and what your URLs ought to look like.
 
 
 
 
 
 
 
 
 
 On 27 abr, 12:41, pbreit pbreitenb...@gmail.com wrote:
 If you set default_application in routes.py, it's going to hide /app
 (and /default) which is usually what you want. But everything should still
 work. Do you generate all of your URLs with the URL() tag? (you should)




Re: [web2py] How to run a daemon/service??

2011-04-27 Thread Ismael Alejandro
[SOLVED]

The solution was easy... instead of using pymysql I used

db.executesql()


On Wed, Apr 27, 2011 at 11:58 AM, Ialejandro ialejandr...@gmail.com wrote:

 Hi! Developing my school project app, I have this:

 I have a dir called _configdir with some .ini files, these files have
 this structure:

 [ROOMNAME]
 owner=somename
 data1=somedata
 data2=somedata
 data3=sometada

 Those inis are sent to my sever from many other pcs trough ftp. I made
 this script for parsing and saving the values into a db:

 import os
 import ConfigParser
 import traceback
 import pymysql
 import time

 _configDir = _configuploads


 def save(val):


connection = pymysql.connect(host='127.0.0.1', port=3306,
 user='script', passwd=123, db='hotel')
cursor = connection.cursor()

doop = val['roomname']

cursor.execute(SELECT * FROM rooms WHERE roomname = '%s'%doop)
row = cursor.fetchone()

if row == None:
print doop,'Not in db... Inserting'

keys = val.keys()

values = []

for each in keys:
values.append(val[each])

s1 = ','.join(keys)

count = len(val)

per = (%s,*count)[:-1]

command = insert into rooms (%s)%s1+ values (%s)%per
args =  tuple(values)
cursor.execute(command,args)


else:
print doop,'Already in DB... Updating'
keys = val.keys()

values = []

for each in keys:
values.append(val[each])

listy = []
for key,value in val.items():
listy.append(%s='%s'%(key,value))

sready = , .join(listy)


command = update rooms set %s%sready+where roomname =
 '%s'%doop

cursor.execute(command)



cursor.close()
connection.close()

 def parse(filename):
try:
config = ConfigParser.ConfigParser()

config.read(filename)
rooms = config.sections()

dictio = {}
for room in rooms:
dictio[room] = {}
options = config.options(room)

for option in options:
dictio[room][option] = config.get(room,option)

rrom = dictio.keys()[0]

valdict = dictio.values()[0]
valdict['room'] = '%s'%rrom


save(valdict)

return 0
except:
print Something failed!
print traceback.format_exc()
return 1



 def main():
objects = os.listdir(_configDir)
for item in objects:
fitem = os.path.join(os.getcwd(),_configDir,item)
parse(fitem)


 while True:
time.sleep(5)
main()



 And it works fantastic!!

 But I need to have the same functionality of that script into my
 web2py app...

 How could I do it???


[web2py] Re: Best practice to start background process

2011-04-27 Thread Ross Peoples
This is a copy  paste of something I wrote a month ago or so:

I was able to get background processes to work pretty well. I have an import 
script that takes a minute or two to run and is started by an ajax call from 
a button in one of my views, and the progress is reported back to the page 
as the script runs. The way I did this was to use multiprocessing. Here is 
an example class:

from miltiprocessing import Process, Queue

class ImportScript(Process):
queue = Queue()
progress = (0, 0, 'Idle')

def __init__(self, environment, db):
Process.__init__(self)
self.db = db

def run(self):
self._do_import(arg1, arg2)

def _do_import(self, arg1, arg2):
# long running task here
self._update_progress((1,100, 'Importing'))

def _updatre_progress(self, progress):
ImportScript.queue.put(progress)
print '%s: %s of %s' % (progress[2], progress[0], progress[1])

@staticmethod
def get_progress():
queue = ImportScript.queue
progress = ImportScript.progress
while not queue.empty():
progress = queue.get(False)

ImportScript.progress = progress
return progress

I called this file scripts.py, and added to my modules folder. Then in 
db.py, I initialize it by calling:

scripts_module = local_import('scripts', reload=False)  # reload=False is 
important

In my controller, when I want to start this process, I call:

import_script = scripts_module.ImportScript(globals(), db)
import_script.start()

The script starts and the controller continues execution while the script 
runs in the background. Then if I want to check progress on the script, I 
make an ajax call to another action in the controller that returns progress:

progress = scripts_module.ImportScript.get_progress()
return '%s: %s of %s' % (progress[2], progress[0], progress[1])

This would return something similar to:
Importing records: 5 of 100


[web2py] Programmatically uploading images

2011-04-27 Thread dhmorgan
My goal is to create an Android app that will take a photo and upload
it to  Web2Py photolog apps running on GAE and my local server.

I am scripting Android with Python and had expected to use something
like urllib2 to post the image and data to an upload_photo crud.create
form.

When trying to post directly to a Web2Py-created form, nothing gets
written -- apparently because I'm not sending the _formkey. When using
my own form, the best I've been able to accomplish is adding
everything but the data.

Is there a more sensible route to getting images into a database
programmatically? If it must be through a form, will I need to somehow
capture and return the _formkey along with the upload?

Any comments, leads, or questions will be appreciated.


Model:

db.define_table('photolog',
Field('photo','upload',label='Photo',
   uploadfield='photo_data'),
Field('title',default=''),
Field('photo_data','blob'),
auth.signature)

db.photolog.title.requires = [IS_NOT_IN_DB(db,
 db.photolog.title),]



This contoller and view work as expected:

def add_photo():
return dict(form=crud.create(db.photolog))
-
div id=photolog_form
{{=form}}
/div




From web2py shell, I can insert records to the database
programmatically with:

filename = 'pic.jpg'
stream=open(filename,'rb')
db.photolog.insert(title='Not again!', \
  photo=db.photolog.photo.store(stream,filename), \
  photo_data=stream.read())
db.commit()



A controller that doesn't work (even through the browser):


def add_photo():
form = SQLFORM(db.photolog)
if form.accepts(request.vars, session, dbio=False):
title = request.vars.title
photo = request.vars.photo.file
data = photo.read()
form.vars.id = db.photolog.insert(title=title,
photo=db.photolog.photo.store(photo,photo.name),
photo_data=data)
db.commit()
return dict(form=form)




Client-side Python script:

I've tried variations on the this, along with trying to use Doug
Hellmann's urllib2 multi-part form helper (http://www.doughellmann.com/
PyMOTW/urllib2/):


filename = 'pic.jpg'
stream=open(filename,'rb')
data = {'title': 'Super Photo',
'photo': (stream, filename),
'photo_data': stream.read()
}

urllib2.urlopen('http://example.com/init/photolog/add_photo',
data)




[web2py] Re: CNAME and routes.py file

2011-04-27 Thread Oscar
will be supressed myapp from the url?


On 27 abr, 16:24, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 27, 2011, at 1:17 PM, Oscar wrote:



  I just want to configure myapp as default without rename it to init.
  That's all.

 Just set default_application in routes.py.









  On 27 abr, 14:28, Jonathan Lundell jlund...@pobox.com wrote:
  On Apr 27, 2011, at 10:34 AM, Oscar wrote:

  Nope,

  I didn't use URL tag, but i was suspecting it.

  There is a Way to invoke the default application without hide the
  entire URL?

  Sure, just don't specify the defaults. Or don't use routing at all, if you 
  don't want to hide anything.

  You need to explain a little more specifically what's working, what's not, 
  and what your URLs ought to look like.

  On 27 abr, 12:41, pbreit pbreitenb...@gmail.com wrote:
  If you set default_application in routes.py, it's going to hide /app
  (and /default) which is usually what you want. But everything should 
  still
  work. Do you generate all of your URLs with the URL() tag? (you should)


Re: [web2py] Re: CNAME and routes.py file

2011-04-27 Thread Jonathan Lundell
On Apr 27, 2011, at 2:07 PM, Oscar wrote:
 
 will be supressed myapp from the url?

Yes. That's really all that being the default application means. If you don't 
want it suppressed, then don't set it as the default.

 
 
 On 27 abr, 16:24, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 27, 2011, at 1:17 PM, Oscar wrote:
 
 
 
 I just want to configure myapp as default without rename it to init.
 That's all.
 
 Just set default_application in routes.py.
 
 
 
 
 
 
 
 
 
 On 27 abr, 14:28, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 27, 2011, at 10:34 AM, Oscar wrote:
 
 Nope,
 
 I didn't use URL tag, but i was suspecting it.
 
 There is a Way to invoke the default application without hide the
 entire URL?
 
 Sure, just don't specify the defaults. Or don't use routing at all, if you 
 don't want to hide anything.
 
 You need to explain a little more specifically what's working, what's not, 
 and what your URLs ought to look like.
 
 On 27 abr, 12:41, pbreit pbreitenb...@gmail.com wrote:
 If you set default_application in routes.py, it's going to hide /app
 (and /default) which is usually what you want. But everything should 
 still
 work. Do you generate all of your URLs with the URL() tag? (you should)




[web2py] Re: CNAME and routes.py file

2011-04-27 Thread Oscar
Ok,

Thank you for your help.

On 27 abr, 17:13, Jonathan Lundell jlund...@pobox.com wrote:
 On Apr 27, 2011, at 2:07 PM, Oscar wrote:



  will be supressed myapp from the url?

 Yes. That's really all that being the default application means. If you don't 
 want it suppressed, then don't set it as the default.









  On 27 abr, 16:24, Jonathan Lundell jlund...@pobox.com wrote:
  On Apr 27, 2011, at 1:17 PM, Oscar wrote:

  I just want to configure myapp as default without rename it to init.
  That's all.

  Just set default_application in routes.py.

  On 27 abr, 14:28, Jonathan Lundell jlund...@pobox.com wrote:
  On Apr 27, 2011, at 10:34 AM, Oscar wrote:

  Nope,

  I didn't use URL tag, but i was suspecting it.

  There is a Way to invoke the default application without hide the
  entire URL?

  Sure, just don't specify the defaults. Or don't use routing at all, if 
  you don't want to hide anything.

  You need to explain a little more specifically what's working, what's 
  not, and what your URLs ought to look like.

  On 27 abr, 12:41, pbreit pbreitenb...@gmail.com wrote:
  If you set default_application in routes.py, it's going to hide 
  /app
  (and /default) which is usually what you want. But everything should 
  still
  work. Do you generate all of your URLs with the URL() tag? (you should)


[web2py] Re: Code insert-er for Pydev Eclipse users

2011-04-27 Thread pierreth
OK I see,

This way, Pydev automatically had the missing imports when we are
coding. Personally, I added the library project by project so the
feature is working for me too.

But this does not solve the problem of the missing imports for
existing code if code analysis is activated (Window  Pydev  Editor 
Code Analysis  Option tab  Do Code Analysis checkbox). The script
add the missing imports so you don't have to add them manually. I
guess you work without the Pydev code analysis.

It could also be a good reference for people beginning with web2py.

On 27 avr, 14:04, danto web2py.n...@gmail.com wrote:
 I still don't know what issues are all talking about regarding pydev and
 web2py. I'm using it on archlinux and imports, autocomplete and functions
 are all working pretty well.

 just go to:

 window  preferences  pydev  interpreter-python  libraries

 and add a [new folder] in system pythonpath pointing to the web2py/gluon
 folder of your web2py installation.

 please tell me if this (kind of obvious) thing works for you or I may be
 missing some more magic from web2py (?). I have autocomplete from DAL and
 even from HTML helpers atm

 regards


[web2py] Re: Programmatically uploading images

2011-04-27 Thread pbreit
I don't think you can suppress the formkey check so all I can think of is 
skipping the if form.accepts and processing everything yourself.

You also might want to have a look at XMLRPC which is sort of designed for 
this kind of thing:
http://web2py.com/book/default/chapter/09#XMLRPC

The new REST capabilities might work as well but I couldn't find detail on 
POSTing into them:
https://groups.google.com/d/topic/web2py/gcqEcXIo7RI/discussion


Re: [web2py] Re: CNAME and routes.py file

2011-04-27 Thread pbreit
But I think he wants his app to be the default and still have it show in the 
URL?

[web2py] Re: Best practice to start background process

2011-04-27 Thread pbreit
I tried the cron@reboot approach but couldn't figure out if my processes 
were running or failing so I switched to per minute cron tasks.

At some point it would be nice to have something like Dealyed Jobs 
(https://github.com/tobi/delayed_job) or Celery suport 
(http://celeryproject.org).


Re: [web2py] Re: CNAME and routes.py file

2011-04-27 Thread Jonathan Lundell
On Apr 27, 2011, at 2:40 PM, pbreit wrote:
 But I think he wants his app to be the default and still have it show in the 
 URL?

With the parametric (new) router, you can do that by specifying: 
applications=None in the base router.



[web2py] Fake Tables

2011-04-27 Thread Ross Peoples
I was wondering if anyone has ever tried anything like this before: I
have an application that will be running mostly from data via Python
API calls. This means that I won't really need to use the database at
all. The problem with this approach, is that some important web2py
features are only available when using the DAL. I'll use CRUD and
SQLFORM as an example, but also plugins like PowerTables all require
the DAL and table definitions.

I had thought of loading some of the API's information into a
database, and working off of that, and periodically refreshing but I'd
have to do that every 30 seconds or so and that's a lot of extra work
that could potentially introduce bugs and make debugging harder.

So my question is: Is it possible to define a set of table definitions
(reference fields and all) and pull information from the API instead
of from the database so that I could use things like CRUD and
PowerTables?


[web2py] SQLFORM question

2011-04-27 Thread Kenneth Lundström
I have a table that I´d like to update. Let´s say the table has eight 
different columns but at the time I´d like to only update one of them 
via a form.


in controller:
form = SQLFORM(db.t_bills, bill['id'])

if form.accepts(request.vars, session, keepvalues=True):
redirect()

return dict(form=form)


in view:
I have created a custom view with
{{=form.custom.begin}}
{{=form.custom.widget.f_name}}
{{=form.custom.submit}}
{{=bill_items_form.custom.end}}

So I have only one textfield that can be updated. The problem I´m facing 
is that all rest columns are updated to a NULL value. I tried with 
SQLFORM(db.fsdf, fields but no luck.



Kenneth



[web2py] Re: using janrain

2011-04-27 Thread Allan Daemon
I'm getting this error too. I have no idea whats going on. 

[web2py] Re: Best practice to start background process

2011-04-27 Thread Russell
I think that a simple system cron is the most reliable (per minute,
per hour, per day).  Then use some type of locking mechanism in your
web2py script (either database or file).  For example:

locked = db((db.report_queue.status=='SystemLock')).select().first()
if not locked:
locked = db.report_queue.insert(status='SystemLock')
db.commit()
# and so on


On Apr 28, 5:04 am, teemu teemu.kuulas...@gmail.com wrote:
 Hi,

 I would like to know what would be the best way to start background
 process in production environment. I have implemented background
 process by using the web2py book chapter as a template 
 (http://www.web2py.com/book/default/chapter/04#Background-Processes-and-Task-...;).
 I start background process manually on my development machine
 (Winddows 7, web2py webserver) and it works great. Now it is time to
 publish my app on production server (debian linux, apache2, mod_wsgi).
 I was wondering what would be the best and the most simple way to
 start this background process together with apache/mod_wsgi? Ideal
 solution would be cross-platform compatible but this is not
 mandatory.

 As far as i know there are several different options but I do not know
 what is the best and what are advantages and disadvantages of
 different methods:

 1) manually from shell:
 - laborious and should be done upon every server reboot

 2) init script:
 - good option and can be integrated with apache2 init script

 3) web2py-cron-@reboot:
 - is this even possible or recommended? However, this would be the
 only cross-platform alternative

 3) system cron:
 - cron job could check if background process is still running and
 restart process if it has been crashed

 How have you guys done this? Any suggestions?

 Teemu


[web2py] Re: Code insert-er for Pydev Eclipse users

2011-04-27 Thread drayco
Thank's a lot.

On 27 abr, 16:21, pierreth pierre.thibau...@gmail.com wrote:
 OK I see,

 This way, Pydev automatically had the missing imports when we are
 coding. Personally, I added the library project by project so the
 feature is working for me too.

 But this does not solve the problem of the missing imports for
 existing code if code analysis is activated (Window  Pydev  Editor 
 Code Analysis  Option tab  Do Code Analysis checkbox). The script
 add the missing imports so you don't have to add them manually. I
 guess you work without the Pydev code analysis.

 It could also be a good reference for people beginning with web2py.

 On 27 avr, 14:04, danto web2py.n...@gmail.com wrote:







  I still don't know what issues are all talking about regarding pydev and
  web2py. I'm using it on archlinux and imports, autocomplete and functions
  are all working pretty well.

  just go to:

  window  preferences  pydev  interpreter-python  libraries

  and add a [new folder] in system pythonpath pointing to the web2py/gluon
  folder of your web2py installation.

  please tell me if this (kind of obvious) thing works for you or I may be
  missing some more magic from web2py (?). I have autocomplete from DAL and
  even from HTML helpers atm

  regards


[web2py] Re: SQLFORM question

2011-04-27 Thread DenesL

There are several options but the simplest solution is:

form = SQLFORM(db.t_bills, bill['id'], fields=['f_name'])

this way you only affect the listed fields.



On Apr 27, 7:01 pm, Kenneth Lundström kenneth.t.lundst...@gmail.com
wrote:
 I have a table that I d like to update. Let s say the table has eight
 different columns but at the time I d like to only update one of them
 via a form.

 in controller:
 form = SQLFORM(db.t_bills, bill['id'])

 if form.accepts(request.vars, session, keepvalues=True):
          redirect()

 return dict(form=form)

 in view:
 I have created a custom view with
 {{=form.custom.begin}}
 {{=form.custom.widget.f_name}}
 {{=form.custom.submit}}
 {{=bill_items_form.custom.end}}

 So I have only one textfield that can be updated. The problem I m facing
 is that all rest columns are updated to a NULL value. I tried with
 SQLFORM(db.fsdf, fields but no luck.

 Kenneth


[web2py] Re: Janrain Alternative: SimpleAuth (And its totally free)

2011-04-27 Thread villas
 Thanks for clearing that up. My n00bieness to web stuff obviously shines
 through :)

Hi Stefaan,
No problem,  the web brings many security concerns and you are right
to ask questions.
D


[web2py] Re: Documentation web2py

2011-04-27 Thread villas
Massimo,

Clearly you don't share any concern about the docs,  but I still think
it would be nice to know when you thought a feature was stable and
ready to be documented.  If nothing else, it might encourage us to
join in the documentation effort at that point.

I can reduce my arguments to this:  Undocumented features do not
exist!.

Regards, D


On Apr 27, 4:20 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 On Apr 27, 9:52 am, villas villa...@gmail.com wrote:

  I certainly wouldn't wish to discourage anyone from editing etc by
  introducing unnecessary procedures. However,  I think we need a little
  more clarity.

  Problem 1. If Massimo is only going to make a final decision about
  backwards-compatibility on an annual basis, this is a very long time.
  Could we not include this question of stability and backwards-
  compatibility within the version numbering?  e.g. can we not have LTS
  versions periodically?

 It is not like a make the decision annually. The decision is a
 process. The book is printed annulally thus making it officially.

  Problem 2. The online book is currently not authoritative in any way.
  The only way in which we can currently see what is really stable and
  correct is by seeing what is in the printed version. Ideally the
  online book would be color-coded,  or at least a diff available online
  so we can see what may have been added/amended.

 I disagree.

  Problem 3. The online book may have been edited by someone with as
  little knowledge as I!!  Of course I am cautious when editing,  but
  shouldn't there be some guidelines for reviews by someone more
  senior?

 So far we did not have the problem. Edits have been good and helpful.

  Typos and minor corrections = everyone.
  Major corrections, additional examples = review by active member of
  developer group.

  Problem 4:  We never know what might have changed.  I believe it would
  be very helpful if there was a change diff or log available for edits
  so that we may see what has changed and then perhaps we can review
  each other's edits more easily. In any case, I am sure that many of us
  would like to know what has changed as any new examples and such can
  be very interesting.

 This is a good point. I could edit the app and publish diffs. It would
 be useful but it not going to happen overnight.


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

2011-04-27 Thread toan75
I have this error when set deletable=True:

  File E:\web2py\gluon\globals.py, line 133, in lambda
self._caller = lambda f: f()
  File E:\web2py\gluon\tools.py, line 2335, in f
return action(*a, **b)
  File E:/web2py/applications/init/controllers/plugin_admin.py 
http://127.0.0.01:8000/admin/default/edit/init/controllers/plugin_admin.py, 
line 142, in update
if form.accepts(request.vars, session):
  File E:\web2py\gluon\sqlhtml.py, line 1200, in accepts
self.table._db(self.table.id == self.record.id).update(**fields)
  File E:\web2py\gluon\dal.py, line 5173, in update
fields = self.db[tablename]._listify(update_fields,update=True)
  File E:\web2py\gluon\dal.py, line 4464, in _listify
raise SyntaxError, 'Field %s does not belong to the table' % name
SyntaxError: Field delete_this_record does not belong to the table




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

2011-04-27 Thread toan75
My controller:

def crud1():
form = crud.update(db.container,request.args(0),deletable=True)
if form.accepts(request.vars, session):
pass
return dict(form=form)

I have web2py 1.95.1, Python 2.7  OS Win7 Home


[web2py] Re: Code insert-er for Pydev Eclipse users

2011-04-27 Thread mart
yes, ditto for pydev on mac, although... I don't always want to do
that because, some scripts that use some web2py libraries don't get
rolled out with Aptana or eclipse. So, your tool would be handy to
have during development as well...

Anyways, I'd like to try it.

Thanks,
Mart :)

On Apr 27, 7:53 pm, drayco antrod...@gmail.com wrote:
 Thank's a lot.

 On 27 abr, 16:21, pierreth pierre.thibau...@gmail.com wrote:







  OK I see,

  This way, Pydev automatically had the missing imports when we are
  coding. Personally, I added the library project by project so the
  feature is working for me too.

  But this does not solve the problem of the missing imports for
  existing code if code analysis is activated (Window  Pydev  Editor 
  Code Analysis  Option tab  Do Code Analysis checkbox). The script
  add the missing imports so you don't have to add them manually. I
  guess you work without the Pydev code analysis.

  It could also be a good reference for people beginning with web2py.

  On 27 avr, 14:04, danto web2py.n...@gmail.com wrote:

   I still don't know what issues are all talking about regarding pydev and
   web2py. I'm using it on archlinux and imports, autocomplete and functions
   are all working pretty well.

   just go to:

   window  preferences  pydev  interpreter-python  libraries

   and add a [new folder] in system pythonpath pointing to the web2py/gluon
   folder of your web2py installation.

   please tell me if this (kind of obvious) thing works for you or I may be
   missing some more magic from web2py (?). I have autocomplete from DAL and
   even from HTML helpers atm

   regards


Re: [web2py] Re: SQLFORM question

2011-04-27 Thread Kenneth Lundström
I tried that soluttion but I think it didn´t work as expected, it still 
uppdated all records.


I´m using the newest  version web2py on linux.


Kenneth


There are several options but the simplest solution is:

form = SQLFORM(db.t_bills, bill['id'], fields=['f_name'])

this way you only affect the listed fields.



On Apr 27, 7:01 pm, Kenneth Lundströmkenneth.t.lundst...@gmail.com
wrote:

I have a table that I d like to update. Let s say the table has eight
different columns but at the time I d like to only update one of them
via a form.

in controller:
form = SQLFORM(db.t_bills, bill['id'])

if form.accepts(request.vars, session, keepvalues=True):
  redirect()

return dict(form=form)

in view:
I have created a custom view with
{{=form.custom.begin}}
{{=form.custom.widget.f_name}}
{{=form.custom.submit}}
{{=bill_items_form.custom.end}}

So I have only one textfield that can be updated. The problem I m facing
is that all rest columns are updated to a NULL value. I tried with
SQLFORM(db.fsdf, fields but no luck.

Kenneth




[web2py] Re: crud challenge

2011-04-27 Thread mart
Oh, I figured it out alright!

just happened to be wrong, didn't really work, oh and forgot to use
CRUD! ;) LOL (then of course, my free time had expired)... so, no, I
didn't figure it out either :) but,

 if i can, i'd like to make a suggestion... These are really great
exercises, and as Villas points out, they come with access to the guy
with the knowledge to try to understand them, I mean really, does it
get any better?

Would be nice if there was some sort of central place to keep them and
make them available, because once posted (then later the solution),
they are are worth a lot (like many tips and trick found in the
postings, but through time, they can get lost and buried in numbers,
unfortunately) We can always, copy them, but then the google group is
growing and would be missed by new members.

this may be silly (chances are it probably is ;) ) but, my first
thought would be to have some sort of online repository, maybe a
downloadable/updatable app of sorts... best place would obviously be @
web2py.com...  maybe something like slices, but focused on learning,
exercises and a potential ask the expert button! ;) - actually, even
a downloadable text file would be better than not having access at all

Just my 2 cents... there is so much good stuff happening here, so many
areas to touch on, and so much to learn... and for many (like me) time
is way too limited... would be nice to be able to easily go back when
time allows... because, for me at least, web2py is alot about
learning :)

Thanks Denes!
Mart :)

On Apr 27, 10:24 am, DenesL denes1...@yahoo.ca wrote:
 It takes some time to figure out and understand everything that goes
 on, that is why I thought of sharing it via an exercise first, maybe
 somebody else could come up with a different solution.

 Anyway, it is good to hear that there were people trying and that the
 info might be useful.
 Thanks for the input. Further discussion is always welcome.

 On Apr 27, 8:37 am, villas villa...@gmail.com wrote:







  Thanks Denes, this was an interesting exercise and it is good that you
  are giving us the benefit of this knowledge.  I suppose like many,  I
  thought about the challenge,  but couldn't figure it out.


[web2py] Re: the '|' charachter i text fields

2011-04-27 Thread mart
hum, i think you're right...

here is how I update:

 
result=compExec.procCmd(cmdline,logfile=None,updateString=None)
 
self.db(self.db.scriptCompiler.id==self.id).update(log=result)
so, with subprocess, proc.communicate() returns a list ['','']. index
0 is stdout and index 1 is stderr. So i guess the stderr is outputting
a list...

So, this means, that if I happen to try to update a text field (no
'string:list') dal will automatically accept a list, without having to
set the type? So, if we really want to store text, i could simply
quote it?

Thanks,
Mart :)

On Apr 27, 8:23 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 My guess is that you are passing a list instead of a string of text.
 In order to put a list into a text field, web2py joins the elements
 using a '|'.

 In your code I do not see where you do insert.

 On Apr 27, 12:36 am, mart msenecal...@gmail.com wrote:







  woops! almost forgot, in the sqlite db, the log field will have
  something like this:

  |'', 'java.lang.NoClassDefFoundError: org/antlr/Tool\r|Caused by:
  java.lang.ClassNotFoundException: org.antlr.Tool\r|\tat
  java.net.URLClassLoader$1.run(Unknown Source)\r|\tat
  java.security.AccessController.doPrivileged(Native Method)\r|\tat
  java.net.URLClassLoader.findClass(Unknown Source)\r|\tat
  java.lang.ClassLoader.loadClass(Unknown Source)\r|\tat
  sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)\r|\tat
  java.lang.ClassLoader.loadClass(Unknown Source)\r|Could not find the
  main class: org.antlr.Tool.  Program will exit.\r|Exception in thread
  main '|

  On Apr 27, 1:33 am, mart msenecal...@gmail.com wrote:

   Hi,

   so, this part is done using DAL (scripted).

   I use subprocess like below to run external scripts and stuff. when
   failures, I want to dump the log in the DB.

   proc = subprocess.Popen(strCmd,shell=True,
                           stdin=subprocess.PIPE,
                           stdout=subprocess.PIPE,
                           stderr=subprocess.PIPE)

               if updStr is None:
                   out = proc.communicate()
                   ... bla bla
                   if len(out[1])0:

   so the resulting 'out[1] gets stored in the DB.

   here's an example of one of the tables:

           db.define_table('scriptCompiler',
                   Field('uuid',length=64,default=uuid.uuid4()),
                   Field('cmdName'),
                   Field('scriptCompiler_directory'),
                   Field('log','text'))
           db.commit()

   I use 'text' to provide for larger logs.

   thanks for your help! :)

   Mart

   On Apr 27, 12:03 am, Massimo Di Pierro massimo.dipie...@gmail.com
   wrote:

No. Can you provide an example of code that make that happen?

On Apr 26, 7:17 pm, mart msenecal...@gmail.com wrote:

 Hi,

 is it expected for a text field to split the text on line breaks and
 insert the '|' character? If yes, is there a way to change that
 behavior?

 Thanks,
 Mart :)


  1   2   >