Pablo Cruise | 26 Nov 00:47 2014
Picon

Hardcoded Drop Down Menu In Form

I'm a novice Web2py programmer and I've searched the net but can't figure this out.

I've got a simple webpage with this form:

    form = FORM(TABLE(TR
            (TH('BEG PLAN START DATE'), INPUT(_name='begpstrtdt', _class='date', requires=IS_DATE(), _value=t0, _style="width: 100px;")),
            (TH('END PLAN START DATE'), INPUT(_name='endpstrtdt', _class='date', requires=IS_DATE(), _value=t0, _style="width: 100px;")),
            TR('Group',INPUT(_name='group', _id='group', , requires=IS_IN_SET(['YES', 'NO']))),        
            TR('Email Results?',INPUT(_name='emailflg', _id='emailflg', _type='checkbox', _value='0')),
            TR('Show Query?',INPUT(_name='qryflg', _id='qryflg', _type='checkbox', _value='1', _checked="checked",
             _onclick="if(jQuery('#qryflg').prop('checked')) jQuery('#qryinfo').show(); else jQuery('#qryinfo').hide();")),             
            TR('Show Debug?',INPUT(_name='dbgflg', _id='dbgflg', _type='checkbox', _value='1', _checked="checked",
             _onclick="if(jQuery('#dbgflg').prop('checked')) jQuery('#dbginfo').show(); else jQuery('#dbginfo').hide();")),
            TR(INPUT(_type='submit',_value='Submit'))
            ))


Everything works except I can't get the Group dropdown, 3rd element, to be a dropdown menu.  It shows up as a text field.

1. Is there an attribute I'm missing in the description?
2. How would I get the selected value?

I've seen many example using SQLFORM but I don't have a need for these fields to be saved or retrieved to/from a database.

Thanks,
Paul

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Robin Manoli | 25 Nov 12:10 2014
Picon

are expired session files deleted automatically?

Hi!

I noticed that when I'm working alone on a project, the session folder creates quite a lot of sessions. I wonder if web2py deletes expired automatically? Or is there a way to delete them? It wouldn't be so nice to have expired sessions of thousands of users when the site is in production mode, would it?

Thanks for your time,
- Robin

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Gael Princivalle | 25 Nov 09:00 2014
Picon

Sitemap

Hi all.

Just a post for giving you my interpretation of how making a sitemap.
Base code is in this post :
https://groups.google.com/forum/#!searchin/web2py/sitemap/web2py/TUMn6R3BJ10/TRSLCY_JQ8UJ

With a lot of URLs, in my case more than 2000 (a lot of products), Google Webmaster turns me back an error with my XML sitemap. Splitting the sitemap in more files was a little bit tricky, so I've change to a txt sitemap. No more errors.
For having everyday a "fresh" sitemap, I've put the function in the scheduler.
It works fine. These products that are sells in all over the world by a lot of online merchants, and my website is always at the first or second place in a Google search.
Here is the code, I hope it could help someone:
def sitemap_txt_auto():
   
import os
   
from gluon.myregex import regex_expose
   
# Functions URLs
    exclusions
= ['index', 'user', 'unsubscribe', 'download', 'call', 'data', 'upload', 'browse', 'delete']
    ctldir
= os.path.join(request.folder,"controllers")
    ctls
=os.listdir(ctldir)
   
if 'appadmin.py' in ctls: ctls.remove('appadmin.py')
   
if 'manage.py' in ctls: ctls.remove('manage.py')
    sitemap
='http://www.mydomain.com/it/index.html'
    sitemap
+= '\r\n'
    sitemap
+= 'http://www.mydomain.com/en/index.html'
   
for ctl in ctls:
       
if ctl.endswith(".bak") == False:
            filename
= os.path.join(ctldir,ctl)
            data
= open(filename, 'r').read()
            functions
= regex_expose.findall(data)
           
for f in functions:
               
if not any(f in s for s in exclusions): # if function is not in exclustions
                    sitemap
+= '\r\n'
                    sitemap
+= 'http://www.mydomain.com/it/%s' % (f)
                    sitemap
+= '\r\n'
                    sitemap
+= 'http://www.mydomain.com/en/%s' % (f)
   
# Products
    products
= db().select(db.products.ALL, orderby=db.products.id)
    pdf_paths
= []
   
for item in products:
       
# Product pages
        sitemap
+= '\r\n'
        sitemap
+= 'http://www.mydomain.com/it/products_listing/view/products/%s' % (str(item.id))
        sitemap
+= '\r\n'
        sitemap
+= 'http://www.mydomain.com/en/products_listing/view/products/%s' % (str(item.id))
       
# PDF files
       
if pdf_paths.count(item.pdf_path) < 1:#Usefull because some products have a same pdf file
            pdf_paths
.append(item.pdf_path)
            sitemap
+= '\r\n'
            sitemap
+= item.pdf_path
    file
= open('%s/static/sitemaps/sitemap.txt' %request.folder, 'w')
    file
.write(sitemap)
    file
.close()
    db
.commit()

from gluon.scheduler import Scheduler
Scheduler(db,dict(sitemap_txt_auto=sitemap_txt_auto))



--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Rodrigo | 24 Nov 17:55 2014
Picon

Extra fields in auth using CAS

Hi All!

