[web2py] Re: Display IS_IN_SET() label

2010-08-25 Thread jeff
Wuth SQLFORM.factory, the way to do that is to use the default arg the
Field.

On 25 août, 02:58, annet  wrote:
> In a controller I defined a form:
>
> form=SQLFORM.factory(Field('bedrijf',requires=IS_IN_SET([2,3,4,5,6,7],labels=['Fitnesscentrum','Fysiofitnesscentrum','Personal
> Trainer','Dietist(e)','Voedingsconsulent(e)','Yogaschool'],zero=None)))
>
> In the view I would like to display the label of the selected option,
> is this possible?
>
> Kind regards,
>
> Annet.


[web2py:31322] Re: for row in rows

2009-09-19 Thread jeff

Hello,

I'm new to this group and to web2py and even to web development but
not completely to Python and thus this suggestion (that could be
completely wrong):

(and BTW, I would like to use this first post to thank a lot Massimo
Di Pierro for his fantastic work !!! )

On 19 sep, 09:27, annet  wrote:
> I have a table which contains news items. In the view I would like to
> display the first 6 items in full and limit the display of the next 18
> items to their title. So something like:
>
> {{for item in news:}}
{{for item in news[:6]:}}
> 
>   {{=db.nieuws.publicatie_datum.formatter(item.publicatie_datum)}}
> 
>   {{=item.titel}}
>   {{if item.ondertitel:}}{{=item.ondertitel}}{{pass}}
>   {{=XML(item.korte_inhoud)}} 
>   {{=A('Lees meer',_onmouseover="this.style.cursor='pointer;",\
>      _onclick="javascript:newsdetails('%s')"%URL
> (r=request,f='newsdetails',args=[item.id]))}}
>  
> {{pass}}
>
> 
>   
>     {{for item in news:}}
{{for item in news[6:24]:}}
>       
>         
>           {{=item.titel}}
>         
>       
>     {{pass}}
>   
> 
>
> I hope one of you could provide me with the correct for loop to make
> this work.
>
> Kind regards,
>
> Annet.

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



[web2py:20532] Re: psycopg2-2.0.10 install linux ,help me

2009-04-26 Thread jeff



On 26 avr, 00:54, mdipierro  wrote:
> This looks like a psycopg issue. Mind that you need python 2.5 to run
> web2py.
>
> On Apr 25, 11:53 am, "wengfei2...@163.com" 
> wrote:
>
> > [r...@localhost psycopg2-2.0.10]# python setup.py install
> > running install
> > running build
> > running build_py
> > running build_ext
> > Traceback (most recent call last):
> >   File "setup.py", line 410, in ?
> > ext_modules=ext)
> >   File "/usr/lib/python2.4/distutils/core.py", line 149, in setup
> > dist.run_commands()
> >   File "/usr/lib/python2.4/distutils/dist.py", line 946, in
> > run_commands
> > self.run_command(cmd)
> >   File "/usr/lib/python2.4/distutils/dist.py", line 966, in
> > run_command
> > cmd_obj.run()
> >   File "/usr/lib/python2.4/distutils/command/install.py", line 506, in
> > run
> > self.run_command('build')
> >   File "/usr/lib/python2.4/distutils/cmd.py", line 333, in run_command
> > self.distribution.run_command(command)
> >   File "/usr/lib/python2.4/distutils/dist.py", line 966, in
> > run_command
> > cmd_obj.run()
> >   File "/usr/lib/python2.4/distutils/command/build.py", line 112, in
> > run
> > self.run_command(cmd_name)
> >   File "/usr/lib/python2.4/distutils/cmd.py", line 333, in run_command
> > self.distribution.run_command(command)
> >   File "/usr/lib/python2.4/distutils/dist.py", line 965, in
> > run_command
> > cmd_obj.ensure_finalized()
> >   File "/usr/lib/python2.4/distutils/cmd.py", line 117, in
> > ensure_finalized
> > self.finalize_options()
> >   File "setup.py", line 219, in finalize_options
> > except(Warning, w):
> > NameError: global name 'w' is not defined
> > [r...@localhost psycopg2-2.0.10]#
>
> > [r...@localhost psycopg2-2.0.10]# python -V
> > Python 2.4.3

I had the same issue with psycopg2-r407

psycopg2-2.0.9 installs fine with python 2.5

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



[web2py] Re: Run Web2py as a Service? on Ubuntu Lucid?

2010-12-18 Thread jeff
When I had this kind of problem, I removed the --quiet and --
background in the /etc/init.d/web2py file (line 65 and 67 of your 3rd
file).
I was then able to get some error messages when doing /etc/init.d/
web2py start

In my case, it helped me to find a stupid error I did.

Good luck.


On Dec 18, 5:59 am, ghoulmann  wrote:
> Thanks so much for the reply. I did try both; retried them when I saw
> your response. Both commands start web2py.py listening on :8000. SO,
> it does work in these cases. Is there something I can try next?
>
> On Dec 17, 6:34 pm, mdipierro  wrote:
>
> > did you try start it simply with
>
> > python web2py.py -a password
>
> > or
>
> > nohup python web2py.py -a password &
>
> > Does it work fine in these cases?
>
> > On Dec 17, 4:59 pm, ghoulmann  wrote:
>
> > > I'm thankful this community is here. I'm working on a project for the
> > > Sahana-Eden team [1]. It calls for running web2py as a service. I was
> > > thankful to find documentation in the 3rd edition Official Web2py Book
> > > [2]. Sadly, when I follow the docs I can't get the service running. /
> > > etc/init.d/web2py start returns no errors; restart returns no errors,
> > > and status returns nothing. Netstat tells me the interface isn't
> > > listening on port 8000.
>
> > > I did use the scripts/web2py.ubuntu.sh script, and did as instructed
> > > in the documentation. I made changes to some of the paramaters near
> > > the top of the script; I've made it available as a pastebin [3].
>
> > > I've double-checked the daemon directory, and believe it to be
> > > correct. I have created web2py user with no password (using useradd);
> > > as web2py is new to me, I'm not sure that's necessary, but it has been
> > > done. Web2py has precisely the same mode as a working service (webmin
> > > in this case) and is owned root:root. Mode is rwxr-xr-x.
>
> > > I would be very grateful for any guidance, suggestions, improvements,
> > > encouragement you can offer.
>
> > > Ultimately, it's the high school students that have committed to the
> > > project that will benefit - I'm in unfamiliar territory and learning
> > > along with them.
>
> > > Rik
>
> > > [1]http://eden.sahanafoundation.org/wiki/BluePrintlivecdinstaller
> > > [2]http://web2py.com/book/default/chapter/11#Start-as-Linux-Daemon
> > > [3]http://pastebin.com/9Uz45k3G
>
>


[web2py] Re: Running PHP on top of Web2Py

2010-12-30 Thread jeff
This is very interesting and could make me save (or waste) a lot of
time : I have to move a website from PHP to web2py.  The website is
small and not really dynamic : the content is in tables and so but the
site will be  extended (in web2py)  and can be see as a static website
(but with ugly urls with vars).  For some reasons I have to move it
"like that" to web2py quick (and dirty).  I had that way in mind:
- crawl and capture the whole site (not that big and then perfectly
feasible) and put everything in a the static folder of a web2py app.
- write a simple and generic controller function (or generate one
simple controller function per page).
- write a regex script to find and replace the  tags in
order to use URL() in them.
- tweak the route.py file in order to keep the actual urls unchanged
(BTW, I could change the urls if this is done in a good way -this is
the only cleanliness requirement, all the rest can be ugly- for google
and if that's possible for bookmarkers : any hint ?)

It can be some work.  But now I read this thread about using PHP from
web2py. Maybe, that would be quickly done like that. I just don't want
to use any other webserver than web2py (apache or whatever) at this
time. The performance penalty is not an issue (the part of the site
that will remain in php is there for historical reasons and not
heavily used).

My main concerns about this way are:
- the complexity of having runphp working
- the work on the templates : I guess that I have to put the php
templates in the view folder but I don't see exactly what else I have
to do on them
- do I have to tweak routes.py ? in the same way as above ?

I would appreciate any insights about that.

On Dec 30, 7:42 am, mdipierro  wrote:
> All you need is this this (except for windows) in a model (php.py?):
>
> from subprocess import Popen, PIPE
> import sys, os, threading
> def runphp(source):
>         PHP_BIN = '/usr/bin/php'
>         PHP_ARGS = ['-q']
>         PHP_IN_SHELL = True
>             php = Popen([PHP_BIN,] + PHP_ARGS, shell=PHP_IN_SHELL,
>                   bufsize=1<<12, universal_newlines=True, ## restriction of
> templates
>                   stdin=PIPE, stdout=PIPE, #stderr=PIPE,
>                   close_fds= True)
>         php.stdin.write(source)
>         php.stdin.close()
>         page = php.stdout.read()
>         php.stdout.close()
>         return page
>
> than in web2py
>
> def index():
>     return runphp(response.render('theview.html',a=1,b=2,c=3))
>
> theview.html will first be processed as a web2py template and then as
> a php template. Mind that it is slow. For every page it create a new
> process.
>
> I did not try and I may have typos but should work.
>
> Massimo
>
> On Dec 30, 12:03 am, John-Kim Murphy  wrote:
>
> > I have been thinking about how to run PHP on top of Web2Py. I'm interested
> > in doing this because I want to augment an existing PHP app via Web2Py (For
> > example, use the T() internationalization object; use Web2Py's auth access
> > control). Also it will be easier to port a PHP application to Web2Py one
> > piece at a time if the rest of the unported application can run as PHP.
>
> > Something similar was done with 
> > Django: the
> > PHP-based PmWiki  
> > and
> > even WordPress were integrated with 
> > Django.
> > I've been studying the Python source 
> > code,
> > and it looks like this could be used to render PHP from a Web2Py view. I'm
> > trying to imagine how this would fit into Web2Py; perhaps distributed as a
> > plugin:
>
> >    1. The PHP code should not be aware it is running on top of Web2Py. Any
> >    Web2Py template language is expanded before being sent to the PHP 
> > parser. (I
> >    just watched the video, and it provides some more details. It looks like 
> > the
> >    PHP files had to be modified a bit, which I was trying to avoid, if
> >    possible.)
> >    2. The PHP files (possibly with some {{Web2Py template code}} added) seem
> >    like views, but a PHP application will not have any associated Web2Py
> >    actions. Should there be a Web2Py controller that manages requests for 
> > PHP
> >    content, picking the correct PHP file based on the request? Should the 
> > PHP
> >    files just reside in a new, special php directory?
> >    3. How are POST, GET, and SESSION variables passed to/from PHP? It seems
> >    PHP sessions are stored on the server; not sure about POST and GET... 
> > PmWiki
> >    uses URL variables, so I think they are being passed somehow.
>
> > Any insights from people more familiar with Web2Py, PHP, and/or Django much
> > appreciated!
>
> > John
>
>


[web2py] Re: Running PHP on top of Web2Py

2011-01-08 Thread jeff
I had another idea which is a simplification on my first one : an
action acting like a proxy on the php server.
I just wrote a little POC that seems to work.  Here are the few lines
to put in a controller:

import urllib

def make_get_stuff(an_url):
def get_stuff():
stuff=urllib.urlopen(an_url)
return stuff.read(),stuff.info(),stuff.getcode()
return get_stuff

HEADER_TAGS_TO_COPY=("Content-Type","Date","Accept-Ranges","Content-
Length",
 "Etag","Last-Modified","Server","X-Powered-By")

def proxy():
stuff_url="http://www.mysite.be/%s?%s"; % (request.url[22:],
request.env.query_string)
stuff_content,stuff_info, stuff_status=cache.ram(stuff_url,
 lambda: cache.disk(stuff_url,
 
make_get_stuff(stuff_url),time_expire=None),time_expire=40)
for header_tag in HEADER_TAGS_TO_COPY:
header_line=stuff_info.getheader(header_tag)
if header_line: response.headers[header_tag]=header_line
response.status=stuff_status
return stuff_content

And I have obviously to write some lines in routes.py like (the proxy
action is in the w.py controller of the poc app):

(r'.*:http://.*:.* /(?P(?:admin/|poc/).*)',
r'/\g'),
(r'.*:http://.*:.* /(?P.*)',
r'/poc/w/proxy/vars=\g'), # I think that's not used

That seems do the job (and it's quite fst ;-)  ).  I can even
crawl the old website and it will stand entirely in the cache, I would
then be able to shut down the php server (providing I manage the 4xx
errors myself)

Some questions about that solution:
- are there any drawbacks that I don't see ? (except that the cache
MUST be managed).
- what are the headers lines that are better to be copied from the php
response ? I guess that the only criterion is to please Google and I
have few clues about their likes and dislikes.  Content-Type must be
copied, that's for sure, for the others, I don't know and for the ones
added by web2py : Set-Cookie (session.forget ?), Pragma, Cache-
Control, ... I don't know if it's better to keep them or not : I don't
want to foolish Google in a way or another.
- I could replace the cache (or add that to it) by using the db (mysql
in prod) to store of the old php site stuffs (pages, images,
ppt, ...). Any advice ?

Best wishes everybody and thx to all of you : OSS is great, web2py is
huge and that community is s cool !



On Dec 30 2010, 6:07 pm, mdipierro  wrote:
> > My main concerns about this way are:
> > - the complexity of having runphp working
>
> there is no complexity but it is rally slow.
>
> > - the work on the templates : I guess that I have to put thephp
> > templates in the view folder but I don't see exactly what else I have
> > to do on them
>
> Or move them in views/phpand make a web2py controllerphp.py with one
> action for each file . wiht the instructions above you will be able to
> inject both web2py tags {{...}} andphptags 
>
> > - do I have to tweak routes.py ? in the same way as above ?
>
> It depends on the original files. Probably yes.
>
> Why not look at this first:
>
> http://www.web2py.com/php


[web2py] Re: T-Shirts web2py

2011-01-29 Thread jeff
How about :

  Build th web!
(AND GET A LIFE)

On Jan 26, 3:24 pm, Massimo Di Pierro 
wrote:
> How about
>
> "get it done!" or "build the web!"
>
> "get the things done" seems too long. I would buy some T-shirts. :-)
>
> On Jan 26, 2011, at 7:28 AM, Bruno Rocha wrote:
>
> > I dont like too much the idea of putting Python logo together, I like to 
> > have just the web2py logo, but if we have a web2py foundation store, would 
> > be a great to sell some stuff with only the Python Logo ( in according with 
> > PSF)
>
> > I have some ideas ->http://twitpic.com/3tk467/full
>
> > 
>
> > Bruno Rocha
> >http://about.me/rochacbruno/bio
>
>


[web2py] Re: OpenERP like widgets

2011-03-25 Thread jeff
Some elements about what you are asking about :
- The company behind OpenERP (Tiny) wrote the OpenERP client/web
server with another (french) company and I guess that the reason they
didn't do that on their own is that this is a huge work.
- Both clients (the web server you want to rewrote and the GTK client)
doesn't know the logic in OpenERP : they are able to display any
module (even a module that will be written tomorrow).  If you want to
write a client like that, you need to be at this level of abstraction
and this is very different that write a client for a specific module
using xml-rpc to connect to the OpenERP server and send/get business
data.
- You should check that the API betwwen server and client is really
public (actually, I guess it isn't) otherwise your client will be
broken by any change in that interface,
- I have in mind that the clients are (or will be) modular and accept
plug-ins.  In that case, you will have to accept the same plugins.

My advice then : OpenERP is open source and you should dive into it,
maybe in taking part of the development. The hard part of the work is
really there and not in web2py I suppose. If you do that, I'm pretty
confident that you'll come back with more specific questions ... and
get answers ;-)

Good luck (hoping that you understood, not that your english is bad,
mine is terrible ;-).

On Mar 24, 10:50 am, Indra Gunawan  wrote:
> 1. What stuff I need to build like that* web interface?
> 2. Is there ready to use Python classes that wrap for example ExtJS classes,
> or the other?
> 3. Can you points me in general; steps building like that* website using
> Web2Py?
>
> For example.
> 1. You need this, this and this
> 2. Do like this in your controller and put like this in your template
> 3. Done, you get responsive ajax based web interface like that*
>
> PS. Sorry my English :)
>
> Thank you
>
> On 24 March 2011 15:34, Mengu  wrote:
>
>
>
>
>
>
>
>
>
> > what exactly do you need and want us to tell about?
>
> > On Mar 23, 1:47 pm, Indra Gunawan  wrote:
> > > Hi, any idea how to create application (I mean the view, javascript/ajax
> > > widget etc) like thishttp://demo.openerp.com/?
> > > Using Web2Py off course.
>
> > > OpenERP also build from python:
> > > 1. Server (XML-RPC) -> Python
> > > 2. Web Clienthttp://demo.openerp.com/-> TurboGears (this presentation
> > > layer interest me)
> > > 3. Desktop client -> Python with wxPython (I'm not interest) :D
>
> > > What tools do I need? How?
>
> > > PS. I'm new using web2py.
>
> > > Thank you
>
> > > --
> > > coderbuzz
>
> --
> Salam
> Indra Gunawan


[web2py] Help needed adding rows to a database table...

2010-06-14 Thread Jeff Elkner
It is the end of the school year and my students and I are trying to
create simple projects using web2py.

Can you point me to a "simple" example of web2py creating and
accessing a database?  By "simple" I mean from the teaching
perspective.  I wanted to create a little application that stored
quotes in a database.  Here is what I have so far:

The Controller (default.py):

def index():
   return dict()

def addquote():
   form = SQLFORM(db.quotes)
   return dict()


The Views (index.html):


http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
http://www.w3.org/1999/xhtml"; xml:lang="en">

Quotable Quotes



Quotable Quotes

Choose:

 Add a quote to the database.





and addquote.html:



http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
http://www.w3.org/1999/xhtml"; xml:lang="en">

Quotable Quotes



Quotable Quotes



 Quote:
 


 Author:
 

Submit






and finally the db.py file:

db = DAL('sqlite://storage.sqlite')

db.define_table('quotes', Field('quote'), Field('author'))

++

The database gets created, and when I visit the addquote.html view, I
can fill in the forms and click the submit button without error, but
no rows are added to the table.

How can I get that to work?  The database chapter in the book is not
very helpful to a database beginner such as myself, since all the
examples are from a shell, and it doesn't show how to connect the
pieces together inside an application.

Thanks!

jeff elkner


[web2py] Setting up a web2py server...

2010-06-14 Thread Jeff Elkner
Hi Massimo,

I'm still working on a recipe for setting up a web2py server on Ubuntu
10.04.  I've asked the help of a friend, Douglas Cerna, who does not
know web2py, but who is a Zope 3 developer on the SchoolTool project.
We are interested in using web2py to create websites for some schools
with which we are working in El Salvador.  To limit the expense at
this early stage in the process, I plan to setup two instances of
web2py -- one for my personal website and one for the Salvadoran
project.

Here is what we have so far:

http://docs.google.com/View?id=dgv2st82_287c4t9chdt

We are trying to work out a few issues with the base href of the site.
 Using apache rewrite rules, the default directory gets taken out of
the path, so applications that work on the development server on my
desktop break on the web site.

I'll post updates, but any guidance which would save us time would be
most appreciated!

Thanks.

jeff elkner


[web2py] T2, T3, Cube2py ...

2010-07-13 Thread Jeff S
Hi,

I'm not sure I understand all of this T2 T3 and Cube2py stuff.  I have
recently installed web2py(1.76.3) on my computer and I read somewhere
that T2, T3 are deprecated and Cube2py would be the new stuff.  But
what is T2 and T3 anyway?  Is it like project code names that were
included in web2py as upgrades like CRUD got included some time ago?

What is the direction of web2py with cube2py?  As far as I understand
it, T3 is part of web2py, no?  Cube2py only looks like another
application like anyone that can be installed on web2py, or is it more
than that?  Actually Cube2py does not seem to work with my 1.76.3.  I
guess I'll have to upgrade to the latest revision in order to use
Cube2py.

Thanks,


[web2py] Upgrade web2py now(from 1.76.3 to 1.80.1)

2010-07-13 Thread Jeff S
Is there any known caveats to upgrade web2py from from 1.76.3 to
1.80.1?

I get the following error:

unable to upgrade because "[Errno 13] Permission denied: 'D:\\Inbox\
\Web2py\\web2py/MSVCR71.dll'"

Thanks,


[web2py] Re: Upgrade web2py now(from 1.76.3 to 1.80.1)

2010-07-13 Thread Jeff S
Microsoft Windows XP, Professional Version 2002 Service Pack 3

I will re-install web2py.

Thanks,


[web2py] SOAP Access

2010-07-14 Thread Jeff S
Any chance that an easy tool will be added to web2py for SOAP access,
both in service and client?

Although it is not that hard to add a third party like I did with
SUDS, but a tightly coupled tool could be usefull.

Just a wish.

SOAP is a W3C Recommendation
Reference:
http://www.w3schools.com/soap/soap_intro.asp


[web2py] Re: SOAP Access

2010-07-14 Thread Jeff S
I actually only use the client side to retrieve information from a
service provider, but I thought it could be great for some other
person/companies to also have the service side to provide on-demand
data other than through a web-browser.  I mean, some services like
Google have the browser access as well as the SOAP access.  If a
company would like to use web2py for browser access, they could
provide SOAP access as well through it.  Maybe it is not a good idea
for whatever reason.  I'm just an humble hardware engineer, I'm not an
IT expert.  I'm only trying to create a proof of concept with web2py.
Although I'd like our IT dept to eventually evaluate web2py, IMHO,
that would ease the creation of internal tools.  If I manage to create
something, imagine what they could do.


[web2py] Wiki in Chap 3 of Documentation

2010-07-21 Thread Jeff S
Does someone have an uploadable version of the wiki application found
in chapter 3?

The search page does not work on my computer, but I can't understand
why.  My best guess would be a security feature in Internet Explorer,
but I would like to exclude the possibility of an error in my code.

The behavior on my computer is that what ever I type in the input
form, there is nothing happening.  I only see my own text.

Thanks,


[web2py] Re: Wiki in Chap 3 of Documentation

2010-07-23 Thread Jeff S
You can attach the w2p package if you want to, but I modified the "def
bg_find()" as you did and now it's working as expected.

Thank you,

Jeff


[web2py] Re: SOAP Access

2010-07-24 Thread Jeff S
So far, SUDS is working okay.  I think I'll stay with it unless I
really have problems with it.

Thanks all!


[web2py] Re: book revision

2010-07-24 Thread Jeff S
For new users like me, downloadable packed applications would be great
with each examples in the book.  A few times, the examples were not
showing correctly online and the cut&paste on IE browser is not
providing the line feed and carriage return showing online.

Although, the packed applications don't really have to be included in
the book.  They could be available anywhere else.

The more I read the book and the more I read the posts in this group,
the more I know I don't know much of Python and web2py.  :)


[web2py] exec_environment exception

2010-01-09 Thread Jeff Bauer

Error attempting the example on page 125 of the
new web2py manual:

>>> from gluon.shell import exec_environment
>>> oprep = exec_environment('applications/oprep/models/db.py')
Traceback (most recent call last):
  File "", line 1, in 
  File "gluon/shell.py", line 62, in exec_environment
execfile(pyfile, env)
  File "applications/oprep/models/db.py", line 17, in 
auth=Auth(globals(),db)  # 
authentication/authorization

  File "gluon/tools.py", line 540, in __init__
self.settings.login_url = self.url('user', args='login')
  File "gluon/tools.py", line 500, in url
f=f, args=args, vars=vars)
  File "gluon/html.py", line 173, in URL
raise SyntaxError, 'not enough information to build the url'
SyntaxError: not enough information to build the url
>>>

I'm using the current version 1.74.5 of web2py.

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




[web2py] repopulating form with data after form.errors encountered

2010-01-09 Thread Jeff Bauer

I'm following another example in the manual using SQLFORM.
The code works as advertised.  The only fly in the ointment
is when form.errors is True, the user's entry form no longer
displays her original values.  I'm assuming there's a simple
way to pass the request vars back into form at line 11
before return.

 1 def diag_form():
 2if len(request.args):
 3records = db(db.socdiag.id==request.args[0]).select()
 4if len(request.args) and len(records):
 5form = SQLFORM(db.socdiag, records[0], deletable=True)
 6else:
 7form = SQLFORM(db.socdiag)
 8if form.accepts(request.vars, session):
 9response.flash = 'form accepted'
10elif form.errors:
11response.flash = 'form has errors'
12return dict(form=form)

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




[web2py] enforcing a one-to-one relationship

2010-01-09 Thread Jeff Bauer

I'm trying to enforce a one-to-one relationship between
tables socdiag and socform with unique:

db.define_table('socdiag',
Field('socform', db.socform, unique=True),

However the socdiag table permits multiple values of the
same socform's id to occur in the socform column.  I'm using
sqlite.

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




Re: [web2py] Re: repopulating form with data after form.errors encountered

2010-01-10 Thread Jeff Bauer

form.vars.update(request.vars)  <-- what I was looking for, thanks.

I also appreciate the simplified code.  The original code posted
was taken from page 193 of the web2py manual.

-Jeff

On 01/09/2010 11:32 PM, mdipierro wrote:

You can simplify your code

def diag_form():
 form = SQLFORM(db.socdiag, request.args(0), deletable=True)
 if form.accepts(request.vars, session):
 response.flash = 'form accepted'
 elif form.errors:
 # (1)
 response.flash = 'form has errors'
 return dict(form=form)

I am not sure what you asked. Try insert in (1)

form.vars.update(request.vars)

OR

if form.record: form.vars.update(form.record.as_dict())

OR

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




Re: [web2py] Re: enforcing a one-to-one relationship

2010-01-10 Thread Jeff Bauer

Working from changeset 94:4fd248d09b52, the unique column is
enforced, but the dropdown is missing.  It is replaced by a
text (string) entry field.  If I add the following code to
db.py, the dropdown reappears:

db.socdiag.socform.requires = \
IS_IN_DB(db, 'socform.id',
_and=IS_NOT_IN_DB(db, 'socdiag.socform'))

However, with the above code, I was expecting only valid
id's (unused) to show appear in the dropdown.  Instead ALL
socform.id's appear.

In any case the suggestion to add: _and=IS_NOT_IN_DB(...
to enforce integrity solves my immediate issue.  Thanks.

-Jeff

On 01/10/2010 12:22 AM, mdipierro wrote:

Try this again with the code in trunk. assuming you have a format

db.define_table('socform',...,format="")

you will get a default validator

db.docfiag.socform.requires=IS_IN_DB(,_and=IS_NOT_IN_DB(...))

that will make both the dropdown and the reference unqueness enforced
by the validator.

On Jan 9, 5:30 pm, Jeff Bauer  wrote:

I'm trying to enforce a one-to-one relationship between
tables socdiag and socform with unique:

db.define_table('socdiag',
  Field('socform', db.socform, unique=True),

However the socdiag table permits multiple values of the
same socform's id to occur in the socform column.  I'm using
sqlite.

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




Re: [web2py] Re: repopulating form with data after form.errors encountered

2010-01-10 Thread Jeff Bauer

Yes, keepvalues=True is the default.  My form is using the
checkbox widget, and it appears the values aren't retained
upon a form error.

Field('inpatient_procedure', 'string',
widget=SQLFORM.widgets.checkboxes.widget,

Hmmm, the database is updated, but the values aren't
displayed on the form even when they exist, so it's a widget
problem I suppose.  For completeness:

db.socdiag.inpatient_procedure.requires = IS_IN_SET([ \
'NA - Not applicable','UK - Unknown'])

-Jeff

On 01/10/2010 12:25 AM, mdipierro wrote:

That is the default. Are you telling me it is not?

On Jan 9, 11:44 pm, Thadeus Burgess  wrote:

like request.accept(keepvalues=True)... but only if there was an error.

-Thadeus

On Sat, Jan 9, 2010 at 11:32 PM, mdipierro  wrote:

You can simplify your code



def diag_form():
form = SQLFORM(db.socdiag, request.args(0), deletable=True)
if form.accepts(request.vars, session):
response.flash = 'form accepted'
elif form.errors:
# (1)
response.flash = 'form has errors'
return dict(form=form)



I am not sure what you asked. Try insert in (1)



   form.vars.update(request.vars)



OR



   if form.record: form.vars.update(form.record.as_dict())



OR



   [form.vars[key]=db.socdiag[key].default for key in
db.socdiag.fields]



Does of them solves your problem?



On Jan 9, 5:12 pm, Jeff Bauer  wrote:

I'm following another example in the manual using SQLFORM.
The code works as advertised.  The only fly in the ointment
is when form.errors is True, the user's entry form no longer
displays her original values.  I'm assuming there's a simple
way to pass the request vars back into form at line 11
before return.



   1 def diag_form():
   2if len(request.args):
   3records = db(db.socdiag.id==request.args[0]).select()
   4if len(request.args) and len(records):
   5form = SQLFORM(db.socdiag, records[0], deletable=True)
   6else:
   7form = SQLFORM(db.socdiag)
   8if form.accepts(request.vars, session):
   9response.flash = 'form accepted'
10elif form.errors:
11response.flash = 'form has errors'
12return dict(form=form)



Jeff Bauer
Rubicon, Inc.



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



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




Re: [web2py] Re: repopulating form with data after form.errors encountered

2010-01-10 Thread Jeff Bauer

As I'm the one with the issue, I'll take a look.  I've got
no experience with this codebase however and will probably
make queries on irc #web2py if anyone's listening.

Should I file a bug report?

-Jeff

On 01/10/2010 09:30 AM, mdipierro wrote:

You are right. it s widget problem. It is a bug. I will see what I can
do but I could use some help on this one.

On Jan 10, 8:31 am, Jeff Bauer  wrote:

Yes, keepvalues=True is the default.  My form is using the
checkbox widget, and it appears the values aren't retained
upon a form error.

Field('inpatient_procedure', 'string',
  widget=SQLFORM.widgets.checkboxes.widget,

Hmmm, the database is updated, but the values aren't
displayed on the form even when they exist, so it's a widget
problem I suppose.  For completeness:

db.socdiag.inpatient_procedure.requires = IS_IN_SET([ \
  'NA - Not applicable','UK - Unknown'])

-Jeff

On 01/10/2010 12:25 AM, mdipierro wrote:


That is the default. Are you telling me it is not?



On Jan 9, 11:44 pm, Thadeus Burgesswrote:

like request.accept(keepvalues=True)... but only if there was an error.



-Thadeus



On Sat, Jan 9, 2010 at 11:32 PM, mdipierrowrote:

You can simplify your code



def diag_form():
 form = SQLFORM(db.socdiag, request.args(0), deletable=True)
 if form.accepts(request.vars, session):
 response.flash = 'form accepted'
 elif form.errors:
 # (1)
 response.flash = 'form has errors'
 return dict(form=form)



I am not sure what you asked. Try insert in (1)



form.vars.update(request.vars)



OR



if form.record: form.vars.update(form.record.as_dict())



OR



[form.vars[key]=db.socdiag[key].default for key in
db.socdiag.fields]



Does of them solves your problem?



On Jan 9, 5:12 pm, Jeff Bauerwrote:

I'm following another example in the manual using SQLFORM.
The code works as advertised.  The only fly in the ointment
is when form.errors is True, the user's entry form no longer
displays her original values.  I'm assuming there's a simple
way to pass the request vars back into form at line 11
before return.



1 def diag_form():
2if len(request.args):
3records = db(db.socdiag.id==request.args[0]).select()
4if len(request.args) and len(records):
5form = SQLFORM(db.socdiag, records[0], deletable=True)
6else:
7form = SQLFORM(db.socdiag)
8if form.accepts(request.vars, session):
9response.flash = 'form accepted'
10elif form.errors:
11response.flash = 'form has errors'
12return dict(form=form)



Jeff Bauer
Rubicon, Inc.



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



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




Re: [web2py] new in trunk RFC

2010-01-10 Thread Jeff Bauer

Minor error in the trunk, I think.  I only noticed because I
did a fresh clone on a new machine.

WARNING:root:OpenSSL libraries unavailable. SSL is OFF
WARNING:root:WEB2PY CRON: cron.master not found at 
/home/jbauer/web2py/applications/admin/cron/cron.master. Trying to 
re-create.

WARNING:root:WEB2PY CRON Call returned code 1:
web2py Enterprise Web Framework
Created by Massimo Di Pierro, Copyright 2007-2010
Version 1.74.5 (2009-12-30 15:44:00)
Database drivers available: SQLite3
Traceback (most recent call last):
  File "web2py.py", line 20, in 
gluon.widget.start(cron=True)
  File "/home/jbauer/web2py/gluon/widget.py", line 743, in start
import_models=options.import_models, startfile=options.run)
  File "/home/jbauer/web2py/gluon/shell.py", line 167, in run
execfile(startfile, _env)
  File "applications/admin/cron/expire_sessions.py", line 5, in 
for file in os.listdir(path):
OSError: [Errno 2] No such file or directory: 'applications/admin/sessions'

changeset:   95:451c84611bbc

-Jeff

On 01/10/2010 09:38 AM, mdipierro wrote:

There are two new features in trunk. One will probably stay, the other
I do not know:

1) Before you could do

 db.define_table('person',Field('name'),format='%(name)s')
 db.define_table('dog',Field('name'),Field('owner',db.dog))

now you can also have things like

 format=lambda person: person.name.capitalize()

or any other function of a person to represent it.

2) You can have

 db.dog.owner.requires=IS_IN_DB(db,db.person,'%(names)s',
  _and=IS_NOT_IN_DB
(db,db.dog.owner))

The novelty is in the _and.

The problem is that the exclusion is only used in validation, not when
creating the dropdown for IS_IN_DB. The reason is not is that it would
require looking two tables (the referee and the refrences). This could
be done with a JOIN in RDBs but it could not be done efficiently in
NoDBs

Any advice is appreciated.




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




Re: [web2py] Re: enforcing a one-to-one relationship

2010-01-10 Thread Jeff Bauer

There's a further problem here.  The scheme below also
prevents socdiag from ever being updated, because once
the record is created then IS_NOT_IN_DB always fails.

-Jeff

On 01/10/2010 09:28 AM, mdipierro wrote:

Good point. Perhaps the _and solution is not a good one.

On Jan 10, 7:59 am, Jeff Bauer  wrote:

Working from changeset 94:4fd248d09b52, the unique column is
enforced, but the dropdown is missing.  It is replaced by a
text (string) entry field.  If I add the following code to
db.py, the dropdown reappears:

db.socdiag.socform.requires = \
  IS_IN_DB(db, 'socform.id',
  _and=IS_NOT_IN_DB(db, 'socdiag.socform'))

However, with the above code, I was expecting only valid
id's (unused) to show appear in the dropdown.  Instead ALL
socform.id's appear.

In any case the suggestion to add: _and=IS_NOT_IN_DB(...
to enforce integrity solves my immediate issue.  Thanks.

-Jeff

On 01/10/2010 12:22 AM, mdipierro wrote:


Try this again with the code in trunk. assuming you have a format



db.define_table('socform',...,format="")



you will get a default validator



db.docfiag.socform.requires=IS_IN_DB(,_and=IS_NOT_IN_DB(...))



that will make both the dropdown and the reference unqueness enforced
by the validator.



On Jan 9, 5:30 pm, Jeff Bauerwrote:

I'm trying to enforce a one-to-one relationship between
tables socdiag and socform with unique:



db.define_table('socdiag',
   Field('socform', db.socform, unique=True),



However the socdiag table permits multiple values of the
same socform's id to occur in the socform column.  I'm using
sqlite.



Jeff Bauer
Rubicon, Inc.



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




Re: [web2py] Re: enforcing a one-to-one relationship

2010-01-11 Thread Jeff Bauer

Still fails for me on a record update:

  'value already in database'

-Jeff

On 01/10/2010 09:53 PM, mdipierro wrote:

That is easy to fix. In fact it is now fixed in trunk.

On Jan 10, 9:42 pm, Jeff Bauer  wrote:

There's a further problem here.  The scheme below also
prevents socdiag from ever being updated, because once
the record is created then IS_NOT_IN_DB always fails.

-Jeff

On 01/10/2010 09:28 AM, mdipierro wrote:


Good point. Perhaps the _and solution is not a good one.



On Jan 10, 7:59 am, Jeff Bauerwrote:

Working from changeset 94:4fd248d09b52, the unique column is
enforced, but the dropdown is missing.  It is replaced by a
text (string) entry field.  If I add the following code to
db.py, the dropdown reappears:



db.socdiag.socform.requires = \
   IS_IN_DB(db, 'socform.id',
   _and=IS_NOT_IN_DB(db, 'socdiag.socform'))



However, with the above code, I was expecting only valid
id's (unused) to show appear in the dropdown.  Instead ALL
socform.id's appear.



In any case the suggestion to add: _and=IS_NOT_IN_DB(...
to enforce integrity solves my immediate issue.  Thanks.



-Jeff



On 01/10/2010 12:22 AM, mdipierro wrote:



Try this again with the code in trunk. assuming you have a format



db.define_table('socform',...,format="")



you will get a default validator



db.docfiag.socform.requires=IS_IN_DB(,_and=IS_NOT_IN_DB(...))



that will make both the dropdown and the reference unqueness enforced
by the validator.



On Jan 9, 5:30 pm, Jeff Bauer  wrote:

I'm trying to enforce a one-to-one relationship between
tables socdiag and socform with unique:



db.define_table('socdiag',
Field('socform', db.socform, unique=True),



However the socdiag table permits multiple values of the
same socform's id to occur in the socform column.  I'm using
sqlite.



Jeff Bauer
Rubicon, Inc.



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




Re: [web2py] Anybody going to PyCon?

2010-01-13 Thread Jeff Bauer

If work will let up long enough, I hope to attend ... the
reason I couldn't take advantage of pre-registration discount.
Assuming I'll be there (60%+), I'd like to see what other
people are doing with web2py.

-Jeff

On 01/12/2010 06:20 PM, mdipierro wrote:

Anybody going to PyCon?

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




Re: [web2py] Re: choose a value

2010-01-13 Thread Jeff Bauer

Thadeus,

Please consider some blog posts toward an immediate goal of
redesign suggestions.  As a new entrant into web2py, it
would be handy for me (and others) to understand where the
edge cases lay.

In the early days of Django, I wrote a lot of forms code
(pre-newforms) and I understand it's a difficult problem
to cover all the use cases.  By putting your thoughts on
a blog, you might encourage comments from other people who
have different perspectives.

Best regards,

-Jeff

On 01/13/2010 02:59 PM, Thadeus Burgess wrote:

I'm not sure there is a good solution with the current design.

At the moment, I am compiling a document with problem with the current
form system. Along with the document I am also including topics that
come up in the google groups and specific issues that continue to arise
where the solution does not seem logical.

When I feel that I have a solution that would work I will share this
document. A working solution being something that sticks to web2py
philosophy, and hopefully as backwards compatible as can be.

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




[web2py] migration reboot

2010-01-15 Thread Jeff Bauer
Automatic database migration in web2py is great.  However,
after a few dozen iterations during development, I'd like
to 'reboot' through all the cruft and set database fields to
agree with my models.  I'm aware that I could go through and
set migration=False, but that's not what I'm looking for.

I don't want to stop using migration. I just want to remove
clutter and restart the process from zero.

Use case: When I access my database outside of DAL, I've got
a bunch of old columns that are no longer in use.

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




Re: [web2py] settting two vars to same text

2010-01-15 Thread Jeff Bauer

On Jan 15, 2010, at 2:26 PM, Wes James wrote:

This seems to work, but is there a better way to set some vars to the
same value?

auth.settings.verify_email_next =
auth.settings.request_reset_password_next ='/app/default/login'

Is this a good technique or keep vars=value on the same line?


The idiom of a = b = c is common in Python, e.g.:

  s = longVarName = "My String of Text Thank You Very Much"

is Pythonic and often easier to follow the writer's intent.

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




Re: [web2py] Re: migration reboot

2010-01-15 Thread Jeff Bauer

On 01/15/2010 03:36 PM, mdipierro wrote:

On Jan 15, 3:24 pm, Jeff Bauer  wrote:

Use case: When I access my database outside of DAL, I've got
a bunch of old columns that are no longer in use.


I assume you use sqlite. sqlite cannot drop columns.With a different
database (if migrate!=False) the database should be exactly what your
model say.


I see:  http://www.sqlite.org/faq.html#q11

So no easy way to do this, but if I want to remove the
clutter anyway I suppose I can:

1. export table to csv
2. drop the table
3. remove the column(s) from the csv file
4. turn off migration
5. import csv
6. turn on migration

Have I left out any steps?

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




Re: [web2py] testers needed

2010-01-17 Thread Jeff Bauer

On 01/17/2010 03:27 PM, mdipierro wrote:

I have rewritten some of the code that deals with dropdowns, in trunk.
In particular now you can do

IS_IN_SET(...,sorted=True)
IS_IN_DB(...,sorted=True)
IS_EMPTY_OR(IS_IN_SET(...,sorted=True))
IS_EMPTY_OR(IS_IN_DB(...,sorted=True))

If your app uses a lot of dropdowns please check nothing is broken by
this change and let us know.


IS_IN_SET works, except problems reported earlier
with SQLFORM.widgets.checkboxes.widget.  (I haven't
gotten around to looking into it like I said I would.)

IS_IN_DB works, except I can't still use it to enforce
a one-to-one relation:

db.diag.soc.requires = IS_IN_DB(db, 'soc.id',
_and=IS_NOT_IN_DB(db, 'diag.soc'))


we also have

IS_DATE_IN_RANGE(minimum,maximum,error_message)
IS_DATETIME_IN_RANGE(minimum,maximum,error_message)

please check them out.


I have a use for IS_DATE_IN_RANGE and will try it out
tomorrow.

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




[web2py] --no-gui option

2010-01-17 Thread Jeff Bauer

When running web2py on a headless server (e.g. Amazon EC2
instance), it's annoying to get a warning message from the
command line and not be able to turn it off.  I've attached
a patch to fix this behavior as an issue in the mercurial
repository.

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




Re: [web2py] Table id referenced to another table error?

2010-01-17 Thread Jeff Bauer

Gibran,

Just use db.Person, not db.Person.id:

  Field('person_id',db.Person)

You can then specify the dropdown:

  db.Activity.person_id.requires = IS_IN_DB(db,
   'Person.id',
   '%(id)s %(name)s',)

Or formatted however you want it to appear.

BTW: The convention would probably be to use 'person'
as your field name in Activity, rather than 'person_id'.

Jeff Bauer
Rubicon, Inc.

On 01/17/2010 08:20 PM, Gibran Rodriguez wrote:

I have 2 tables

db.define_table('Person',
 Field('name',length=45),
 Field('info','text'),
 migrate=False)

db.define_table('Activity',
 Field('type',length=45),
 Field('start_date','date'),
 Field('end_date','date'),
 Field('money',length=45),
 Field('price','double'),
 Field('person_id',db.Person.id <http://db.Person.id>))
 Field('extra_info',length=45),
 Field('owner_user_id',length=4),
 Field('hour','double'),
migrate=False)

so I want to use the Person.id for the field person_id in the table
Activity so that I get a drop downlist of the existing ids but I get the
following error?

File "/home/brangi/Desktop/web2py/gluon/sql.py", line 1242, in define_table
 t = self[tablename] = Table(self, tablename, *fields)
   File "/home/brangi/Desktop/web2py/gluon/sql.py", line 1476, in __init__
 if field.type == 'id':
   File "/home/brangi/Desktop/web2py/gluon/sql.py", line 2383, in __eq__
 return Query(self, '=', value)
   File "/home/brangi/Desktop/web2py/gluon/sql.py", line 2788, in __init__
 right = sql_represent(right, left.type, left._db._dbname,
left._db._db_codec)
   File "/home/brangi/Desktop/web2py/gluon/sql.py", line 502, in
sql_represent
 return str(int(obj))
ValueError: invalid literal for int() with base 10: 'id'


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




[web2py] dynamic importing from an external module

2010-01-17 Thread Jeff Bauer

I've got an external module /odt/dispatcher.py, with
a class defined:

class Dispatcher:
pass

I can import Dispatcher into controllers/default.py.
However, if I edit dispatcher.py to add a new element
while the web2py server is running and attempt to
import it ...

RPATH2 = "411"

... web2py throws an exception:

Traceback (most recent call last):
  File "web2py/gluon/restricted.py", line 173, in restricted
exec ccode in environment
  File "web2py/applications/oprep/controllers/default.py", line 3, in 


from odt.dispatcher import RPATH2
ImportError: cannot import name RPATH2

Once I've shut down the server and restarted, everything's
fine and RPATH2 can be readily imported into the default.py
controller.

Interesting.

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




Re: [web2py] Re: dynamic importing from an external module

2010-01-18 Thread Jeff Bauer

I did not modify sys.path.  The dispatcher module is on
PYTHONPATH and can be imported from within or outside
the web2py server.

Jeff Bauer
Rubicon, Inc.

On 01/18/2010 01:53 AM, mdipierro wrote:

Where is the module? Did you chance sys.path? If so, how/where?

On Jan 17, 11:32 pm, Jeff Bauer  wrote:

I've got an external module /odt/dispatcher.py, with
a class defined:

class Dispatcher:
  pass

I can import Dispatcher into controllers/default.py.
However, if I edit dispatcher.py to add a new element
while the web2py server is running and attempt to
import it ...

RPATH2 = "411"

... web2py throws an exception:

Traceback (most recent call last):
File "web2py/gluon/restricted.py", line 173, in restricted
  exec ccode in environment
File "web2py/applications/oprep/controllers/default.py", line 3, in

  from odt.dispatcher import RPATH2
ImportError: cannot import name RPATH2

Once I've shut down the server and restarted, everything's
fine and RPATH2 can be readily imported into the default.py
controller.

Interesting.

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




Re: [web2py] Re: dynamic importing from an external module

2010-01-18 Thread Jeff Bauer

On 01/18/2010 09:26 AM, mdipierro wrote:

do you have an empty __init__.py file in odt/ ? If not that is
necessary.


Yes, otherwise I would not be able to import dispatcher at all.


Is there a variable called __all__ in dispatcher.py? It should be a
list of variable that can be exported and should include RPATH2


No, it should not be necessary for me to use __all__ because:

  - RPATH2 is not an underscored variable (not __RPATH2__)
  - I'm importing RPATH2 explicitly, with no wildcard:
   from odt.dispatcher import RPATH2
not:
   from odt.dispatcher import *

Incidentally dispatcher is my own code.  I'm just using it
as an example that I can modify the module, but importing
a newly defined item will fail until I restart the server.

  1. odt.dispatcher.py:  RPATH1 = 'test one'
  2. controller.py:  from odt.dispatcher import RPATH1
  3. start web2py
  4. works
  5. add to odt.dispatcher.py:  RPATH2 = 'test two'
  6. controller.py:  from odt.dispatcher import RPATH2
  6. next request generates import exception
  7. restart web2py
  8. works, RPATH2 successfully imported

Exposing external imports using __all__ would be more
tedious than simply restarting the server.

-Jeff




On Jan 17, 11:32 pm, Jeff Bauer  wrote:

I've got an external module /odt/dispatcher.py, with
a class defined:

class Dispatcher:
  pass

I can import Dispatcher into controllers/default.py.
However, if I edit dispatcher.py to add a new element
while the web2py server is running and attempt to
import it ...

RPATH2 = "411"

... web2py throws an exception:

Traceback (most recent call last):
File "web2py/gluon/restricted.py", line 173, in restricted
  exec ccode in environment
File "web2py/applications/oprep/controllers/default.py", line 3, in

  from odt.dispatcher import RPATH2
ImportError: cannot import name RPATH2

Once I've shut down the server and restarted, everything's
fine and RPATH2 can be readily imported into the default.py
controller.

Interesting.

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




[web2py] UnboundLocalError in gluon/cache.py

2010-01-21 Thread Jeff Bauer

I copied my application to another directory and cleared
out the cache variables (because web2py was complaining
about them):

web2py Enterprise Web Framework
Created by Massimo Di Pierro, Copyright 2007-2010
Version 1.74.6 (2010-01-17 12:41:15)
Database drivers available: SQLite3
Starting cron...
please visit:
http://192.168.2.56:8002
use "kill -SIGTERM 21863" to shutdown the web2py server
ERROR:root:corrupted file: 
/home/oprep/web2py/applications/oprep/cache/cache.shelve

ERROR:root:Traceback (most recent call last):
  File "/home/oprep/web2py/gluon/main.py", line 478, in wsgibase
serve_controller(request, response, session)
  File "/home/oprep/web2py/gluon/main.py", line 178, in serve_controller
environment = build_environment(request, response, session)
  File "/home/oprep/web2py/gluon/compileapp.py", line 248, in 
build_environment

environment['cache'] = Cache(request)
  File "/home/oprep/web2py/gluon/cache.py", line 360, in __init__
self.disk = CacheOnDisk(request)
  File "/home/oprep/web2py/gluon/cache.py", line 250, in __init__
portalocker.unlock(locker)
UnboundLocalError: local variable 'locker' referenced before assignment

Filed here:  http://code.google.com/p/web2py/issues/detail?id=68

On a related issue:  I see a lot of development activity on this
list, questions asked, problems reported, etc., but not much is
being put into an issue tracker.  I've posted the last 5 tickets,
and there weren't all that many to begin with.  Is this activity
taking place elsewhere?  One suggestion -- since the project is
using mercurial would be to consider bitbucket.org, which we're
using for our company.  Like google, it would be free for this
open source project.

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




[web2py] suggestion: decouple tickets from admin interface

2010-01-21 Thread Jeff Bauer

I'm using web2app for a small one-off application in a
corporate setting, quickly making changes to code to
get a project done.  Two users behind a corporate
firewall.  It's become a real hassle when application
errors occur because the tickets aren't visible.

I can understand not making the admin interface
accessible over an insecure connection, but because
the ticket notification is tied to the admin system,
here's what I have to do:

- user reports an error, sends me the ticket
- I fire up another copy of web2py on a different port
- run a proxy: ssh -L 8001:127.0.0.1:8001 m...@192.168.2.56
- get the ticket info
- shut everything down

That's a lot of work just to get a traceback when attempting
rapid development. There are settings where read-only access
to the ticket info is justified, even if you don't want to
grant users full admin access.

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




Re: [web2py] Re: suggestion: decouple tickets from admin interface

2010-01-21 Thread Jeff Bauer

That shouldn't be too hard to do.  In the meantime, I
realized that I could just grab the tickets from:

  web2py/applications/myapp/errors

Jeff Bauer
Rubicon, Inc.


On 01/21/2010 08:12 AM, mdipierro wrote:

It should be trivial to make a view_tickets app by taking the
appropriate action from admin and add auth.

I encourage people to build one and I will be happy to post it.

Massimo



On Jan 21, 7:51 am, Jeff Bauer  wrote:

I'm using web2app for a small one-off application in a
corporate setting, quickly making changes to code to
get a project done.  Two users behind a corporate
firewall.  It's become a real hassle when application
errors occur because the tickets aren't visible.

I can understand not making the admin interface
accessible over an insecure connection, but because
the ticket notification is tied to the admin system,
here's what I have to do:

- user reports an error, sends me the ticket
- I fire up another copy of web2py on a different port
- run a proxy: ssh -L 8001:127.0.0.1:8001 m...@192.168.2.56
- get the ticket info
- shut everything down

That's a lot of work just to get a traceback when attempting
rapid development. There are settings where read-only access
to the ticket info is justified, even if you don't want to
grant users full admin access.

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




Re: [web2py] Re: suggestion: decouple tickets from admin interface

2010-01-21 Thread Jeff Bauer

Thanks, howesc.  I think having a mechanism similar to this
and supported by Massimo would not be too much of a security
risk, assuming it's not turned on by default.  There's a
big difference between allowing a user to view your source
code and granting full admin access.

I've added a new issue to google code and linked it
to this thread.

http://code.google.com/p/web2py/issues/detail?id=69

Jeff Bauer
Rubicon, Inc.


On 01/21/2010 04:07 PM, howesc wrote:

I'm using web2py on GAE, and wanted to be able to click on a link and
view tickets in that world, so i basically did a copy of the code from
the admin interface into my default.py so that my app can display the
tickets.  I'll paste it in here, hope it copies fine in email (i don't
think i can add an attachment to the group)

note that because this is a copy of code from the admin interface it's
not best practice, but i was in a hurry.  Also keep in mind that this
breaks the security of the ticket system, which is why it is set up
the way it is in the first place, so use with care.

in default.py in my application i added:

from applications.rockriver.modules.parse_xml import *
from gluon.restricted import RestrictedError
import os


# ticket stuff

def make_link(path):
 """ Create a link from a path """
 tryFile = path.replace('\\', '/')

 if os.path.isabs(tryFile) and os.path.isfile(tryFile):
 (folder, filename) = os.path.split(tryFile)
 (base, ext) = os.path.splitext(filename)
 app = request.args[0]

 editable = {'controllers': '.py', 'models': '.py', 'views':
'.html'}
 for key in editable.keys():
 check_extension = folder.endswith("%s/%s" % (app,key))
 if ext.lower() == editable[key] and check_extension:
 return A('"' + tryFile + '"',
  _href=URL(r=request,
  f='edit/%s/%s/%s' % (app, key, filename))).xml
()
 return ''

def make_links(traceback):
 """ Make links using the given traceback """

 lwords = traceback.split('"')

 # Making the short circuit compatible with<= python2.4
 result = (len(lwords) != 0) and lwords[0] or ''

 i = 1

 while i<  len(lwords):
 link = make_link(lwords[i])

 if link == '':
 result += '"' + lwords[i]
 else:
 result += link

 if i + 1<  len(lwords):
 result += lwords[i + 1]
 i = i + 1

 i = i + 1

 return result



class TRACEBACK(object):
 """ Generate the traceback """

 def __init__(self, text):
 """ TRACEBACK constructor """

 self.s = make_links(CODE(text).xml())

 def xml(self):
 """ Returns the xml """

 return self.s

@auth.requires_login()
def ticket():
 """ Ticket handler """

 if len(request.args) != 2:
 session.flash = T('invalid ticket')
 redirect(URL(r=request, f='site'))

 app = request.args[0]
 ticket = request.args[1]
 e = RestrictedError()
 e.load(request, app, ticket)

 return dict(app=app,
 ticket=ticket,
 traceback=TRACEBACK(e.traceback),
 code=e.code,
 layer=e.layer)

#
in routes.py i added an error message to make the link point back to
my app (note that i already have a route that removes the app name
from the URL):

error_message = 'Invalid request'
error_message_ticket = 'Internal errorTicket
issued:%(ticket)
s'



On Jan 21, 9:41 am, mdipierro  wrote:

also look into scripts/tickets2db.py

On Jan 21, 10:34 am, Jeff Bauer  wrote:


That shouldn't be too hard to do.  In the meantime, I
realized that I could just grab the tickets from:



web2py/applications/myapp/errors



Jeff Bauer
Rubicon, Inc.



On 01/21/2010 08:12 AM, mdipierro wrote:



It should be trivial to make a view_tickets app by taking the
appropriate action from admin and add auth.



I encourage people to build one and I will be happy to post it.



Massimo



On Jan 21, 7:51 am, Jeff Bauerwrote:

I'm using web2app for a small one-off application in a
corporate setting, quickly making changes to code to
get a project done.  Two users behind a corporate
firewall.  It's become a real hassle when application
errors occur because the tickets aren't visible.



I can understand not making the admin interface
accessible over an insecure connection, but because
the ticket notification is

Re: [web2py] downloading to IE& over https

2010-01-23 Thread Jeff Bauer

Anton,

In my recollection of past IE issues with downloading
dynamic pdfs, I finally gave up and wrote the pdf out to a
file, then redirected.  This was with very old IE 5.0
browsers, though, and I'd have thought this issue was behind
us.  Anyway, it may be a short-term fix for your situation,
and easier to implement than getting your clients to
switch/upgrade browsers.

You'd only need to do this on a case-by-case basis by
checking the browser type/version.  With most browsers you
could continue to serve your pdfs dynamically.

Jeff Bauer
Rubicon, Inc.

On 01/23/2010 04:22 AM, Anthon wrote:

I have some problems downloadin a PDF file over https.
The setup is mod_wsgi + apache (python 2.6).
Downloading via https to Firefox works without a problem as does
downloading over HTTP (both IE7 and Firefox).
I tried to  download a .csv file from the appadmin database
administration pages and that doesn't work either so it doesn't seem
to involve my particular use of response.headers and response.stream.
(FWIW I tried both direct streaming as well as first writing a file).

I could not manage to setup running web2py from the commandline using
SSL to check if this is a mod_wsgi problem: on my local machine I get
a connection but have no valid certificates and on my server I have
valid certificates but cannot get ssl to run yet
( "WARNING:root:OpenSSL libraries unavailable. SSL is OFF" )

I tried to see if the web2py demo pages have the .csv downloading
enabled since those work over https as well (https://web2py.com/
demo_app/appadmin/select/db/event) but downloading has been disabled
there (because it is demo I can understand that uploading is
disabled...).

I am next going to try and see if this is a IE7 issue (by installing
IE8) but I am not sure if I can convince my clients to switch if that
solves the issue (as I might as well ask them to use Firefox in that
case).

Any help or insights would be appreciated.

Anthon



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



[web2py:14593] Re: Postgres error

2009-01-05 Thread Jeff Koftinoff

Well, this is interesting. With the proper quoting of the SQL command
you can create a table named "user" with no problems on postgresql:

if2k9=# create table user ( did integer, name varchar(40) );
ERROR:  syntax error at or near "user"
LINE 1: create table user ( did integer, name varchar(40) );

mydb=# create table "user" ( did integer, name varchar(40) );
CREATE TABLE
mydb=# insert into "user" VALUES (1,'Jeff Koftinoff');
INSERT 0 1
mydb=# select * from "user";
 did |  name
-+
   1 | Jeff Koftinoff
(1 row)

So the appropriate fix is to fix the way web2py quotes the sql
queries.

Regards,
Jeff Koftinoff
www.jdkoftinoff.com

On Dec 29 2008, 1:37 pm, "Yarko Tymciurak"  wrote:
> A couple of things:
>
> "name" is not a "reserved keyword"  (see URL Fran referenced) - which means
> "name" is OK as a table or column name.  And since "name" doesn't appear
> reserved in any of the SQL standards listed, I think this should be ok in
> other backends also...
>
> 'user' however _IS_ a reserved keyword in all the SQL standards listed in
> that link.   You can modify it to be
> 'user_'   which will always be safe, or some other thing - 'my_user', etc.
>
> As Fran pointed out, anything in that list which is reserved in any version
> of SQL is just not a fair table or column name for any database (not just
> Postgres)
>
> Regards,
> Yarko
>
> On Mon, Dec 29, 2008 at 3:10 PM, Fran  wrote:
>
> > On Dec 29, 9:03 pm, Alex  wrote:
> > > So only solution to rename tables and fields everywhere ?
>
> > AFAIK, yes...sorry...
>
> > F

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



[web2py] Re: janrain logs in but stuck on login screen

2012-12-07 Thread Jeff Kusi
Could somebody address this issue please?  Mine is also doing the same 
thing.
here's how my config looks:
---
from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
auth = Auth(db)
from gluon.contrib.login_methods.rpx_account import RPXAccount
auth.settings.actions_disabled=['register','change_password','request_reset_password']
auth.settings.login_form = RPXAccount(request,
  api_key='...',
  domain='...',
  url = 
"http://localhost:8080/%s/default/user/login"; % request.application)

crud, service, plugins = Crud(db), Service(), PluginManager()
auth.define_tables(username=False, signature=False)

from gluon.contrib.login_methods.rpx_account import use_janrain
use_janrain(auth, filename='private/janrain.key')
---

The janrain private file :
---
helloworldApp:alsdkjfasldkjfa;sldkfjasdfads
--

On Tuesday, April 17, 2012 10:20:04 AM UTC-4, simon wrote:
>
> Is the janrain interface not currently working or have I missed 
> something? I can login using janrain but I cannot navigate to any other 
> pages. It is just stuck on a screen that says "welcome back".
>
>
>
>

-- 





[web2py] AttributeError: type object 'Field' has no attribute 'Method'

2012-12-24 Thread Jeff Kusi
I am attempting to use the virtual Methods of the dal but I am running into 
this issue. Here's my code
db.define_table('Posts',
db.Field('zipcode'),
db.Field.Method('distance',lambda row, loc_zip=3:abs(row
.zipcode-loc_zip))
)


But I am running into the following error:
"AttributeError: type object 'Field' has no attribute 'Method'"
I am running  
web2py™(2, 2, 1, datetime.datetime(2012, 10, 21, 16, 57, 4), 
'stable')PythonPython 
2.7.3: /home/yolo/python
Am I doing something wrong?  I looked into the web2py code and all I saw 
the FieldVirtual method definitions( not Field.Virtual as described in the 
book). 
Am I using the wrong version?  Any help would be appreciated.

thanks.

-- 





[web2py] Re: AttributeError: type object 'Field' has no attribute 'Method'

2012-12-24 Thread Jeff Kusi
Thank Denes you that fixed the attribute error issue.
So in my controller I'm trying to use the fieldMethod to calcluate a sortby 
parameter on the fly (not sure if proper approach).
My table is defined as:
db.define_table('Posts',

db.Field('date','datetime',default=request.now,writable=False),
Field.Method('distance',lambda row, 
loc_zip=3:abs(row.zipcode-loc_zip))
)

 my controller is:

def func():
...
order=db.Posts.distance(session.zipcode)|db.Posts.date
posts=db().select(db.Posts.ALL,limitby=limitby,orderby=order)


I am getting a "TypeError: 'FieldMethod' object is not callable" error
Also I looked inside web2py code and don't see the or operator defined for 
the FielMethod/FieldVirtuals.
If they aren't in the code yet, I wouldn't mind helping with the coding.  
I need the functionality for my project anyways.

thanks.




On Monday, December 24, 2012 8:24:02 AM UTC-5, DenesL wrote:
>
> Hi Jeff,
>
> I believe you need web2py 2.3.1 or higher for that.
>
>
>
> On Monday, December 24, 2012 1:36:25 AM UTC-5, Jeff Kusi wrote:
>>
>> I am attempting to use the virtual Methods of the dal but I am running 
>> into this issue. Here's my code
>> db.define_table('Posts',
>> db.Field('zipcode'),
>> db.Field.Method('distance',lambda row, loc_zip=3:abs(
>> row.zipcode-loc_zip))
>> )
>>
>>
>> But I am running into the following error:
>> "AttributeError: type object 'Field' has no attribute 'Method'"
>> I am running  
>> web2py™(2, 2, 1, datetime.datetime(2012, 10, 21, 16, 57, 4), 'stable')
>> PythonPython 2.7.3: /home/yolo/python
>> Am I doing something wrong?  I looked into the web2py code and all I saw 
>> the FieldVirtual method definitions( not Field.Virtual as described in the 
>> book). 
>> Am I using the wrong version?  Any help would be appreciated.
>>
>> thanks.
>>
>

-- 





Re: [web2py] Interesting - Brython (python to javascript)

2012-12-26 Thread Jeff Kusi
I have a question about security (it may be unfounded),

Isn't server-side interpretation more secure?  Especially when business 
logic that doesn't pass as "controller" code is embedded into the view code.
Brython would exposed such code to a front-end user.   What are your 
thoughts?

On Saturday, December 15, 2012 2:01:16 PM UTC-5, Mariano Reingart wrote:
>
> Brython seems great, it even uses a html helper syntax like web2py! 
>
>  
> t = TABLE() 
> for i in range(10): 
> t <= TR(TD(i)+TD(i*i)) 
> doc <= t 
>  
>
> I think this should be integrated and included with web2py, teaching 
> basic web development would be even easier, without the javascript 
> complexities. 
>
> Best regards, 
>
> Mariano Reingart 
> http://www.sistemasagiles.com.ar 
> http://reingart.blogspot.com 
>
>
> On Sat, Dec 15, 2012 at 3:29 AM, ionel > 
> wrote: 
> > http://www.brython.info/index_en.html 
> > 
> > -- 
> > 
> > 
> > 
>

-- 





[web2py] REST API no matching pattern

2012-12-30 Thread Jeff Kusi
I followed the example for the  REST API (multiple times actually). However 
I keep getting *"**no matching pattern"* every time.
In fact it looks like the auto pattern is not generating because when I 
navigate to 
api/patterns.json, I see 

{"content": "auto"}

instead of the beautiful rendering of all my table patterns.

Here are the sample tables I tested with
db.define_table('person',Field('name'),Field('info'))
db.define_table('pet',Field('owner',db.person),Field('name'),Field('info'))

Here's my api code

@request.restful()
def api():
response.view = 'generic.'+request.extension
def GET(*args,**vars):
patterns = 'auto'
parser = db.parse_as_rest(patterns,args,vars)
if parser.status == 200:
return dict(content=parser.response)
else:
raise HTTP(parser.status,parser.error)
def POST(table_name,**vars):
return db[table_name].validate_and_insert(**vars)
def PUT(table_name,record_id,**vars):
return db(db[table_name]._id==record_id).update(**vars)
def DELETE(table_name,record_id):
return db(db[table_name]._id==record_id).delete()
return locals()


web2py version 2.3.2 (2012-12-17 15:03:30) stable
python version 2.7

Any help please?

-- 





[web2py] Re: SQLFORM.factory + Multiple Tables + Upload Field + GAE Blob Problem

2013-01-01 Thread Jeff Kusi
Is there any update on this bug?
I am also experiencing it.  I am using the workaround suggested by JungHyun 
Kim
I am using 2.3.2.


On Monday, August 20, 2012 12:49:14 PM UTC-4, JungHyun Kim wrote:
>
> Hello!
>
> I have a problem with upload field.
>
> I tried to upload a file through one form with two tables using 
> SQLFORM.factory.
> It worked OK on web2py rocket server. But with GAE server (both local test 
> server and real GAE server), I can't upload files.
> The problem is blob is None after uploaded.
>
> I defined two tables.
>
>
>
> db.define_table('mibmessage',
> Field('user',db.auth_user,writable=False,readable=
> False,default=auth.user_id,),
> Field('message','text',notnull=True,
> widget = lambda field, value: SQLFORM.widgets.
> text.widget(field, value, _class='my-string')),
> Field('attached_files','list:reference 
> attached_file',writable
> =False, default=[], readable=False),
> )
>
> db.define_table('attached_file',
> Field('file','upload'),
> Field('original_filename', writable=False, notnull=
> False),
> Field('mibmessage',db.mibmessage),
> )
>
>
>
> And in controller, I saved them.
>
># Make a form
> form =  SQLFORM.factory(db.mibmessage, db.attached_file, table_name=
> 'attached_file')
> 
> # Save New Message
> if form.process().accepted:
> try:
> # Insert a message
> message_id = db.mibmessage.insert(**db.mibmessage.
> _filter_fields(form.vars))
> form.vars.mibmessage=message_id
> 
> if form.vars.file != '':
> form.vars.original_filename = request.vars.file.filename
> # Insert an attached file
> image_file_id = db.attached_file.insert(**db.attached_file
> ._filter_fields(form.vars))
>
> # The message has a list of attached files
> db.mibmessage[message_id].update_record(attached_files=[
> image_file_id])
> db.commit()
>
> except Exception:
> db.rollback()
>
>
> After uploaded, both rows are created. But  'file_blob' field of the 
> 'attached_file' is None.
>
> If I upload an file using SQLFORM with single table (attached_file), it is 
> OK.
>
> Did I use SQLFORM.factory wrong?
>
> I read this thread ( 
> https://groups.google.com/forum/?fromgroups#!searchin/web2py/SQLFORM.factory$20one$20form$20multiple$20tables$20blob/web2py/O6D1J8h_MNA/lmFbEF1XzWcJ%5B1-25%5D),
>  
> but I couldn't understand it. 
>
>
>
>
>
>

-- 





[web2py] Re: import error debian package

2011-06-09 Thread Jeff Elkner
We copy the math_quiz directory and all its contents from a source install 
of web2py, where it works, to the application directory of a user created by 
the debian package, where it gives the error above.

Three of us have confirmed this on three separate installations.  We are 
pretty confident it is an error with the way the package works.



[web2py] Re: Localize JavaScript

2016-05-28 Thread Jeff Riley
All,  Ok I think this would help my situation, but I am missing how to 
execute the Ajax.  I have four views that contain the same javascript and 
would really like to move to the static js folder, but the javascript 
requires elements passed to the views from the controllers.  The "Drawtext" 
items surrounded by {{ }} are causing my issue.  I have attached one of the 
current views showing what I am dealing with.

Sorry for being so daft.

On Wednesday, March 16, 2016 at 4:12:31 AM UTC-5, Mirek Zvolský wrote:

> Any idea how to localize JavaScript texts?
>
> I think I need
> generate some js code with objects/dictionaries (similar to web2py 
> language files)
> and make a function which will seek in this dictionaries.
>
> Maybe gettext already has some support for this.
> That leads me to the question if I should prefer web2py translation system 
> or gettext at all?
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
{{extend 'layout.html'}}


  
  
  
  
  
  
  
  Customer Information
  
  
  
  
  Sheet Information
  
  
  
  
  
  
  Name:   {{=customer.first_name}} {{=customer.last_name}}
  Address:   {{=customer.address1}}
  Apt/Suite: {{=B(customer.address2) if customer.address2 else ''}}
  City:   {{=customer.city}}
  State: {{=customer.state_province}}
  Code: {{=customer.postal_code}}
  Phone: {{=customer.phone}}
  
  
  
  
  Title:   {{=sheet.title}}
  Version: {{=sheet.sheet_version}}
  Grip Type: {{=sheet.grip_type}}
  Handed: {{=sheet.handed}}
  Throw Type: {{=B(sheet.throw_type) if sheet.throw_type else ''}}
  Normal Ball Weight: {{=B(sheet.normal_ball_weight) if sheet.normal_ball_weight else ''}}
  
  
  
  
  Back  
  Sheets
  
  
  
  
  
  




[web2py] Weird form issue

2016-06-05 Thread Jeff Riley
Hello all.  I have built many forms in Web2py, but I clearly need another 
set of eyes.  This form only works if I display every signal field for some 
reason.  I am at a loss as to what I have set wrong.  I will add a file 
with all the relevant code.  Thank you all very much for you help with this.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Document.docx
Description: MS-Word 2007 document


[web2py] Re: Weird form issue

2016-06-05 Thread Jeff Riley
Seriously.  Well that is just embarrassing.  Thank you so much Mark for 
your help with this.  In looking back at the other 22 forms I have created, 
this is the first one where I was pre-populating any of the fields and not 
showing them.  Thank you for this valuable insight.

All my best.

On Sunday, June 5, 2016 at 6:14:35 PM UTC-5, Mark Graves wrote:

> Hey Jeff,
>
> It looks like you created a sqlform expecting all fields, then the form 
> was expecting all fields back, but you only used some of them in the view, 
> so they were not processed.
>
> Specifically, the status field.
>
> You could either set the type of the field to hidden and include it or 
> only include some of the fields.
>
> see this repo:
>
> https://bitbucket.org/MarkGraves/service_scheduler
>
> Check out default/new_training
>
> It bugged me because the error seemed simple and I couldnt figure it out =)
>
> -Mark
>
>
> On Sunday, June 5, 2016 at 12:34:16 PM UTC-7, Jeff Riley wrote:
>>
>> Hello all.  I have built many forms in Web2py, but I clearly need another 
>> set of eyes.  This form only works if I display every signal field for some 
>> reason.  I am at a loss as to what I have set wrong.  I will add a file 
>> with all the relevant code.  Thank you all very much for you help with this.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Weird form issue

2016-06-06 Thread Jeff Riley
Now I am truly confused.  I am able to submit the form and create the 
record in the database, but now 

rows = db(db.training).select()  is not returning anything and I cannot delete 
the record from the SQLGrid view.  I have really wacked something up.


On Sunday, June 5, 2016 at 2:34:16 PM UTC-5, Jeff Riley wrote:
>
> Hello all.  I have built many forms in Web2py, but I clearly need another 
> set of eyes.  This form only works if I display every signal field for some 
> reason.  I am at a loss as to what I have set wrong.  I will add a file 
> with all the relevant code.  Thank you all very much for you help with this.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Weird form issue

2016-06-06 Thread Jeff Riley
Sorry quick update.  Rows is returning information, so I must have a 
problem with my javascript.  I still however cannot delete the record from 
the SQLgrid view.

On Monday, June 6, 2016 at 2:38:03 PM UTC-5, Jeff Riley wrote:
>
> Now I am truly confused.  I am able to submit the form and create the 
> record in the database, but now 
>
> rows = db(db.training).select()  is not returning anything and I cannot 
> delete the record from the SQLGrid view.  I have really wacked something up.
>
>
> On Sunday, June 5, 2016 at 2:34:16 PM UTC-5, Jeff Riley wrote:
>>
>> Hello all.  I have built many forms in Web2py, but I clearly need another 
>> set of eyes.  This form only works if I display every signal field for some 
>> reason.  I am at a loss as to what I have set wrong.  I will add a file 
>> with all the relevant code.  Thank you all very much for you help with this.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Weird form issue

2016-06-07 Thread Jeff Riley
Mark.  Could you contact me at javajeff...@gmail.com.  I would like to see 
if you could help me finish this out and what that might cost.

On Monday, June 6, 2016 at 5:10:37 PM UTC-5, Mark Graves wrote:
>
> Hey Jeff,
>
> Most likely the date/time format.
>
> If you can post a sample sqlite file and  SQLGRID code, happy to help.
>
> -Mark
>
>
> On Monday, June 6, 2016 at 12:42:16 PM UTC-7, Jeff Riley wrote:
>>
>> Sorry quick update.  Rows is returning information, so I must have a 
>> problem with my javascript.  I still however cannot delete the record from 
>> the SQLgrid view.
>>
>> On Monday, June 6, 2016 at 2:38:03 PM UTC-5, Jeff Riley wrote:
>>>
>>> Now I am truly confused.  I am able to submit the form and create the 
>>> record in the database, but now 
>>>
>>> rows = db(db.training).select()  is not returning anything and I cannot 
>>> delete the record from the SQLGrid view.  I have really wacked something up.
>>>
>>>
>>> On Sunday, June 5, 2016 at 2:34:16 PM UTC-5, Jeff Riley wrote:
>>>>
>>>> Hello all.  I have built many forms in Web2py, but I clearly need 
>>>> another set of eyes.  This form only works if I display every signal field 
>>>> for some reason.  I am at a loss as to what I have set wrong.  I will add 
>>>> a 
>>>> file with all the relevant code.  Thank you all very much for you help 
>>>> with 
>>>> this.
>>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Save Full Calendar event to Mysql

2016-06-08 Thread Jeff Riley
Hello all.  Has anyone figured out how to save a Jquery Full Calendar event 
to their Mysql database?  I know I should use the Ajax function, but I am 
not seeing how to get the information from the Full Calendar jquery event 
dialog.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Jquery dropdown

2016-06-10 Thread Jeff Riley
Hello all.  I am trying to get Jquery to work on a dropdown.  I have the 
tax payer example from the book working just fine.

if(jQuery('#taxpayer_married').prop('checked'))

But when I try to get the text of my dropdown it is not seeing it.  Do I 
have something wrong in my syntax?  

if(jQuery('#orders_item_type option:selected').text('Ball'))

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Pure HTML form

2016-06-13 Thread Jeff Riley
Hello all.  So sorry to bother you again.  Since I have to overlay form 
fields on top of a canvas, I have to build pure HTML form elements (at 
least that is all I can think to do).  My problem is when I submit the form 
I am getting errors in form even though I am filling out every field.  I am 
attaching all the relevant code if someone would not mind having a look.  I 
do really appreciate the help.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


PureHTMLForm.docx
Description: MS-Word 2007 document


Re: [web2py] Re: Pure HTML form

2016-06-13 Thread Jeff Riley
Dave thank you. I will check this out and see.  As far as errors I am just 
getting the pop-up with no field showing issues. Which I am assuming is because 
the Web2py Ajax does not handle html form elements.

Thank you,
Jeff Riley

> On Jun 13, 2016, at 6:47 PM, Dave S  wrote:
> 
> 
> 
>> On Monday, June 13, 2016 at 4:27:20 PM UTC-7, Jeff Riley wrote:
>> Hello all.  So sorry to bother you again.  Since I have to overlay form 
>> fields on top of a canvas, I have to build pure HTML form elements (at least 
>> that is all I can think to do).  My problem is when I submit the form I am 
>> getting errors in form even though I am filling out every field.  I am 
>> attaching all the relevant code if someone would not mind having a look.  I 
>> do really appreciate the help.
> 
> What errors are you getting?
> 
> From a quick look at your code (that's a big form!), I don't think you are 
> setting the formkey, which is involved in validation (the book refers to 
> stopping double submissions here.
> http://web2py.com/books/default/chapter/29/07/forms-and-validators#Hidden-fields>
> but it also aids CRSF protection, as mention in the Introduction and Other 
> Recipes).
> 
> If this isn't the issue, please post the error information details.
> 
> /dps
> 
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "web2py-users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/web2py/25A0IwF8q4Q/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Pure HTML form

2016-06-14 Thread Jeff Riley
Oh lord folks.  I had the same name for two fields.  That was my only 
problem.  Thank you all very much.


On Monday, June 13, 2016 at 6:27:20 PM UTC-5, Jeff Riley wrote:

> Hello all.  So sorry to bother you again.  Since I have to overlay form 
> fields on top of a canvas, I have to build pure HTML form elements (at 
> least that is all I can think to do).  My problem is when I submit the form 
> I am getting errors in form even though I am filling out every field.  I am 
> attaching all the relevant code if someone would not mind having a look.  I 
> do really appreciate the help.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Update Pure HTML form

2016-06-15 Thread Jeff Riley
All.  I was going to link this to my "Pure HTML Form" question just not 
sure how to do that.  As you see in that question I was able to get past my 
copy paste issue and get the create form to work perfectly.  Thank you all 
for the extra eyes.

Now I am building the update form and I am getting "user is tampering with 
form's record_id: None != 1".  I have tried removing the _formkey and 
setting session=None, but that does not seem to work either.  Have been 
searching the docs but nothing is slapping me upside the head.

Any ideas?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Update Pure HTML form

2016-06-15 Thread Jeff Riley
Sorry to be a pest but I really do need an answer for this one so I can finish 
this update form page please.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Update Pure HTML form

2016-06-16 Thread Jeff Riley
Hey Anthony thank you very much for responding.  I am attaching the code I 
use for the create form which is working great and the code for the update 
form which is giving me the grief.  Please let me know if there is more 
information you might need and I so appreciate all your hep.

On Wednesday, June 15, 2016 at 8:52:22 AM UTC-5, Jeff Riley wrote:
>
> All.  I was going to link this to my "Pure HTML Form" question just not 
> sure how to do that.  As you see in that question I was able to get past my 
> copy paste issue and get the create form to work perfectly.  Thank you all 
> for the extra eyes.
>
> Now I am building the update form and I am getting "user is tampering with 
> form's record_id: None != 1".  I have tried removing the _formkey and 
> setting session=None, but that does not seem to work either.  Have been 
> searching the docs but nothing is slapping me upside the head.
>
> Any ideas?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


CreatePureHTMLForm.docx
Description: MS-Word 2007 document


UpdateureHTMLForm.docx
Description: MS-Word 2007 document


Re: [web2py] Re: Update Pure HTML form

2016-06-16 Thread Jeff Riley
Anthony thank you so very much. I will make these changes.

Thank you,
Jeff Riley

> On Jun 16, 2016, at 11:17 AM, Anthony  wrote:
> 
> For update forms, web2py includes the record ID as a hidden field and 
> verifies that it matches the original record ID on the server to ensure the 
> user doesn't try to update a different record. You have not included the 
> record ID in your form, so this verification fails.
> 
> As noted earlier, please at least use form.custom.end in your custom HTML 
> forms -- otherwise, you miss out on protection from CSRF and record ID 
> tampering. Also, do not set session=None, or you will be open to CSRF attacks.
> 
> Anthony
> 
>> On Thursday, June 16, 2016 at 5:57:26 AM UTC-4, Jeff Riley wrote:
>> Hey Anthony thank you very much for responding.  I am attaching the code I 
>> use for the create form which is working great and the code for the update 
>> form which is giving me the grief.  Please let me know if there is more 
>> information you might need and I so appreciate all your hep.
>> 
>>> On Wednesday, June 15, 2016 at 8:52:22 AM UTC-5, Jeff Riley wrote:
>>> All.  I was going to link this to my "Pure HTML Form" question just not 
>>> sure how to do that.  As you see in that question I was able to get past my 
>>> copy paste issue and get the create form to work perfectly.  Thank you all 
>>> for the extra eyes.
>>> 
>>> Now I am building the update form and I am getting "user is tampering with 
>>> form's record_id: None != 1".  I have tried removing the _formkey and 
>>> setting session=None, but that does not seem to work either.  Have been 
>>> searching the docs but nothing is slapping me upside the head.
>>> 
>>> Any ideas?
> 
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "web2py-users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/web2py/DoSgieWkuyk/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Update Pure HTML form

2016-06-16 Thread Jeff Riley
So I need to know who to get the record ID from the database to pass to the 
update view.  Using the form start and end calls is not working.

On Wednesday, June 15, 2016 at 8:52:22 AM UTC-5, Jeff Riley wrote:
>
> All.  I was going to link this to my "Pure HTML Form" question just not 
> sure how to do that.  As you see in that question I was able to get past my 
> copy paste issue and get the create form to work perfectly.  Thank you all 
> for the extra eyes.
>
> Now I am building the update form and I am getting "user is tampering with 
> form's record_id: None != 1".  I have tried removing the _formkey and 
> setting session=None, but that does not seem to work either.  Have been 
> searching the docs but nothing is slapping me upside the head.
>
> Any ideas?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Update Pure HTML form

2016-06-17 Thread Jeff Riley
Anthony.  It was me being a complete idiot.  I had not removed the HTML 
form tags.  I have attached the code that is working perfectly now.  Thank 
you so much for have the patience of a Saint.

On Wednesday, June 15, 2016 at 8:52:22 AM UTC-5, Jeff Riley wrote:
>
> All.  I was going to link this to my "Pure HTML Form" question just not 
> sure how to do that.  As you see in that question I was able to get past my 
> copy paste issue and get the create form to work perfectly.  Thank you all 
> for the extra eyes.
>
> Now I am building the update form and I am getting "user is tampering with 
> form's record_id: None != 1".  I have tried removing the _formkey and 
> setting session=None, but that does not seem to work either.  Have been 
> searching the docs but nothing is slapping me upside the head.
>
> Any ideas?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


WorkingCreateForm.docx
Description: MS-Word 2007 document


WorkingUpdateForm.docx
Description: MS-Word 2007 document


[web2py] Behave testing question

2016-06-23 Thread Jeff Riley
Good morning everyone.  This is not really a Web2py question, but this 
group has been so helpful during my little app development.  I am using 
Behave, Selenium and Splinter for my automated testing of my Web2py app.  I 
have run into a dropdown list situation where my db model (attached) is 
referencing another table for the list.  As a result the testing is not 
finding the value.  I was just wondering if anyone had run into this.  All 
my best.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Behave Issue.docx
Description: MS-Word 2007 document


[web2py] Re: Behave testing question

2016-06-23 Thread Jeff Riley
Pefect thank you so much Anthony.  That worked.

On Thursday, June 23, 2016 at 8:13:43 AM UTC-5, Anthony wrote:
>
> In your Behave specification, it looks like you have "Storm Products Inc." 
> as the manufacturer. However, the "manufacturer" field is a reference 
> field, which stores record IDs from the db.manufacturers table, not 
> manufacturer names. So, in the Behave specification, the value should be 
> the integer record ID associated with the "Storm Producs Inc." manufacturer.
>
> Anthony
>
> On Thursday, June 23, 2016 at 8:50:55 AM UTC-4, Jeff Riley wrote:
>>
>> Good morning everyone.  This is not really a Web2py question, but this 
>> group has been so helpful during my little app development.  I am using 
>> Behave, Selenium and Splinter for my automated testing of my Web2py app.  I 
>> have run into a dropdown list situation where my db model (attached) is 
>> referencing another table for the list.  As a result the testing is not 
>> finding the value.  I was just wondering if anyone had run into this.  All 
>> my best.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Behave testing question

2016-06-23 Thread Jeff Riley
I will look into that Silva.  All suggestions are welcome.

On Thursday, June 23, 2016 at 8:18:00 AM UTC-5, Marlysson Silva wrote:
>
> OFF-TOPIC
> I was seeing your models and I noted that you used attributes to control 
> hour and date of data change, don't would be better use the auth.signature ?
>
> Em quinta-feira, 23 de junho de 2016 09:50:55 UTC-3, Jeff Riley escreveu:
>>
>> Good morning everyone.  This is not really a Web2py question, but this 
>> group has been so helpful during my little app development.  I am using 
>> Behave, Selenium and Splinter for my automated testing of my Web2py app.  I 
>> have run into a dropdown list situation where my db model (attached) is 
>> referencing another table for the list.  As a result the testing is not 
>> finding the value.  I was just wondering if anyone had run into this.  All 
>> my best.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] show_if multiple selections

2016-07-07 Thread Jeff Riley
Hello all.  I am trying to get the line below from my db.py file to work.  
Currently it is only working for the first entry "Mood".  Any ideas?

db.events.event_level.show_if = ((db.events.event_type == "Mood") or 
(db.events.event_type == "Headache") or
 (db.events.event_type == "Nausea") or 
(db.events.event_type == "Pain"))


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: show_if multiple selections

2016-07-07 Thread Jeff Riley
Worked perfectly.  Thank you Marlysson.  

db.events.event_level.show_if = (db.events.event_type.belongs("Mood", 
"Headache", "Nausea", "Pain"))


On Thursday, July 7, 2016 at 5:54:31 AM UTC-5, Marlysson Silva wrote:
>
> Try use belongs, of DAL.
>
>
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#belongs
>
> Em quinta-feira, 7 de julho de 2016 06:24:08 UTC-3, Jeff Riley escreveu:
>>
>> Hello all.  I am trying to get the line below from my db.py file to 
>> work.  Currently it is only working for the first entry "Mood".  Any ideas?
>>
>> db.events.event_level.show_if = ((db.events.event_type == "Mood") or 
>> (db.events.event_type == "Headache") or
>>  (db.events.event_type == "Nausea") or 
>> (db.events.event_type == "Pain"))
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Pythonanywhere Timezone

2016-07-07 Thread Jeff Riley
Hello all.  Me again.  I have run into an interesting issue.  I have 
installed and followed niphlod's w2p_timezone_plugin.  In order to make it 
work on my local PC I need to setup my db.py as follows.

import pytz
user_timezone = session.plugin_timezone_tx or 'UTC'


db.define_table('events',
Field('event_time', 'datetime', default = request.now, update = 
request.now,
requires=IS_DATETIME(format=('%m-%d-%Y %H:%M'), 
timezone=pytz.timezone(user_timezone))),


But to get it to work on pythonanywhere.com I have to setup my db.py as 
follows.  Any ideas why?


import pytz

db.define_table('events',
Field('event_time', 'datetime', default = request.now, update = 
request.now,
requires=IS_DATETIME(format=('%m-%d-%Y %H:%M'), 
timezone=pytz.timezone("US/Central"))),



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Pythonanywhere Timezone

2016-07-07 Thread Jeff Riley
I have that in the default.py file. I will send the code when I get to my 
computer.

Thank you,
Jeff Riley

> On Jul 7, 2016, at 5:10 PM, Marlysson Silva  wrote:
> 
> Where you are inicialize session.plugin_timezone_tx ?
> 
> I too already had this issue, this happen because the script get timezone 
> based on the server localization.
> 
> I solved this using other way, converting user timezone to UTC and at showing 
> converted in user timezone.
> 
> They are some steps to do this.
> 
> Em quinta-feira, 7 de julho de 2016 16:19:10 UTC-3, Jeff Riley escreveu:
>> 
>> Hello all.  Me again.  I have run into an interesting issue.  I have 
>> installed and followed niphlod's w2p_timezone_plugin.  In order to make it 
>> work on my local PC I need to setup my db.py as follows.
>> 
>> import pytz
>> user_timezone = session.plugin_timezone_tx or 'UTC'
>> 
>> 
>> db.define_table('events',
>> Field('event_time', 'datetime', default = request.now, 
>> update = request.now,
>> requires=IS_DATETIME(format=('%m-%d-%Y %H:%M'), 
>> timezone=pytz.timezone(user_timezone))),
>> 
>> 
>> But to get it to work on pythonanywhere.com I have to setup my db.py as 
>> follows.  Any ideas why?
>> 
>> 
>> import pytz
>> 
>> db.define_table('events',
>> Field('event_time', 'datetime', default = request.now, 
>> update = request.now,
>> requires=IS_DATETIME(format=('%m-%d-%Y %H:%M'), 
>> timezone=pytz.timezone("US/Central"))),
> 
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "web2py-users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/web2py/wL2y7s-FJWU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Pythonanywhere Timezone

2016-07-07 Thread Jeff Riley
Here is the code as promised for the db.py and default.py.

On Thursday, July 7, 2016 at 2:19:10 PM UTC-5, Jeff Riley wrote:
>
> Hello all.  Me again.  I have run into an interesting issue.  I have 
> installed and followed niphlod's w2p_timezone_plugin.  In order to make it 
> work on my local PC I need to setup my db.py as follows.
>
> import pytz
> user_timezone = session.plugin_timezone_tx or 'UTC'
>
>
> db.define_table('events',
> Field('event_time', 'datetime', default = request.now, update 
> = request.now,
> requires=IS_DATETIME(format=('%m-%d-%Y %H:%M'), 
> timezone=pytz.timezone(user_timezone))),
>
>
> But to get it to work on pythonanywhere.com I have to setup my db.py as 
> follows.  Any ideas why?
>
>
> import pytz
>
> db.define_table('events',
> Field('event_time', 'datetime', default = request.now, update 
> = request.now,
> requires=IS_DATETIME(format=('%m-%d-%Y %H:%M'), 
> timezone=pytz.timezone("US/Central"))),
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


default.py.docx
Description: MS-Word 2007 document


db.py.docx
Description: MS-Word 2007 document


[web2py] Re: Pythonanywhere Timezone

2016-07-08 Thread Jeff Riley
Just in case anyone is wondering why I would build such a strange little 
web app, it is for my personal use.  I was dianosed with brain cancer 6 
weeks ago and these are the items my doctors want me to track everyday.  So 
I thought Web2py would be perfect.

On Thursday, July 7, 2016 at 2:19:10 PM UTC-5, Jeff Riley wrote:
>
> Hello all.  Me again.  I have run into an interesting issue.  I have 
> installed and followed niphlod's w2p_timezone_plugin.  In order to make it 
> work on my local PC I need to setup my db.py as follows.
>
> import pytz
> user_timezone = session.plugin_timezone_tx or 'UTC'
>
>
> db.define_table('events',
> Field('event_time', 'datetime', default = request.now, update 
> = request.now,
> requires=IS_DATETIME(format=('%m-%d-%Y %H:%M'), 
> timezone=pytz.timezone(user_timezone))),
>
>
> But to get it to work on pythonanywhere.com I have to setup my db.py as 
> follows.  Any ideas why?
>
>
> import pytz
>
> db.define_table('events',
> Field('event_time', 'datetime', default = request.now, update 
> = request.now,
> requires=IS_DATETIME(format=('%m-%d-%Y %H:%M'), 
> timezone=pytz.timezone("US/Central"))),
>
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Pythonanywhere Timezone

2016-07-08 Thread Jeff Riley
I would like to know how a timezone by any place would be done, so I look 
forward to your article.  For me I am just going to keep it set to 
US/Central.  Also if anyone wants to use the code I have provided to build 
this sort of web app for the general public, please feel free to use what I 
have provided.

On Friday, July 8, 2016 at 8:16:46 AM UTC-5, Marlysson Silva wrote:
>
>
> Are you trying to get the timezone just of the your location? 
> Case yes, you set your timezone at code, and deploy in pythonanywhere with 
> value personal of the timezone.
>
> But you want timezone by any place, then I go prepare a article showing 
> what I made to solved this. 
>
> Em sexta-feira, 8 de julho de 2016 09:56:48 UTC-3, Jeff Riley escreveu:
>>
>> Just in case anyone is wondering why I would build such a strange little 
>> web app, it is for my personal use.  I was dianosed with brain cancer 6 
>> weeks ago and these are the items my doctors want me to track everyday.  So 
>> I thought Web2py would be perfect.
>>
>> On Thursday, July 7, 2016 at 2:19:10 PM UTC-5, Jeff Riley wrote:
>>>
>>> Hello all.  Me again.  I have run into an interesting issue.  I have 
>>> installed and followed niphlod's w2p_timezone_plugin.  In order to make it 
>>> work on my local PC I need to setup my db.py as follows.
>>>
>>> import pytz
>>> user_timezone = session.plugin_timezone_tx or 'UTC'
>>>
>>>
>>> db.define_table('events',
>>> Field('event_time', 'datetime', default = request.now, 
>>> update = request.now,
>>> requires=IS_DATETIME(format=('%m-%d-%Y %H:%M'), 
>>> timezone=pytz.timezone(user_timezone))),
>>>
>>>
>>> But to get it to work on pythonanywhere.com I have to setup my db.py as 
>>> follows.  Any ideas why?
>>>
>>>
>>> import pytz
>>>
>>> db.define_table('events',
>>> Field('event_time', 'datetime', default = request.now, 
>>> update = request.now,
>>> requires=IS_DATETIME(format=('%m-%d-%Y %H:%M'), 
>>> timezone=pytz.timezone("US/Central"))),
>>>
>>>
>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: [web2py] Re: Pythonanywhere Timezone

2016-07-08 Thread Jeff Riley
https://github.com/Sailor972/medicaltracker.git

Sent from Mail for Windows 10

From: Marlysson Silva

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Pythonanywhere Timezone

2016-07-10 Thread Jeff Riley
Great thank you Marlysson.  I will try this as soon as I can.  Hopefully 
tomorrow.

Thank you,
Jeff Riley

> On Jul 10, 2016, at 4:39 PM, Marlysson Silva  wrote:
> 
> You try to make this:
> 
> 1. Add library in the front-end to get user timezone ( this code need to be 
> in the first page that user access ), to get timezone first.
> 
> - https://bitbucket.org/pellepim/jstimezonedetect/src
> {{if timezone_is_unknown: }}
> 
>   $(function() {
> var tz_name = jstz.determine();
> $.get("{{=URL('default', 'define_timezone')}}", tz_name);
>   });
> 
> 
> 
> 2. Add  the controller responsible by determine timezone:
> 
> def define_timezone():
> """Call ajax to determine user timezone"""
> 
> tz_name = request.vars.name
> 
> from pytz import all_timezones_set
> 
> if tz_name in all_timezones_set:
> session.user_timezone = tz_name
> 
> 
> 3. And in the your model you put:
> 
> from pytz import timezone
> 
> timezone_user = session.user_timezone or timezone('UTC')
> timezone_is_unknown = session.user_timezone is None
> 
> 
> 4. Use in the your model related with timezone:
> 
> IS_DATETIME(format=("%m-%d-%Y %H:%H), timezone = pytz.timezone(timezone_user) 
> )
> 
> There are other form, that is insert everything in UTC datetime and create a 
> function responsible to convert this timezone in UTC datetime inserted in 
> database. Just delayed a lot of , but yet I will create a 
> web2py_timezone_starter with app ready to receive apps that are handled by 
> timezones.
> 
> I'm creating this application to demonstrate this, if you want look..
> 
> http://marlysson.pythonanywhere.com/timezone
> 
> At app, the Hour "your PC" is datetime.now()  simulating datetime of user, 
> just that it's datetime of the pythonanywhere.
> 
> Em quinta-feira, 7 de julho de 2016 16:19:10 UTC-3, Jeff Riley escreveu:
>> 
>> Hello all.  Me again.  I have run into an interesting issue.  I have 
>> installed and followed niphlod's w2p_timezone_plugin.  In order to make it 
>> work on my local PC I need to setup my db.py as follows.
>> 
>> import pytz
>> user_timezone = session.plugin_timezone_tx or 'UTC'
>> 
>> 
>> db.define_table('events',
>> Field('event_time', 'datetime', default = request.now, 
>> update = request.now,
>> requires=IS_DATETIME(format=('%m-%d-%Y %H:%M'), 
>> timezone=pytz.timezone(user_timezone))),
>> 
>> 
>> But to get it to work on pythonanywhere.com I have to setup my db.py as 
>> follows.  Any ideas why?
>> 
>> 
>> import pytz
>> 
>> db.define_table('events',
>> Field('event_time', 'datetime', default = request.now, 
>> update = request.now,
>> requires=IS_DATETIME(format=('%m-%d-%Y %H:%M'), 
>> timezone=pytz.timezone("US/Central"))),
> 
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "web2py-users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/web2py/wL2y7s-FJWU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Anyone ever done a braintree integration with web2py?

2016-07-10 Thread Jeff Lipkowitz
No, but I wonder how you would do an integration for payment. 

On Friday, 30 May 2014 03:19:20 UTC-5, Mark Graves wrote:
>
> Hey everyone,
>
> Using braintree to process payments in an app I'm working on.  Anyone ever 
> done it and willing to answer a few questions?
>
> (I checked their documentation, I was more interested in a few web2py 
> specifics)
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Pythonanywhere Timezone

2016-07-11 Thread Jeff Riley
Hello Marlysson.  I am getting the following error.  I have removed the 
module pytx_timezone, and I have verified that I have pip installed pytz.  
Not sure what else to dheck.

 No module named pytz

On Sunday, July 10, 2016 at 4:39:30 PM UTC-5, Marlysson Silva wrote:
>
> You try to make this:
>
> 1. Add library in the front-end to get user timezone ( this code need to 
> be in the first page that user access ), to get timezone first.
>
> - https://bitbucket.org/pellepim/jstimezonedetect/src
> {{if timezone_is_unknown: }}
> 
>   $(function() {
> var tz_name = jstz.determine();
> $.get("{{=URL('default', 'define_timezone')}}", tz_name);
>   });
> 
>
>
> 2. Add  the controller responsible by determine timezone:
>
> def define_timezone():
> """Call ajax to determine user timezone"""
>
> tz_name = request.vars.name
>
> from pytz import all_timezones_set
>
> if tz_name in all_timezones_set:
> session.user_timezone = tz_name
>
>
> 3. And in the your model you put:
>
> from pytz import timezone
>
> timezone_user = session.user_timezone or timezone('UTC')
> timezone_is_unknown = session.user_timezone is None
>
>
> 4. Use in the your model related with timezone:
>
> IS_DATETIME(format=("%m-%d-%Y %H:%H), timezone = 
> pytz.timezone(timezone_user) )
>
> There are other form, that is insert everything in UTC datetime and create 
> a function responsible to convert this timezone in UTC datetime inserted in 
> database. Just delayed a lot of , but yet I will create a 
> web2py_timezone_starter with app ready to receive apps that are handled by 
> timezones.
>
> I'm creating this application to demonstrate this, if you want look..
>
> http://marlysson.pythonanywhere.com/timezone
>
> At app, the *Hour "your PC"* is datetime.now()  simulating datetime of user, 
> just that it's datetime of the pythonanywhere.
>
>
> Em quinta-feira, 7 de julho de 2016 16:19:10 UTC-3, Jeff Riley escreveu:
>>
>> Hello all.  Me again.  I have run into an interesting issue.  I have 
>> installed and followed niphlod's w2p_timezone_plugin.  In order to make it 
>> work on my local PC I need to setup my db.py as follows.
>>
>> import pytz
>> user_timezone = session.plugin_timezone_tx or 'UTC'
>>
>>
>> db.define_table('events',
>> Field('event_time', 'datetime', default = request.now, 
>> update = request.now,
>> requires=IS_DATETIME(format=('%m-%d-%Y %H:%M'), 
>> timezone=pytz.timezone(user_timezone))),
>>
>>
>> But to get it to work on pythonanywhere.com I have to setup my db.py as 
>> follows.  Any ideas why?
>>
>>
>> import pytz
>>
>> db.define_table('events',
>> Field('event_time', 'datetime', default = request.now, 
>> update = request.now,
>> requires=IS_DATETIME(format=('%m-%d-%Y %H:%M'), 
>> timezone=pytz.timezone("US/Central"))),
>>
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Pythonanywhere Timezone

2016-07-11 Thread Jeff Riley
The plugin

Thank you,
Jeff Riley

> On Jul 11, 2016, at 7:25 AM, Marlysson Silva  wrote:
> 
> Hm, in which file?
> 
> You removed the pytz library or a plugin that already was in your code 
> previously?
> 
> 
> 2016-07-11 9:19 GMT-03:00 Jeff Riley :
>> Hello Marlysson.  I am getting the following error.  I have removed the 
>> module pytx_timezone, and I have verified that I have pip installed pytz.  
>> Not sure what else to dheck.
>> 
>>  No module named pytz
>> 
>> 
>> 
>>> On Sunday, July 10, 2016 at 4:39:30 PM UTC-5, Marlysson Silva wrote:
>>> You try to make this:
>>> 
>>> 1. Add library in the front-end to get user timezone ( this code need to be 
>>> in the first page that user access ), to get timezone first.
>>> 
>>> - https://bitbucket.org/pellepim/jstimezonedetect/src
>>> {{if timezone_is_unknown: }}
>>> 
>>>   $(function() {
>>> var tz_name = jstz.determine();
>>> $.get("{{=URL('default', 'define_timezone')}}", tz_name);
>>>   });
>>> 
>>> 
>>> 
>>> 2. Add  the controller responsible by determine timezone:
>>> 
>>> def define_timezone():
>>> """Call ajax to determine user timezone"""
>>> 
>>> tz_name = request.vars.name
>>> 
>>> from pytz import all_timezones_set
>>> 
>>> if tz_name in all_timezones_set:
>>> session.user_timezone = tz_name
>>> 
>>> 
>>> 3. And in the your model you put:
>>> 
>>> from pytz import timezone
>>> 
>>> timezone_user = session.user_timezone or timezone('UTC')
>>> timezone_is_unknown = session.user_timezone is None
>>> 
>>> 
>>> 4. Use in the your model related with timezone:
>>> 
>>> IS_DATETIME(format=("%m-%d-%Y %H:%H), timezone = 
>>> pytz.timezone(timezone_user) )
>>> 
>>> There are other form, that is insert everything in UTC datetime and create 
>>> a function responsible to convert this timezone in UTC datetime inserted in 
>>> database. Just delayed a lot of , but yet I will create a 
>>> web2py_timezone_starter with app ready to receive apps that are handled by 
>>> timezones.
>>> 
>>> I'm creating this application to demonstrate this, if you want look..
>>> 
>>> http://marlysson.pythonanywhere.com/timezone
>>> 
>>> At app, the Hour "your PC" is datetime.now()  simulating datetime of user, 
>>> just that it's datetime of the pythonanywhere.
>>> 
>>> Em quinta-feira, 7 de julho de 2016 16:19:10 UTC-3, Jeff Riley escreveu:
>>>> 
>>>> Hello all.  Me again.  I have run into an interesting issue.  I have 
>>>> installed and followed niphlod's w2p_timezone_plugin.  In order to make it 
>>>> work on my local PC I need to setup my db.py as follows.
>>>> 
>>>> import pytz
>>>> user_timezone = session.plugin_timezone_tx or 'UTC'
>>>> 
>>>> 
>>>> db.define_table('events',
>>>> Field('event_time', 'datetime', default = request.now, 
>>>> update = request.now,
>>>> requires=IS_DATETIME(format=('%m-%d-%Y %H:%M'), 
>>>> timezone=pytz.timezone(user_timezone))),
>>>> 
>>>> 
>>>> But to get it to work on pythonanywhere.com I have to setup my db.py as 
>>>> follows.  Any ideas why?
>>>> 
>>>> 
>>>> import pytz
>>>> 
>>>> db.define_table('events',
>>>> Field('event_time', 'datetime', default = request.now, 
>>>> update = request.now,
>>>> requires=IS_DATETIME(format=('%m-%d-%Y %H:%M'), 
>>>> timezone=pytz.timezone("US/Central"))),
>> 
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/wL2y7s-FJWU/unsubscribe.
>> To unsubscribe from thi

Re: [web2py] Re: Pythonanywhere Timezone

2016-07-11 Thread Jeff Riley
Let me attach the new code or are you able to see the git hub. If so I will 
push to that.

Thank you,
Jeff Riley

> On Jul 11, 2016, at 7:29 AM, Marlysson Silva  wrote:
> 
> I think that I know where are missing pytz.. you put library in controller 
> define_timezone() ..
> 
> Em segunda-feira, 11 de julho de 2016 09:19:21 UTC-3, Jeff Riley escreveu:
>> 
>> Hello Marlysson.  I am getting the following error.  I have removed the 
>> module pytx_timezone, and I have verified that I have pip installed pytz.  
>> Not sure what else to dheck.
>> 
>>  No module named pytz
>> 
>> 
>> 
>>> On Sunday, July 10, 2016 at 4:39:30 PM UTC-5, Marlysson Silva wrote:
>>> You try to make this:
>>> 
>>> 1. Add library in the front-end to get user timezone ( this code need to be 
>>> in the first page that user access ), to get timezone first.
>>> 
>>> - https://bitbucket.org/pellepim/jstimezonedetect/src
>>> {{if timezone_is_unknown: }}
>>> 
>>>   $(function() {
>>> var tz_name = jstz.determine();
>>> $.get("{{=URL('default', 'define_timezone')}}", tz_name);
>>>   });
>>> 
>>> 
>>> 
>>> 2. Add  the controller responsible by determine timezone:
>>> 
>>> def define_timezone():
>>> """Call ajax to determine user timezone"""
>>> 
>>> tz_name = request.vars.name
>>> 
>>> from pytz import all_timezones_set
>>> 
>>> if tz_name in all_timezones_set:
>>> session.user_timezone = tz_name
>>> 
>>> 
>>> 3. And in the your model you put:
>>> 
>>> from pytz import timezone
>>> 
>>> timezone_user = session.user_timezone or timezone('UTC')
>>> timezone_is_unknown = session.user_timezone is None
>>> 
>>> 
>>> 4. Use in the your model related with timezone:
>>> 
>>> IS_DATETIME(format=("%m-%d-%Y %H:%H), timezone = 
>>> pytz.timezone(timezone_user) )
>>> 
>>> There are other form, that is insert everything in UTC datetime and create 
>>> a function responsible to convert this timezone in UTC datetime inserted in 
>>> database. Just delayed a lot of , but yet I will create a 
>>> web2py_timezone_starter with app ready to receive apps that are handled by 
>>> timezones.
>>> 
>>> I'm creating this application to demonstrate this, if you want look..
>>> 
>>> http://marlysson.pythonanywhere.com/timezone
>>> 
>>> At app, the Hour "your PC" is datetime.now()  simulating datetime of user, 
>>> just that it's datetime of the pythonanywhere.
>>> 
>>> Em quinta-feira, 7 de julho de 2016 16:19:10 UTC-3, Jeff Riley escreveu:
>>>> 
>>>> Hello all.  Me again.  I have run into an interesting issue.  I have 
>>>> installed and followed niphlod's w2p_timezone_plugin.  In order to make it 
>>>> work on my local PC I need to setup my db.py as follows.
>>>> 
>>>> import pytz
>>>> user_timezone = session.plugin_timezone_tx or 'UTC'
>>>> 
>>>> 
>>>> db.define_table('events',
>>>> Field('event_time', 'datetime', default = request.now, 
>>>> update = request.now,
>>>> requires=IS_DATETIME(format=('%m-%d-%Y %H:%M'), 
>>>> timezone=pytz.timezone(user_timezone))),
>>>> 
>>>> 
>>>> But to get it to work on pythonanywhere.com I have to setup my db.py as 
>>>> follows.  Any ideas why?
>>>> 
>>>> 
>>>> import pytz
>>>> 
>>>> db.define_table('events',
>>>> Field('event_time', 'datetime', default = request.now, 
>>>> update = request.now,
>>>> requires=IS_DATETIME(format=('%m-%d-%Y %H:%M'), 
>>>> timezone=pytz.timezone("US/Central"))),
> 
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "web2py-users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/web2py/wL2y7s-FJWU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Pythonanywhere Timezone

2016-07-11 Thread Jeff Riley
here is the new db.py, default.py, and index.html since that is the opening 
page.

On Monday, July 11, 2016 at 7:31:04 AM UTC-5, Jeff Riley wrote:
>
> Let me attach the new code or are you able to see the git hub. If so I 
> will push to that.
>
> Thank you,
> Jeff Riley
>
> On Jul 11, 2016, at 7:29 AM, Marlysson Silva  wrote:
>
> I think that I know where are missing pytz.. you put library in controller 
> define_timezone() ..
>
> Em segunda-feira, 11 de julho de 2016 09:19:21 UTC-3, Jeff Riley escreveu:
>>
>> Hello Marlysson.  I am getting the following error.  I have removed the 
>> module pytx_timezone, and I have verified that I have pip installed pytz.  
>> Not sure what else to dheck.
>>
>>  No module named pytz
>>
>> On Sunday, July 10, 2016 at 4:39:30 PM UTC-5, Marlysson Silva wrote:
>>>
>>> You try to make this:
>>>
>>> 1. Add library in the front-end to get user timezone ( this code need to 
>>> be in the first page that user access ), to get timezone first.
>>>
>>> - https://bitbucket.org/pellepim/jstimezonedetect/src
>>> {{if timezone_is_unknown: }}
>>> 
>>>   $(function() {
>>> var tz_name = jstz.determine();
>>> $.get("{{=URL('default', 'define_timezone')}}", tz_name);
>>>   });
>>> 
>>>
>>>
>>> 2. Add  the controller responsible by determine timezone:
>>>
>>> def define_timezone():
>>> """Call ajax to determine user timezone"""
>>>
>>> tz_name = request.vars.name
>>>
>>> from pytz import all_timezones_set
>>>
>>> if tz_name in all_timezones_set:
>>> session.user_timezone = tz_name
>>>
>>>
>>> 3. And in the your model you put:
>>>
>>> from pytz import timezone
>>>
>>> timezone_user = session.user_timezone or timezone('UTC')
>>> timezone_is_unknown = session.user_timezone is None
>>>
>>>
>>> 4. Use in the your model related with timezone:
>>>
>>> IS_DATETIME(format=("%m-%d-%Y %H:%H), timezone = 
>>> pytz.timezone(timezone_user) )
>>>
>>> There are other form, that is insert everything in UTC datetime and 
>>> create a function responsible to convert this timezone in UTC datetime 
>>> inserted in database. Just delayed a lot of , but yet I will create a 
>>> web2py_timezone_starter with app ready to receive apps that are handled by 
>>> timezones.
>>>
>>> I'm creating this application to demonstrate this, if you want look..
>>>
>>> http://marlysson.pythonanywhere.com/timezone
>>>
>>> At app, the *Hour "your PC"* is datetime.now()  simulating datetime of 
>>> user, just that it's datetime of the pythonanywhere.
>>>
>>>
>>> Em quinta-feira, 7 de julho de 2016 16:19:10 UTC-3, Jeff Riley escreveu:
>>>>
>>>> Hello all.  Me again.  I have run into an interesting issue.  I have 
>>>> installed and followed niphlod's w2p_timezone_plugin.  In order to make it 
>>>> work on my local PC I need to setup my db.py as follows.
>>>>
>>>> import pytz
>>>> user_timezone = session.plugin_timezone_tx or 'UTC'
>>>>
>>>>
>>>> db.define_table('events',
>>>> Field('event_time', 'datetime', default = request.now, 
>>>> update = request.now,
>>>> requires=IS_DATETIME(format=('%m-%d-%Y %H:%M'), 
>>>> timezone=pytz.timezone(user_timezone))),
>>>>
>>>>
>>>> But to get it to work on pythonanywhere.com I have to setup my db.py as 
>>>> follows.  Any ideas why?
>>>>
>>>>
>>>> import pytz
>>>>
>>>> db.define_table('events',
>>>> Field('event_time', 'datetime', default = request.now, 
>>>> update = request.now,
>>>> requires=IS_DATETIME(format=('%m-%d-%Y %H:%M'), 
>>>> timezone=pytz.timezone("US/Central"))),
>>>>
>>>>
>>>>
>>>> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to a topic in the 
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/web2py/wL2y7s-FJWU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


index.html.docx
Description: MS-Word 2007 document


db.py.docx
Description: MS-Word 2007 document


default.py.docx
Description: MS-Word 2007 document


Re: [web2py] Re: Pythonanywhere Timezone

2016-07-11 Thread Jeff Riley
I have tried to get to the index page and I have gone to admin and then the 
database tab so I can setup the authorized user. Both give me the same error

Thank you,
Jeff Riley

> On Jul 11, 2016, at 7:38 AM, Marlysson Silva  wrote:
> 
> Might put on github , but dont I can access them now
> 
> I will analyse your code by here , by while.
> 
> Later I will access github.
> 
> In error page, which file show the error?
> 
> Em segunda-feira, 11 de julho de 2016 09:31:04 UTC-3, Jeff Riley escreveu:
>> 
>> Let me attach the new code or are you able to see the git hub. If so I will 
>> push to that.
>> 
>> Thank you,
>> Jeff Riley
>> 
>>> On Jul 11, 2016, at 7:29 AM, Marlysson Silva  wrote:
>>> 
>>> I think that I know where are missing pytz.. you put library in controller 
>>> define_timezone() ..
>>> 
>>> Em segunda-feira, 11 de julho de 2016 09:19:21 UTC-3, Jeff Riley escreveu:
>>>> 
>>>> Hello Marlysson.  I am getting the following error.  I have removed the 
>>>> module pytx_timezone, and I have verified that I have pip installed pytz.  
>>>> Not sure what else to dheck.
>>>> 
>>>>  No module named pytz
>>>> 
>>>> 
>>>> 
>>>>> On Sunday, July 10, 2016 at 4:39:30 PM UTC-5, Marlysson Silva wrote:
>>>>> You try to make this:
>>>>> 
>>>>> 1. Add library in the front-end to get user timezone ( this code need to 
>>>>> be in the first page that user access ), to get timezone first.
>>>>> 
>>>>> - https://bitbucket.org/pellepim/jstimezonedetect/src
>>>>> {{if timezone_is_unknown: }}
>>>>> 
>>>>>   $(function() {
>>>>> var tz_name = jstz.determine();
>>>>> $.get("{{=URL('default', 'define_timezone')}}", tz_name);
>>>>>   });
>>>>> 
>>>>> 
>>>>> 
>>>>> 2. Add  the controller responsible by determine timezone:
>>>>> 
>>>>> def define_timezone():
>>>>> """Call ajax to determine user timezone"""
>>>>> 
>>>>> tz_name = request.vars.name
>>>>> 
>>>>> from pytz import all_timezones_set
>>>>> 
>>>>> if tz_name in all_timezones_set:
>>>>> session.user_timezone = tz_name
>>>>> 
>>>>> 
>>>>> 3. And in the your model you put:
>>>>> 
>>>>> from pytz import timezone
>>>>> 
>>>>> timezone_user = session.user_timezone or timezone('UTC')
>>>>> timezone_is_unknown = session.user_timezone is None
>>>>> 
>>>>> 
>>>>> 4. Use in the your model related with timezone:
>>>>> 
>>>>> IS_DATETIME(format=("%m-%d-%Y %H:%H), timezone = 
>>>>> pytz.timezone(timezone_user) )
>>>>> 
>>>>> There are other form, that is insert everything in UTC datetime and 
>>>>> create a function responsible to convert this timezone in UTC datetime 
>>>>> inserted in database. Just delayed a lot of , but yet I will create a 
>>>>> web2py_timezone_starter with app ready to receive apps that are handled 
>>>>> by timezones.
>>>>> 
>>>>> I'm creating this application to demonstrate this, if you want look..
>>>>> 
>>>>> http://marlysson.pythonanywhere.com/timezone
>>>>> 
>>>>> At app, the Hour "your PC" is datetime.now()  simulating datetime of 
>>>>> user, just that it's datetime of the pythonanywhere.
>>>>> 
>>>>> Em quinta-feira, 7 de julho de 2016 16:19:10 UTC-3, Jeff Riley escreveu:
>>>>>> 
>>>>>> Hello all.  Me again.  I have run into an interesting issue.  I have 
>>>>>> installed and followed niphlod's w2p_timezone_plugin.  In order to make 
>>>>>> it work on my local PC I need to setup my db.py as follows.
>>>>>> 
>>>>>> import pytz
>>>>>> user_timezone = session.plugin_timezone_tx or 'UTC'
>>>>>> 
>>>>>> 
>>>>>> db.define_table('events',
>>>>>> Field('event_time', 'datetime', default = request.now, 
>>>&

Re: [web2py] Re: Pythonanywhere Timezone

2016-07-11 Thread Jeff Riley
Yes I do. I am not that advanced to be able to handle more than one lol. I will 
make that change.

Thank you,
Jeff Riley

> On Jul 11, 2016, at 7:48 AM, Marlysson Silva  wrote:
> 
> You use just one model.py?
> if yes, change this line:
> 
> IS_DATETIME(format=("%m-%d-%Y %H:%H), timezone = pytz.timezone(timezone_user) 
> )
> 
> to 
> 
> IS_DATETIME(format=("%m-%d-%Y %H:%H), timezone = timezone(timezone_user) )
> 
> Em segunda-feira, 11 de julho de 2016 09:40:44 UTC-3, Jeff Riley escreveu:
>> 
>> I have tried to get to the index page and I have gone to admin and then the 
>> database tab so I can setup the authorized user. Both give me the same error
>> 
>> Thank you,
>> Jeff Riley
>> 
>>> On Jul 11, 2016, at 7:38 AM, Marlysson Silva  wrote:
>>> 
>>> Might put on github , but dont I can access them now
>>> 
>>> I will analyse your code by here , by while.
>>> 
>>> Later I will access github.
>>> 
>>> In error page, which file show the error?
>>> 
>>> Em segunda-feira, 11 de julho de 2016 09:31:04 UTC-3, Jeff Riley escreveu:
>>>> 
>>>> Let me attach the new code or are you able to see the git hub. If so I 
>>>> will push to that.
>>>> 
>>>> Thank you,
>>>> Jeff Riley
>>>> 
>>>>> On Jul 11, 2016, at 7:29 AM, Marlysson Silva  wrote:
>>>>> 
>>>>> I think that I know where are missing pytz.. you put library in 
>>>>> controller define_timezone() ..
>>>>> 
>>>>> Em segunda-feira, 11 de julho de 2016 09:19:21 UTC-3, Jeff Riley escreveu:
>>>>>> 
>>>>>> Hello Marlysson.  I am getting the following error.  I have removed the 
>>>>>> module pytx_timezone, and I have verified that I have pip installed 
>>>>>> pytz.  Not sure what else to dheck.
>>>>>> 
>>>>>>  No module named pytz
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> On Sunday, July 10, 2016 at 4:39:30 PM UTC-5, Marlysson Silva wrote:
>>>>>>> You try to make this:
>>>>>>> 
>>>>>>> 1. Add library in the front-end to get user timezone ( this code need 
>>>>>>> to be in the first page that user access ), to get timezone first.
>>>>>>> 
>>>>>>> - https://bitbucket.org/pellepim/jstimezonedetect/src
>>>>>>> {{if timezone_is_unknown: }}
>>>>>>> 
>>>>>>>   $(function() {
>>>>>>> var tz_name = jstz.determine();
>>>>>>> $.get("{{=URL('default', 'define_timezone')}}", tz_name);
>>>>>>>   });
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 2. Add  the controller responsible by determine timezone:
>>>>>>> 
>>>>>>> def define_timezone():
>>>>>>> """Call ajax to determine user timezone"""
>>>>>>> 
>>>>>>> tz_name = request.vars.name
>>>>>>> 
>>>>>>> from pytz import all_timezones_set
>>>>>>> 
>>>>>>> if tz_name in all_timezones_set:
>>>>>>> session.user_timezone = tz_name
>>>>>>> 
>>>>>>> 
>>>>>>> 3. And in the your model you put:
>>>>>>> 
>>>>>>> from pytz import timezone
>>>>>>> 
>>>>>>> timezone_user = session.user_timezone or timezone('UTC')
>>>>>>> timezone_is_unknown = session.user_timezone is None
>>>>>>> 
>>>>>>> 
>>>>>>> 4. Use in the your model related with timezone:
>>>>>>> 
>>>>>>> IS_DATETIME(format=("%m-%d-%Y %H:%H), timezone = 
>>>>>>> pytz.timezone(timezone_user) )
>>>>>>> 
>>>>>>> There are other form, that is insert everything in UTC datetime and 
>>>>>>> create a function responsible to convert this timezone in UTC datetime 
>>>>>>> inserted in database. Just delayed a lot of , but yet I will create 
>>>>>>> a web2py_timezone_starter with app ready to receive apps that are 
>>>>>>>

[web2py] Looking for a web2py contractor

2016-09-23 Thread Jeff Lipkowitz
I'm looking for a web2py contractor with SOAP experience.  

Please send resumes and work experience examples to 
j...@redbrickanalytics.com 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Looking for a web2py contractor

2016-09-26 Thread Jeff Lipkowitz
Looking forward!

On Friday, 23 September 2016 10:49:52 UTC-5, Jeff Lipkowitz wrote:
>
> I'm looking for a web2py contractor with SOAP experience.  
>
> Please send resumes and work experience examples to 
> j...@redbrickanalytics.com 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Looking for a web2py contractor

2016-09-26 Thread Jeff Lipkowitz
Please send a email for more details

On Friday, 23 September 2016 10:49:52 UTC-5, Jeff Lipkowitz wrote:
>
> I'm looking for a web2py contractor with SOAP experience.  
>
> Please send resumes and work experience examples to 
> j...@redbrickanalytics.com 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] looking for a web2py contractor with SOAP experience.

2016-09-26 Thread Jeff Lipkowitz
I'm looking for a web2py contractor with SOAP experience.  

Please send resumes and work experience examples to 
j...@redbrickanalytics.com 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Change Grid Add Button URL

2016-03-13 Thread Jeff Riley
Hello everyone,

I am so close to having my project finished.  I need to be able to override 
the URL in the SQLFORM.grid 'Add Record' button.  I also have the added 
problem in that I have linked tables in my grid and would like to override 
their add buttons also.  I have gone through almost all the posts on this 
site and have not come across one dealing with this.  Any help is greatly 
appreciated.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Change Grid Add Button URL

2016-03-13 Thread Jeff Riley


On Sunday, March 13, 2016 at 7:04:56 PM UTC-5, Jeff Riley wrote:
>
> Hello everyone,
>
> I am so close to having my project finished.  I need to be able to 
> override the URL in the SQLFORM.grid 'Add Record' button.  I also have the 
> added problem in that I have linked tables in my grid and would like to 
> override their add buttons also.  I have gone through almost all the posts 
> on this site and have not come across one dealing with this.  Any help is 
> greatly appreciated.
>

Update:  Ok I think I figured it out.  At least it seems to be working.  I 
would love to know if this is a valid solution.

@auth.requires_membership('manager')
def manage_customers():
if 'new' in request.args:
if request.args(2) == 'customer':
redirect(URL('new_customer'))
elif request.args(4) == 'sheet':
redirect(URL('new_sheet', args=request.args(2)))
customers = SQLFORM.smartgrid(db.customer, linked_tables=['address', 
'sheet'],
 searchable= dict(customer=True, 
address=False, sheet=True),
 create=True, paginate=20, maxtextlength=60)
return dict(customers=customers)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] SQLFORM.smartgrid displaying links

2016-03-15 Thread Jeff Riley
Hello all,

I have the following SQLFORM.smartgrid defined.

form = SQLFORM.smartgrid(db.customer, linked_tables=['address', 'sheet', 
'sheet_archive'],
 searchable= dict(customer=True, address=False, 
sheet=True),
 create=True, paginate=20, maxtextlength=60, 
fields=[db.customer.first_name,
 db.customer.last_name, db.customer.phone, 
db.customer.email, db.customer.left_handed,
 db.address.address1, db.address.address2, 
db.address.city, db.address.state_province,
 db.address.postal_code, db.sheet.title, 
db.sheet.created_by, db.sheet.created_on,
 db.sheet_archive.id, db.sheet_archive.title, 
db.sheet_archive.created_by,
 db.sheet_archive.created_on],)

Which produces the table with the following links to other tables.

My problem is, 'Sheet archives' is only related to 'Sheets', so I only want 
that link to show up on the 'Sheets' page.  Any ideas?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] URL parsing in controller

2016-03-18 Thread Jeff Riley
Hello All,

I am pulling my hair out.  I am trying to redirect the view button on a 
smartgrid.  I can get the button to redirect to the view I want, but I 
cannot parse the URL correctly to get the correct sheet id.

Here is my controller

@auth.requires_membership('manager')
def manage_customers():
if 'new' in request.args:
if request.args(2) == 'customer':
redirect(URL('new_customer'))
elif request.args(4) == 'sheet':
redirect(URL('new_sheet', args=request.args(2)))
if 'edit' in request.args:
if request.args(4) == 'sheet':
redirect(URL('edit_sheet', args=request.args(2)))
if 'view' in request.args:
if request.args(4) == 'sheet':
redirect(URL('view_sheet', args=request.args(2,5)))
elif request.args(6) == 'sheet_archive':
redirect(URL('view_sheet', args=request.args(7)))
form = SQLFORM.smartgrid(db.customer, linked_tables=['address', 
'sheet', 'sheet_archive'],
 searchable= dict(customer=True, address=False, 
sheet=False),
 editable= dict(customer=True, address=True, 
sheet=True, sheet_archive=False),
 deletable= dict(customer=True, address=True, 
sheet=True, sheet_archive=False),
 create=dict(customer=True, address=True, 
sheet=True, sheet_archive=False),
 paginate=20, maxtextlength=60, 
fields=[db.customer.first_name,
 db.customer.last_name, db.customer.phone, 
db.customer.email, db.customer.handed,
 db.address.address1, db.address.address2, 
db.address.city, db.address.state_province,
 db.address.postal_code, db.sheet.title, 
db.sheet.created_by, db.sheet.created_on,
 db.sheet_archive.id, db.sheet_archive.title, 
db.sheet_archive.created_by,
 db.sheet_archive.created_on],)
return dict(form=form, request=request)

Here is my URL:

http://127.0.0.1:8000/manage_customers/customer/sheet.customer_id/1/edit/sheet/2?_signature=3b4a45778f06aec42421ef503cba968cd633269a


I can only get the customer_id and not the sheet #2.  So I am always 
displaying the first customer record and the first sheet record.  SO LOST.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: URL parsing in controller

2016-03-18 Thread Jeff Riley
Ah you are totally correct. The controller is default and manage_customers is 
the function. I am still getting used to these constructs.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: URL parsing in controller

2016-03-19 Thread Jeff Riley
DPS and all,

I have my routes.py set to the application (a).  As far as what is 
requestmaths(0), that is what is confusing.  That URL is generated by 
smartgrid.  Manage_customers is the controller, so customer should be the 
function but it is not. View is the function.  This is why I am having trouble 
understanding how to grab the customer id and the sheet id.

Thank you,
Jeff Riley

> On Mar 18, 2016, at 3:58 PM, Dave S  wrote:
> 
> 
> 
>> On Friday, March 18, 2016 at 1:18:23 PM UTC-7, webm...@trytha.com wrote:
>> Maybe something about "args=request.args(2,5)"?
> 
> He's trying to do a slice, but that would be [2:5], innit?
> 
>  
>> You could try to test this:
>> 
>> args=[request.args(2),request.args(5)]
> 
> shouldn't those '(' and ')' be '[' and ']'  (list indexes)?
> 
> Also, (Jeff) please verify which part of the URL is request.args[0] .  It 
> will be after the app/contoller/function code (and you're using routes.py to 
> set default for the c/f part?);
> I see "sheet" where I count 4, but it should be double-checked.
> 
> /dps
> 
>> 
>> 
>> 
>>> On Friday, March 18, 2016 at 1:01:51 PM UTC-7, Jeff Riley wrote:
>>> Hello All,
>>> 
>>> I am pulling my hair out.  I am trying to redirect the view button on a 
>>> smartgrid.  I can get the button to redirect to the view I want, but I 
>>> cannot parse the URL correctly to get the correct sheet id.
>>> 
>>> Here is my controller
>>> 
>>> @auth.requires_membership('manager')
>>> def manage_customers():
>>> if 'new' in request.args:
>>> if request.args(2) == 'customer':
>>> redirect(URL('new_customer'))
>>> elif request.args(4) == 'sheet':
>>> redirect(URL('new_sheet', args=request.args(2)))
>>> if 'edit' in request.args:
>>> if request.args(4) == 'sheet':
>>> redirect(URL('edit_sheet', args=request.args(2)))
>>> if 'view' in request.args:
>>> if request.args(4) == 'sheet':
>>> redirect(URL('view_sheet', args=request.args(2,5)))
>>> elif request.args(6) == 'sheet_archive':
>>> redirect(URL('view_sheet', args=request.args(7)))
>>> form = SQLFORM.smartgrid(db.customer, linked_tables=['address', 
>>> 'sheet', 'sheet_archive'],
>>>  searchable= dict(customer=True, address=False, 
>>> sheet=False),
>>>  editable= dict(customer=True, address=True, 
>>> sheet=True, sheet_archive=False),
>>>  deletable= dict(customer=True, address=True, 
>>> sheet=True, sheet_archive=False),
>>>  create=dict(customer=True, address=True, 
>>> sheet=True, sheet_archive=False),
>>>  paginate=20, maxtextlength=60, 
>>> fields=[db.customer.first_name,
>>>  db.customer.last_name, db.customer.phone, 
>>> db.customer.email, db.customer.handed,
>>>  db.address.address1, db.address.address2, 
>>> db.address.city, db.address.state_province,
>>>  db.address.postal_code, db.sheet.title, 
>>> db.sheet.created_by, db.sheet.created_on,
>>>  db.sheet_archive.id, db.sheet_archive.title, 
>>> db.sheet_archive.created_by,
>>>  db.sheet_archive.created_on],)
>>> return dict(form=form, request=request)
>>> 
>>> Here is my URL:
>>> http://127.0.0.1:8000/manage_customers/customer/sheet.customer_id/1/edit/sheet/2?_signature=3b4a45778f06aec42421ef503cba968cd633269a
>>> 
>>> 
>>> 
>>> I can only get the customer_id and not the sheet #2.  So I am always 
>>> displaying the first customer record and the first sheet record.  SO LOST.
>>> 
> 
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "web2py-users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/web2py/VW9k-9LIEAs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: URL parsing in controller

2016-03-19 Thread Jeff Riley
DPS and all,

I have my routes.py set to the application (a).  As far as what is 
requestmaths(0), that is what is confusing.  That URL is generated by 
smartgrid.  Manage_customers is the controller, so customer should be the 
function but it is not. View is the function.  This is why I am having trouble 
understanding how to grab the customer id and the sheet id.

Thank you,
Jeff Riley

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1   2   >