Is it possible to include extra fields in auth when i'm 
using CAS?
I divided my app in some , so i'll use CAS to authenticate, but the user must have a field called "group" ,
because itens added for a user in one group must not been seen by users from other groups, i intend 
to add this field to auth so i can read it when i'll add
another record...

-- 
Rodrigo <rcesarh27@...>

--

-- 
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+unsubscribe@...
For more options, visit https://groups.google.com/d/optout.

محمد رشاد | 24 Nov 19:56 2014
Picon

web2py and post data

Hi all
Thank you for this helpful group
I'm new in web2py and python, I have an application that has a function called "ws"
That function has an page called "check" which accepts user inputs by this "token = request.vars.token", it works and accept the inputs that come using POST and GET http methods.
What I want is to accept the POST methods only and refuse the GET ones, who to do that?

Thank you

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Alex Glaros | 24 Nov 08:47 2014
Picon

after_update

anyone see what the error is with this after_update function?

# Update displayName in db.SuperObject whenever Suggestion.suggestionTitle is updated in db.Suggestion  
def update_SuggestionDisplayName(set, ufields):
   table = 'Suggestion' if ('suggestionTitle' in ufields) else None
   if table:
       name_format = '%(suggestionTitle)s'
        records = set.select()
       for record in records:
           displayName = name_format % record
           ThisSuperObject = db(db.SuperObject.id == record.objectID).select(db.SuperObject.id).first()
           ThisSuperObject.update_record(displayName=displayName)
           db(db.SuperObject.id == ThisSuperObject.objectID).update(objectDisplayName=displayName)


db.Suggestion._after_update.append(update_SuggestionDisplayName)


Error
 File "C:/Program Files (x86)/web2py/web2py/applications/ES1/models/db.py", line 1441, in update_SuggestionDisplayName
    ThisSuperObject.update_record(displayName=displayName)
  File "gluon/dal.py", line 10866, in __call__
  File "gluon/dal.py", line 10772, in update
SyntaxError: No fields to update

Function argument list
(self=<Set (SuperObject.id = 18)>, **update_fields={})

Table SuperObject
db.define_table('SuperObject',  #
    Field('objectDisplayName','string', label='Object Name'),
    Field('objectTypeID','reference ObjectType', label = 'Object Type'), 
format='%(objectDisplayName)s') ## 

Table Suggestion
db.define_table('Suggestion', 
Field('objectID', 'reference SuperObject'),  
Field('suggestionTitle','string', length=140, label='suggestion Title', comment='140 characters max'),
Field('suggestionShortSummary','string', length=280, label='Summary info', comment='short summary - 280 characters max'),
format='%(suggestionTitle)s')

Thanks,

Alex Glaros





--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Massimo Di Pierro | 23 Nov 19:02 2014
Picon

web2py star rating

I have been very unsatisfied with existing star rating plugins. First, they are too complex. Second, they required dedicated fonts/images while all the necessary symbols are already in unicode. So I made this:

    https://gist.github.com/mdipierro/f221957e002baa014c9a

Just add this code at the bottom of your views:

    <script src="https://gist.github.com/mdipierro/f221957e002baa014c9a.js"></script>

and all the fields with a name containing "rating" or input fields having a class "rating" will be represented by a star 1-5 widget. 
Perhaps we should make this default in web2py?

Massimo
 

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Jorge Molongua | 23 Nov 06:40 2014
Picon

web2py error on cygwin

Hi. I'm using cygwin on Windows 8. I'm new to this. It reports a warning when I try to load web2py: "WARNING:web2py:GUI not available because Tk library is not installed". How can I work round this?

I not literate in Linux. Attached is s screen shot.

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Picon

upper with Cyrillic

how to get to work upper with Cyrillic ?
db.wanted.fam.upper()==fam.upper()

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
LoveWeb2py | 22 Nov 07:55 2014
Picon

Possible to use CAS/Single Signon with custom auth_db?

Hello,

I'm trying to use Web2py's CAS feature and database cooperation. I tried to follow this article: http://www.web2pyslices.com/slice/show/1877/single-login-by-two-different-ways

And it looks good, but what if I'm using custom authentication? The appliance found here: https://github.com/mdipierro/web2py-appliances/tree/master/PyForum2 uses custom authentication and I'm not what the best approach would be to use central authentication between two appliances.

Main appliance: Uses web2py's basic authentication
Forum Appliance: Uses custom auth here is a sample of the db.py

## Authentication Schema (3 tables)
db.define_table('auth_users',
                db.Field('auth_email', 'string', length=128, required=True),
                db.Field('auth_passwd', 'string', length=128, required=True),
                db.Field('auth_created_on', 'string', required=True),
                db.Field('auth_modified_on', 'string', required=True),
                db.Field('is_enabled', 'boolean', required=False,
                         default=True),
                migrate='auth_users.table', fake_migrate=fake_migrate)


Is CAS an option here?

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Bart | 21 Nov 16:36 2014
Picon

web2py RESTful timeout

I have a python script that posts data to my web2py/application/projects database using RESTful services.  Everything works fine for an hour or two, but then all future posts will timeout.  If, using a web browser, I reload the web2py application's main page then the RESTful services start working again for another hour or two.  Any ideas why I cant run a script 24/7 to GET/POST data to my web2py application's RESTful services? 

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Gmane