Re: [web2py] database question
On 09/23/2010 09:49 PM, rick wrote: I have three tables: Could you show us the tables you have created? Don't need the data just how they are setup. I can then try to make your query. Br, Jason
[web2py] Re: database question
I guess you're looking for something like this: In db_00.py: db.define_table('stores', Field('name'), migrate='stores.table') db.define_table('regions', Field('abbr',length=2), migrate='regions.table') db.define_table('store_region', Field('store_id',db.stores), Field('region_id',db.regions), migrate='store-region.table') Note: store-region should be store_region In a controller: def stores(): form=SQLFORM.factory(Field('region',requires=IS_IN_DB(db,'regions.id','% (abbr)s'))) rows=[] if form.accepts(request.vars, session): response.flash = 'form accepted' rows=db((db.store_region.store_id==db.stores.id)\ (db.store_region.region_id==request.vars.region))\ .select(db.stores.name,orderby=db.stores.name) elif form.errors: response.flash = 'form has errors' else: response.flash = 'please fill out the form' return dict(form=form,rows=rows) Kind regards, Annet.
[web2py] export text to Office?
Hello, I would like to generate template reports for Office with a predefined page header footer similar to was is now possible with PDF. A starting point could be: http://github.com/mikemaccana/python-docx#readme Have there been any attempts to create MS Word files with web2py? Regards, Timmie
[web2py] Looping through DAL Rows Object
Ok this is simple I know , but I am sort of not getting it. I have a table named 'spam' and I need the latest three entries of it .. so i do the below:- def home: latestthreespams=db().select(db.spam.ALL,orderby=~db.spam.created_on,limitby=(0,3)) return dict(jingle=latestthreespams) now I go to the view and try to access only the attributes of second spam of the three spam row objects sent.I was trying something like this in the view which obviosly does not work:- {{for elem in jingle(1):}} {{=elem.title}} {{pass}}
[web2py] Consecutive id numbers in GAE
Of course, web2py automatically assigns record IDs, but in GAE, they aren't consecutive. That means this code in my view won't work reliably in GAE: a href={{=URL(r=request,f='respond', args=poll.id+1)}}Next/a Here's a suggested solution. How would I implement it in web2py? http://groups.google.com/group/google-appengine-python/browse_thread/thread/ead87c50c4e4004b
[web2py] Re: Deploying web2py on linux (Redhat or others) on cpanel or other ways
All, Can we use Cherokee or Lighttpd instead on a shared host to deploy the application. If yes, how and which would be the easiest. I dont mind using it with Rocket either. All I want is to get it up there and running on CPanel - aka - Shared hosting..
[web2py] Store and retrieve blob
Hello, i am working on a project where web2py will be used as a online/ offline frontent for mobile users ufor our ERP System. The communication from web2py to the backend system is implemented with the soap library suds. Now i am at the point to deal with exchanging files (pdf, pictures ). Within python i am able to get files from the backend system: - from suds.client import Client import base64 urlmobileservice = URL2WDSL mobileservice = Client(urlmobileservice) getdok = mobileservice.service.ZMsGetDokuFiles(SERVICEPARAMETERS) converted=base64.standard_b64decode(getdok.FileXsring) filename = /tmp/test.pdf file = open(filename, 'w') file.write(converted) file.close The file is saved correctly on the filesystem. Within web2py i would like to save the document (getdok) within the database as blob. Until now i did not find a proper way to store and retrieve this documents. Any examples ? Stefan
[web2py] GAE appstats problem in app.yaml
GAE appstats no longer works in app.yaml for 1.85.3 and some earlier versions (at least using dev_appserver.py) This URL gets response code 500: http://localhost:8080/_ah/login?continue=http://localhost:8080/_ah/stats/ It works if I remove login: admin (below) from app.yaml - url: /_ah/stats.* script: $PYTHON_LIB/google/appengine/ext/appstats/ui.py login: admin This code causes no trouble, however: - url: /_ah/admin/.* script: $PYTHON_LIB/google/appengine/ext/admin login: admin However, I can't get the custom admin console page to appear no matter what I do. I have to go directly to http://localhost:8080/_ah/stats/ I can't remember if that ever worked.
[web2py] Re: Deploying web2py on linux (Redhat or others) on cpanel or other ways
Have you tried Massimo's solution? http://groups.google.com/group/web2py/browse_thread/thread/bc29ddd40d441a6d# On Sep 24, 3:52 am, Rahul rahul.dhak...@gmail.com wrote: All, Can we use Cherokee or Lighttpd instead on a shared host to deploy the application. If yes, how and which would be the easiest. I dont mind using it with Rocket either. All I want is to get it up there and running on CPanel - aka - Shared hosting..
[web2py] Deployment using Rocket Server only on shared hosting - cpanel
Hi , I have a question. Cant we simply deploy web2py with Rocket only. Not using Apache or any other server to server any requests? Is this possible? Has anyone tried it before? If yes please please let us know how can we achieve it on shared env which we have shell access + virtualenv but no root. I can accept the speed limits if its a trade-off for not being able to deploy web2py at all :-( Does any one have an answer? Please post Rahul D
[web2py] Re: how to use web2py planet?
There is a cron job that fetches rss posts, and you could call If I understand the crontab correctly the server should fetch new posts every minute, correct? This does not happen. refresh() controller to force update. manually calling refresh updates the planet feeds page without problems. I could see a redirect from the refresh page to the index page after successful refresh... Do you have a demo installed somewhere? How do you indeted to have new feeds added? Via the appadmin or the /default/user page? Thanks for the nice work, Timmie
[web2py] Re: VPS.net With Web2py.... Unable to install Application
Yannick, Hi Yannick, As I mentioned before this sounds lot like a permissions issue. If you could include the output of the following command when run from the web2py directory on your server it could be very helpful. ls -al | grep applications Where you able to restart Apache and web2py? Cheers, Chris On Sep 23, 11:05 am, Yannick ytchatch...@gmail.com wrote: Hello Scausten, I wonder were you able to upload an application from the web2py admin page after your installation ? For some reason I can't upload any application. I still have that message saying Unable to install application... even after I restart web2py etc... Please let me know. Thanks, Yannick P. On Sep 23, 9:19 am, scausten scaus...@gmail.com wrote: Don't worry, I was doing something extraordinarily stupid - the script is fine. On Sep 23, 2:05 pm, mdipierro mdipie...@cs.depaul.edu wrote: I do not see anything wrong with line 4 On Sep 23, 5:25 am, scausten scaus...@gmail.com wrote: Hi Massimo, I've tried to install web2py on vps.net today and I'm getting the following error message: ./setup-web2py-ubuntu.sh: line 4: syntax error near unexpected token `newline' Could you have a look at it please? On Sep 23, 4:36 am, mdipierro mdipie...@cs.depaul.edu wrote: yes this should do it sudo /etc/init.d/apache2 restart I do know why you cannot write on that folder. On Sep 22, 10:14 pm, Yannick ytchatch...@gmail.com wrote: Thanks for the note. This may be a stupid question:) but in my set up (Mod_WSGI+ Apache +Web2py) how do you restart web2py from command line ? I tried to reboot apache (sudo /etc/init.d/apache2 restart), but I don't think it also reboot web2py, because from the Admin page after the apache rebooting I was still unable to upload an application. Thanks a lot, Yannick P. On Sep 22, 6:13 pm, Christopher Steel chris.st...@gmail.com wrote: Hi Yannick, This is a permissions issue, shut down web2py then restart it. This has happened with some other folks at VPS and that usually takes care of it. Cheers, Chris On Sep 21, 11:49 pm, Yannick ytchatch...@gmail.com wrote: Hello mate, I'm new with VPS Hosting... I just installed Web2py, Postgres Admin... From the Admin Console of Web2py I tried to install the application through the Upload install packed application form and i got a message saying Unable to Install the application The application was 44MB, so I tried to install a very small application of 4MB just to see but it didn't work too. SO basically I manually upload the application on the Application directory of Web2py using SFTP. Then from the Admin Console I can see the application but I when I tried to access the app from the browser http://IPADDRESS/App/default/index; I got a message saying Internal Error and a link Ticket issued: unknown... When I click on the unknown I got a message saying invalid Ticket... I really don't have any clue of what's going on ?? Please help... Thanks Yannick P.
[web2py] Re: export text to Office?
web2py includes pyRTF to generate Rich Text Format. Look into gluon/contrib/pyrtf/ On Sep 24, 2:30 am, Timmie timmichel...@gmx-topmail.de wrote: Hello, I would like to generate template reports for Office with a predefined page header footer similar to was is now possible with PDF. A starting point could be:http://github.com/mikemaccana/python-docx#readme Have there been any attempts to create MS Word files with web2py? Regards, Timmie
[web2py] Re: Looping through DAL Rows Object
you loop {{for elem in jingle:}} {{=elem.title}} {{pass}} or take a slice {{for elem in jingle[1:2]:}} {{=elem.title}} {{pass}} or pick one {{elem=jingle[1]}} {{=elem.title}} On Sep 24, 2:43 am, b vivek bvivek1...@gmail.com wrote: Ok this is simple I know , but I am sort of not getting it. I have a table named 'spam' and I need the latest three entries of it .. so i do the below:- def home: latestthreespams=db().select(db.spam.ALL,orderby=~db.spam.created_on,limitby=(0,3)) return dict(jingle=latestthreespams) now I go to the view and try to access only the attributes of second spam of the three spam row objects sent.I was trying something like this in the view which obviosly does not work:- {{for elem in jingle(1):}} {{=elem.title}} {{pass}}
[web2py] Re: Issue with concurrency on languages file updating
Hi Fran, I checked out the Sahana Eden \Open Source Disaster Management Platform the other day. WoW! http://eden.sahanafoundation.org Awesome work! Christopher Steel On Sep 22, 5:52 pm, Fran francisb...@gmail.com wrote: Hi folks, I have an issue with concurrency the dynamic updating of the language files. All works fine for a single user, however if multiple users are accessing the site in a translated language then multiple attempts are made to update the language file. User can get an error traceback: File C:\Bin\web2py\gluon\languages.py, line 127, in __str__ return self.T.translate(self.m, self.s) File C:\Bin\web2py\gluon\languages.py, line 257, in translate write_dict(self.language_file, self.t) File C:\Bin\web2py\gluon\languages.py, line 100, in write_dict fp.close() IOError: [Errno 13] Permission denied Then the language file loses all it's translations! The file exists but all translated strings have reverted to the raw untranslated version. This is running current Web2Py trunk on both a Debian server (Python 2.5/WSGI) a Windows 7 laptop (Python 2.6/Rocket). I'm not sure why the file locking isn't working: portalocker.lock(fp, portalocker.LOCK_EX) A quick workaround is to set file permissisions to not allow the webserver to update the file, which needs a patch to languages.py (attached). This patch is useful anyway as I never liked the fact that the system would error out if the languages files weren't writable...this isn't a failsafe behaviour. This strikes me as the behaviour that we'd want on a Production instance anyway since usually the translations will be happening offline (e.g. using a collaborative Pootle instance) so merging in the dynamic strings with the updated versions is a pain. However, I do like the idea of capturing the missing strings from the Production instance to get these merged offline into the master file, so wonder whether it's worth writing these out to a separate file? - this file being common to all languages as the missing strings should be added to every file... Best Wishes, Fran. --- languages.orig.py Wed Sep 22 11:19:16 2010 +++ languages.py Wed Sep 22 11:29:17 2010 @@ -31,7 +31,7 @@ regex_translate = re.compile(PY_STRING_LITERAL_RE, re.DOTALL) -# patter for a valid accept_language +# pattern for a valid accept_language regex_language = \ re.compile('^[a-zA-Z]{2}(\-[a-zA-Z]{2})?(\-[a-zA-Z]+)?$') @@ -90,6 +90,9 @@ def write_dict(filename, contents): + if not os.access(filename, os.W_OK): + logging.error('Unable to write to file %s' % filename) + return fp = open(filename, 'w') portalocker.lock(fp, portalocker.LOCK_EX) fp.write('# coding: utf8\n{\n')
[web2py] Re: Deploying web2py on linux (Redhat or others) on cpanel or other ways
All, I did some basic things to run this from scratch with Rocket and it is working like a charm. More details on Monday. Please let me know your feed back on this site below. http://www.flockbird.com:9000/web2py/Flockbird/default/index There is a BugBuster - Bug Tracking application that you all need to check Cheers Rahul
[web2py] Re: VPS.net With Web2py.... Unable to install Application
Hello Chris, Thanks for the note and suggestions: Yes did reboot Apache and Web2py... Here is the result of the command I run in web2py dir: drwxr-xr-x 6 www-data www-data 4096 2010-09-22 04:15 applications From the command it seems that the owner do have permision to read and writehumm...Please let me know if you have any idea since I'm still not able to upload app from admin. I upload them from sftp... Thanks, Yannick P. On Sep 24, 8:11 am, Christopher Steel chris.st...@gmail.com wrote: Yannick, Hi Yannick, As I mentioned before this sounds lot like a permissions issue. If you could include the output of the following command when run from the web2py directory on your server it could be very helpful. ls -al | grep applications Where you able to restart Apache and web2py? Cheers, Chris On Sep 23, 11:05 am, Yannick ytchatch...@gmail.com wrote: Hello Scausten, I wonder were you able to upload an application from the web2py admin page after your installation ? For some reason I can't upload any application. I still have that message saying Unable to install application... even after I restart web2py etc... Please let me know. Thanks, Yannick P. On Sep 23, 9:19 am, scausten scaus...@gmail.com wrote: Don't worry, I was doing something extraordinarily stupid - the script is fine. On Sep 23, 2:05 pm, mdipierro mdipie...@cs.depaul.edu wrote: I do not see anything wrong with line 4 On Sep 23, 5:25 am, scausten scaus...@gmail.com wrote: Hi Massimo, I've tried to install web2py on vps.net today and I'm getting the following error message: ./setup-web2py-ubuntu.sh: line 4: syntax error near unexpected token `newline' Could you have a look at it please? On Sep 23, 4:36 am, mdipierro mdipie...@cs.depaul.edu wrote: yes this should do it sudo /etc/init.d/apache2 restart I do know why you cannot write on that folder. On Sep 22, 10:14 pm, Yannick ytchatch...@gmail.com wrote: Thanks for the note. This may be a stupid question:) but in my set up (Mod_WSGI+ Apache +Web2py) how do you restart web2py from command line ? I tried to reboot apache (sudo /etc/init.d/apache2 restart), but I don't think it also reboot web2py, because from the Admin page after the apache rebooting I was still unable to upload an application. Thanks a lot, Yannick P. On Sep 22, 6:13 pm, Christopher Steel chris.st...@gmail.com wrote: Hi Yannick, This is a permissions issue, shut down web2py then restart it. This has happened with some other folks at VPS and that usually takes care of it. Cheers, Chris On Sep 21, 11:49 pm, Yannick ytchatch...@gmail.com wrote: Hello mate, I'm new with VPS Hosting... I just installed Web2py, Postgres Admin... From the Admin Console of Web2py I tried to install the application through the Upload install packed application form and i got a message saying Unable to Install the application The application was 44MB, so I tried to install a very small application of 4MB just to see but it didn't work too. SO basically I manually upload the application on the Application directory of Web2py using SFTP. Then from the Admin Console I can see the application but I when I tried to access the app from the browser http://IPADDRESS/App/default/index; I got a message saying Internal Error and a link Ticket issued: unknown... When I click on the unknown I got a message saying invalid Ticket... I really don't have any clue of what's going on ?? Please help... Thanks Yannick P.
Re: [web2py] Re: Looping through DAL Rows Object
Thanks Massimo! On Fri, Sep 24, 2010 at 5:51 PM, mdipierro mdipie...@cs.depaul.edu wrote: you loop {{for elem in jingle:}} {{=elem.title}} {{pass}} or take a slice {{for elem in jingle[1:2]:}} {{=elem.title}} {{pass}} or pick one {{elem=jingle[1]}} {{=elem.title}} On Sep 24, 2:43 am, b vivek bvivek1...@gmail.com wrote: Ok this is simple I know , but I am sort of not getting it. I have a table named 'spam' and I need the latest three entries of it .. so i do the below:- def home: latestthreespams=db().select(db.spam.ALL,orderby=~db.spam.created_on,limitby=(0,3)) return dict(jingle=latestthreespams) now I go to the view and try to access only the attributes of second spam of the three spam row objects sent.I was trying something like this in the view which obviosly does not work:- {{for elem in jingle(1):}} {{=elem.title}} {{pass}}
[web2py] Re: Store and retrieve blob
if you have db.define_table('a',Field('b','blob')) db.a.insert(b=converted) On Sep 24, 4:34 am, winti stefan.winterb...@gmail.com wrote: Hello, i am working on a project where web2py will be used as a online/ offline frontent for mobile users ufor our ERP System. The communication from web2py to the backend system is implemented with the soap library suds. Now i am at the point to deal with exchanging files (pdf, pictures ). Within python i am able to get files from the backend system: - from suds.client import Client import base64 urlmobileservice = URL2WDSL mobileservice = Client(urlmobileservice) getdok = mobileservice.service.ZMsGetDokuFiles(SERVICEPARAMETERS) converted=base64.standard_b64decode(getdok.FileXsring) filename = /tmp/test.pdf file = open(filename, 'w') file.write(converted) file.close The file is saved correctly on the filesystem. Within web2py i would like to save the document (getdok) within the database as blob. Until now i did not find a proper way to store and retrieve this documents. Any examples ? Stefan
[web2py] Re: GAE appstats problem in app.yaml
This is not a web2py issue but a GAE issue. Has something changed there and we need to adapt out app.yaml? On Sep 24, 4:55 am, mdmcginn michael.d.mcgin...@gmail.com wrote: GAE appstats no longer works in app.yaml for 1.85.3 and some earlier versions (at least using dev_appserver.py) This URL gets response code 500:http://localhost:8080/_ah/login?continue=http://localhost:8080/_ah/st... It works if I remove login: admin (below) from app.yaml - url: /_ah/stats.* script: $PYTHON_LIB/google/appengine/ext/appstats/ui.py login: admin This code causes no trouble, however: - url: /_ah/admin/.* script: $PYTHON_LIB/google/appengine/ext/admin login: admin However, I can't get the custom admin console page to appear no matter what I do. I have to go directly tohttp://localhost:8080/_ah/stats/I can't remember if that ever worked.
[web2py] Re: export text to Office?
web2py includes pyRTF to generate Rich Text Format. Look into gluon/contrib/pyrtf/ I know. But can this also modify page headline and footer? Test the module I recommended. The example document looks very nice. I know that Sahana is also doings something along these lines but they have a decent XML processing engine behind, AFAIK.
[web2py] Re: Store and retrieve blob
Thank you massimo, this i tried allready and could store the data but not retrieve in a usefull format... How is it possible for downloading this stored file in field b providing the user a link within web2py ? I allways get rubish back or a huge url with the data stored within this field. Stefan On 24 Sep., 15:21, mdipierro mdipie...@cs.depaul.edu wrote: if you have db.define_table('a',Field('b','blob')) db.a.insert(b=converted) On Sep 24, 4:34 am, winti stefan.winterb...@gmail.com wrote: Hello, i am working on a project where web2py will be used as a online/ offline frontent for mobile users ufor our ERP System. The communication from web2py to the backend system is implemented with the soap library suds. Now i am at the point to deal with exchanging files (pdf, pictures ). Within python i am able to get files from the backend system: - from suds.client import Client import base64 urlmobileservice = URL2WDSL mobileservice = Client(urlmobileservice) getdok = mobileservice.service.ZMsGetDokuFiles(SERVICEPARAMETERS) converted=base64.standard_b64decode(getdok.FileXsring) filename = /tmp/test.pdf file = open(filename, 'w') file.write(converted) file.close The file is saved correctly on the filesystem. Within web2py i would like to save the document (getdok) within the database as blob. Until now i did not find a proper way to store and retrieve this documents. Any examples ? Stefan- Zitierten Text ausblenden - - Zitierten Text anzeigen -
[web2py] contribute de-de (german) language file
i only wanna know if there is an interest for a german (admin) language file? for a little project i am doing with w2p (a mockup prototype) it is necessary to translate and change the admin interface. i am almost done and wonder if it is somehow useful ? (after clearing to be useful to a normal/unchanged w2p) its based on the spanish translation. btw i think i've found some texts which are not modifiable/translatable cuz there is no use of T() but plain text (thats from my memory i investigate this more accurate if im at home ) ... But that's another story suggestions?
Re: [web2py] Re: let user choose it membership
Here new version! - It check if user is allowed to change his role. - It protect in case the membership of the user is allowed to modify does not exist - It protect also in case the allowed group set is not define for a particular user (new table auth_group_allowed) What to do : Add this model : db.define_table('auth_group_allowed', Field('id','id'), Field('user_id','db.auth_user'), Field('group_id','db.auth_group'), Field('active_gr','boolean'), migrate=False, sequence_name='auth_group_allowed_id_seq') db.auth_group_allowed.user_id.requires=IS_IN_DB(db,'auth_user.id','%(first_name)s %(last_name)s (%(id)s)') db.auth_group_allowed.group_id.requires=IS_IN_DB(db,'auth_group.id','%(role)s (%(id)s)') For convenience add representation for auth_membership table : db.auth_membership.user_id.represent=\ lambda value: %(first_name)s %(last_name)s (%(id)s) %db.auth_user[value] db.auth_membership.group_id.represent=\ lambda value: %(role)s (%(id)s) %db.auth_group[value] Then this controller do the job : def chmembershiptr(): if auth.has_membership(auth.id_group('chrole')): try: if db(db.auth_group_allowed.user_id==auth.user.id)\ .select(db.auth_group_allowed.user_id,distinct=True).first().user_id== auth.user.id: active_gr=db((db.auth_group_allowed.user_id==auth.user.id)\ (db.auth_group_allowed.active_gr=='TRUE'))\ .select(db.auth_group_allowed.group_id).first().group_id try: if db((db.auth_membership.group_id==active_gr)\ (db.auth_membership.user_id==auth.user.id))\ .select(db.auth_membership.user_id).first().user_id==auth.user.id: rows=db(db.auth_group_allowed.user_id== auth.user.id).select(db.auth_group_allowed.group_id) groupSet={} for row in rows: authgrouprole=db(db.auth_group.id ==row.group_id).select(db.auth_group.role).first().role groupSet[row.group_id]=authgrouprole chmbshp = SQLFORM.factory( Field('user_id', writable=False, readable=False), Field('group_id', requires=IS_IN_SET(groupSet),\ widget=SQLFORM.widgets.radio.widget,\ default=active_gr)) if chmbshp.accepts(request.vars, session, keepvalues=True): response.flash = T('form accepted') db((db.auth_group_allowed.user_id== auth.user.id)\ (db.auth_group_allowed.active_gr=='TRUE')).update(active_gr='FALSE') db((db.auth_group_allowed.user_id== auth.user.id)\ (db.auth_group_allowed.group_id==chmbshp.vars.group_id)).update(active_gr='TRUE') db((db.auth_membership.group_id==active_gr)\ (db.auth_membership.user_id==auth.user.id ))\ .update(group_id=chmbshp.vars.group_id) elif chmbshp.errors: response.flash = T('form has errors') return dict(chmbshp=chmbshp) except AttributeError: return dict(chmbshp='You are not allowed (Permission denied : sync role)') except AttributeError: return dict(chmbshp='You are not allowed (Permission denied : no alternate role)') else: return dict(chmbshp='You are not allowed (Permission denied : chrole)') I will try to make a web2py slice in the near future... Any suggestions are wellcome. Now I must find a way to tell the user which group he is permanently Richard On Thu, Sep 23, 2010 at 4:26 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: New solution much cleaner since the user does not needing to edit the auth_membership table : def chmembershiptr(): try: if db(db.auth_group_allowed.user_id==auth.user.id)\ .select(db.auth_group_allowed.user_id,distinct=True).first().user_id== auth.user.id: if auth.has_membership(auth.id_group('technician'))\ or auth.has_membership(auth.id_group('coordinator'))\ or auth.has_membership(auth.id_group('admin')): active_gr=db((db.auth_group_allowed.user_id==auth.user.id )\ (db.auth_group_allowed.active_gr=='TRUE'))\ .select(db.auth_group_allowed.group_id).first().group_id membershipID=db((db.auth_membership.group_id==active_gr)\ (db.auth_membership.user_id== auth.user.id))\ .select(db.auth_membership.id).first().id rows=db(db.auth_group_allowed.user_id==auth.user.id
Re: [web2py] Re: export text to Office?
You can try POD ( Python Open Document) http://appyframework.org/pod.html 2010/9/24 Timmie timmichel...@gmx-topmail.de web2py includes pyRTF to generate Rich Text Format. Look into gluon/contrib/pyrtf/ I know. But can this also modify page headline and footer? Test the module I recommended. The example document looks very nice. I know that Sahana is also doings something along these lines but they have a decent XML processing engine behind, AFAIK. -- http://rochacbruno.com.br
[web2py] Re: welcome app normalize hack ie and html5 ready
1) it no longer uses ez.css for layout (id had the options for left and right sidebars for example) now fixed. see http://web2pytesting.appspot.com/sidebars/default/index The lines are commented in layout, to get working have to uncomment sidebar-right and sidebar-left !--div id=left_sidebarhere content of sidebar left/div-- div id=content{{include}}/div !--div id=right_sidebarhere content of sidebar left/div -- and in base.css have to uncomment in content #left_sidebar { width: 130px; float:left; } #content { /*width: 640px; float:left;*/ } /* uncomment this if you are going to use sidebars */ #right_sidebar { width: 130px; float:left; text-align:right; } 2) there is extra space between header-manu, menu-content, content- footer. If a user were to replace the header background with an image, there would a separation with the menu bar for example... now fixed. see: http://web2pytesting.appspot.com/background/default/index 3) I would still like the flash to be black because works ... fixed. this is the welcome: http://web2pytesting.appspot.com/welcome/ this is the source: http://web2pytesting.appspot.com/welcome/static/welcome.zip http://web2pytesting.appspot.com/welcome/static/welcome.w2p On Sep 23, 6:46 pm, Martin.Mulone mulone.mar...@gmail.com wrote: Ok this is what i want to know, i'll going to fix tomorrow. On Sep 23, 6:13 pm, rochacbruno rochacbr...@gmail.com wrote: Sidebars are there to be used with plugin_wiki that has meta-sidebar Enviado via iPhone Em 23/09/2010, às 18:09, Martin.Mulone mulone.mar...@gmail.com escreveu: last thing you have to reaload F5 because of cache browser or use http://web2pytesting.appspot.com/welcome2/ On Sep 23, 6:06 pm, Martin.Mulone mulone.mar...@gmail.com wrote: Version 2.0 * About validation, this almost validate in html5 but one thing that is important, that force to last ie renderhttp://validator.w3.org/check?uri=web2pytesting.appspot.comcharset=(... * About validation in css, well i prefer that show correct and good in all browser, than to validate correct. This is because of the hacks. Believe me is good to close to almost validate but not a must. Validate is: hey your are a good guy, but in real life you have the ie things, -moz and -wkit. I am ready to discuss, the things i changes. Some perhaps breaks compatibility with old welcome, but this is not important because scattfold app are for new ones. The main changes comes in layout.html, web2py_ajax.html, and base.css. You have to read this files, some are well documented in comments. Some explained here:http://www.1stwebdesigner.com/development/snippets-html5-boilerplate/ well the evil one, i make order in static/ so i put css in static/ css/, js in static/js/ and images in static/images/. Its good to have in order this things. this is static now: css/ (css dir) favicon.ico (this display icon in browser, i add transparency) favicon.png (this display icon in browser, iphone) images/ (images) js/ (javascripts) robots.txt (to control robots) css/ base.css (the main base style) calendar.css handheld.css (this is for mobile style) superfish.css (this is menu style) superfish-navbar.css superfish-vertical.css images/ arrows-ff.png (menu need this) mylogo.png (this is app logo) noti_error.png (notification icon) noti_ok.png (notification icon) noti_warn.png (notification icon) shadow.png (menu need this) warning.png (pretty exception need this) web2py_icon.png (I add transparency to web2py icon) js/ calendar.js dd_belatedpng.js (this fix issue:png tranparency in ie) jquery.js modernizr-1.5.min.js (this enabled html5) plugins.js (here perhaps the app plugins) script.js (here perhaps the app scripts) superfish.js * As suggest massimo i put black back in notifications. * I re enabled ez-css things to compatibility. But i dont understand why are sidebar-left and sidebar-right are if they not are used. Width 0 not means hide div, so i do not recommend this, this need to be as display: none; if not used. If this break things, ok i understand. * I re download superfish.js from site i dont have missings images thats this need. Now there are superfish.css for this things. * Added pretty_exceptions function in models/utils.py, when you raise http show a better exception page see in action here:http://web2pytesting.appspot.com/welcome/default/test_exception, this is an example perhaps need to be commented in controller. * in ajax_web2py i change that jquery download from online site prepared to serve this much faster anywhere, but if fails load the local version. * Some SEO things in layout, like analytics, meta tags specifics, robots etc. * Believe me this little things are need it, and perhaps a lot of more. Tomorrow i am
[web2py] db.table.truncate() does not reset the id
I read in the manual: You can truncate the table, i.e., delete all records and reset the counter of the id. My experience is that it deletes all the records but does not resent the counter of the id. I did the following: Export a table to a csv-file. Truncate the table. db.commit() Edit the csv-file, made corrections and set all the id's to 0. Then I imported the csv-file into the empty table. The id-numbers allocated started at one higher than the previous highest. Has something changed? Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a
[web2py] Re: database question
If a store can only be in one region then you don't need a many to many relation expressed by intermediate table store_region. Instead just put a region_id field in store referencing the region table forming a one to many relation from region to store. You may have a reason for a many to many relation that is not stated here but if you don't it makes the solution more complicated than it needs to be which is why I mention it here. On Sep 23, 11:49 am, rick ricon...@gmail.com wrote: Hi, I'm having trouble figuring out the syntax for this type of database inquiry. I have three tables: 1) stores, which has a name 2) regions, which has a 2-letter abbreviation 3) store-region, which puts stores in certain regions. I want to pass in a 2-letter region abbreviation, and receive back the names of the stores in that region. So I need to use the results of one query (regions with the abbreviation NY, say), to get another set of results (store ids with that region id), to get the third set of results (stores names that matched the store ids) Thanks for reading..
Re: [web2py] Re: how to use web2py planet?
On Fri, Sep 24, 2010 at 8:37 AM, Timmie timmichel...@gmx-topmail.de wrote: There is a cron job that fetches rss posts, and you could call If I understand the crontab correctly the server should fetch new posts every minute, correct? This does not happen. Mmm, maybe a cron configuration problem. I did have some issues with that too (using apache / external cron) A workaround is to add a wget .../refresh to the o.s. crontab to force updates. refresh() controller to force update. manually calling refresh updates the planet feeds page without problems. I could see a redirect from the refresh page to the index page after successful refresh... refresh is not meant to be called by end users, that's why it hasn't a nice view nor redirects. Do you have a demo installed somewhere? Yes: http://www.web2py.com.ar/planet http://web2py.arpug.com.ar/planeta How do you indeted to have new feeds added? Via the appadmin or the /default/user page? By now, using appadmin. Although, a CRUD interface would be nice thing (and very easy to add) Best regards, Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com
[web2py] Re: welcome app normalize hack ie and html5 ready
Looking great. I'm not sure I'm crazy about the darker blue background of the menus -- I think the original gray looked good, or maybe the lighter blue of the active menu title. I also liked the horizontal lines in between the menu items. Also, at first I was confused by the gray menu items -- it took me a bit to realize those were previously visited links (particularly since I hadn't visted them from this app). I wonder if we need that distinction within menus -- or at least if it could be made less distinct (the gray made me think not available rather than previously visited). Thanks so much for your work. Anthony On Sep 24, 11:12 am, Martin.Mulone mulone.mar...@gmail.com wrote: 1) it no longer uses ez.css for layout (id had the options for left and right sidebars for example) now fixed. seehttp://web2pytesting.appspot.com/sidebars/default/index The lines are commented in layout, to get working have to uncomment sidebar-right and sidebar-left !--div id=left_sidebarhere content of sidebar left/div-- div id=content{{include}}/div !--div id=right_sidebarhere content of sidebar left/div -- and in base.css have to uncomment in content #left_sidebar { width: 130px; float:left; } #content { /*width: 640px; float:left;*/ } /* uncomment this if you are going to use sidebars */ #right_sidebar { width: 130px; float:left; text-align:right; } 2) there is extra space between header-manu, menu-content, content- footer. If a user were to replace the header background with an image, there would a separation with the menu bar for example... now fixed. see:http://web2pytesting.appspot.com/background/default/index 3) I would still like the flash to be black because works ... fixed. this is the welcome:http://web2pytesting.appspot.com/welcome/ this is the source:http://web2pytesting.appspot.com/welcome/static/welcome.ziphttp://web2pytesting.appspot.com/welcome/static/welcome.w2p On Sep 23, 6:46 pm, Martin.Mulone mulone.mar...@gmail.com wrote: Ok this is what i want to know, i'll going to fix tomorrow. On Sep 23, 6:13 pm, rochacbruno rochacbr...@gmail.com wrote: Sidebars are there to be used with plugin_wiki that has meta-sidebar Enviado via iPhone Em 23/09/2010, às 18:09, Martin.Mulone mulone.mar...@gmail.com escreveu: last thing you have to reaload F5 because of cache browser or use http://web2pytesting.appspot.com/welcome2/ On Sep 23, 6:06 pm, Martin.Mulone mulone.mar...@gmail.com wrote: Version 2.0 * About validation, this almost validate in html5 but one thing that is important, that force to last ie renderhttp://validator.w3.org/check?uri=web2pytesting.appspot.comcharset=(... * About validation in css, well i prefer that show correct and good in all browser, than to validate correct. This is because of the hacks. Believe me is good to close to almost validate but not a must. Validate is: hey your are a good guy, but in real life you have the ie things, -moz and -wkit. I am ready to discuss, the things i changes. Some perhaps breaks compatibility with old welcome, but this is not important because scattfold app are for new ones. The main changes comes in layout.html, web2py_ajax.html, and base.css. You have to read this files, some are well documented in comments. Some explained here:http://www.1stwebdesigner.com/development/snippets-html5-boilerplate/ well the evil one, i make order in static/ so i put css in static/ css/, js in static/js/ and images in static/images/. Its good to have in order this things. this is static now: css/ (css dir) favicon.ico (this display icon in browser, i add transparency) favicon.png (this display icon in browser, iphone) images/ (images) js/ (javascripts) robots.txt (to control robots) css/ base.css (the main base style) calendar.css handheld.css (this is for mobile style) superfish.css (this is menu style) superfish-navbar.css superfish-vertical.css images/ arrows-ff.png (menu need this) mylogo.png (this is app logo) noti_error.png (notification icon) noti_ok.png (notification icon) noti_warn.png (notification icon) shadow.png (menu need this) warning.png (pretty exception need this) web2py_icon.png (I add transparency to web2py icon) js/ calendar.js dd_belatedpng.js (this fix issue:png tranparency in ie) jquery.js modernizr-1.5.min.js (this enabled html5) plugins.js (here perhaps the app plugins) script.js (here perhaps the app scripts) superfish.js * As suggest massimo i put black back in notifications. * I re enabled ez-css things to compatibility. But i dont understand why are sidebar-left and sidebar-right are if they not are used. Width 0 not means hide div, so i do not recommend this, this need to be as display: none;
Re: [web2py] Re: welcome app normalize hack ie and html5 ready
On Sep 24, 2010, at 8:12 AM, Martin.Mulone wrote: 3) I would still like the flash to be black because works ... fixed. this is the welcome: http://web2pytesting.appspot.com/welcome/ With all that white space in the header, could you move the flash somewhere (centered, perhaps?) where it doesn't obscure the auth links? Also, I'd be inclined to reduce the height of the top bar (margin-top of #statusbar). Nit: both sidbars say sidebar left.
Re: [web2py] Re: welcome app normalize hack ie and html5 ready
On Sep 24, 2010, at 8:57 AM, Anthony wrote: Looking great. I'm not sure I'm crazy about the darker blue background of the menus -- I think the original gray looked good, or maybe the lighter blue of the active menu title. I also liked the horizontal lines in between the menu items. I'm not so concerned about the colors as that it's simple and easy to change. It would be nice to see how the menu system handles a second level, assuming it does so. Also, at first I was confused by the gray menu items -- it took me a bit to realize those were previously visited links (particularly since I hadn't visted them from this app). I wonder if we need that distinction within menus -- or at least if it could be made less distinct (the gray made me think not available rather than previously visited). Agreed; the previously-visited convention is jarring in a menu.
Re: [web2py] Re: let user choose it membership
Hello, There is still problem with the design... The function is not protecting from the definition of group set that could include an other group the in which the user is already involved. The user is allowed to change from only one group, so if we use other groups for other purpose (like restricting entry of dropbox) it important to not include those other group in the group set in auth_group_allowed. I am asking myself if a task base privilege could not be better. I mean the user has all the privilege he needs, but depending of the task he needs to do, he could be restricted by a given function to certain actions... Richard On Fri, Sep 24, 2010 at 10:19 AM, Richard Vézina ml.richard.vez...@gmail.com wrote: Here new version! - It check if user is allowed to change his role. - It protect in case the membership of the user is allowed to modify does not exist - It protect also in case the allowed group set is not define for a particular user (new table auth_group_allowed) What to do : Add this model : db.define_table('auth_group_allowed', Field('id','id'), Field('user_id','db.auth_user'), Field('group_id','db.auth_group'), Field('active_gr','boolean'), migrate=False, sequence_name='auth_group_allowed_id_seq') db.auth_group_allowed.user_id.requires=IS_IN_DB(db,'auth_user.id','%(first_name)s %(last_name)s (%(id)s)') db.auth_group_allowed.group_id.requires=IS_IN_DB(db,'auth_group.id','%(role)s (%(id)s)') For convenience add representation for auth_membership table : db.auth_membership.user_id.represent=\ lambda value: %(first_name)s %(last_name)s (%(id)s) %db.auth_user[value] db.auth_membership.group_id.represent=\ lambda value: %(role)s (%(id)s) %db.auth_group[value] Then this controller do the job : def chmembershiptr(): if auth.has_membership(auth.id_group('chrole')): try: if db(db.auth_group_allowed.user_id==auth.user.id)\ .select(db.auth_group_allowed.user_id,distinct=True).first().user_id== auth.user.id: active_gr=db((db.auth_group_allowed.user_id==auth.user.id )\ (db.auth_group_allowed.active_gr=='TRUE'))\ .select(db.auth_group_allowed.group_id).first().group_id try: if db((db.auth_membership.group_id==active_gr)\ (db.auth_membership.user_id==auth.user.id))\ .select(db.auth_membership.user_id).first().user_id==auth.user.id: rows=db(db.auth_group_allowed.user_id== auth.user.id).select(db.auth_group_allowed.group_id) groupSet={} for row in rows: authgrouprole=db(db.auth_group.id ==row.group_id).select(db.auth_group.role).first().role groupSet[row.group_id]=authgrouprole chmbshp = SQLFORM.factory( Field('user_id', writable=False, readable=False), Field('group_id', requires=IS_IN_SET(groupSet),\ widget=SQLFORM.widgets.radio.widget,\ default=active_gr)) if chmbshp.accepts(request.vars, session, keepvalues=True): response.flash = T('form accepted') db((db.auth_group_allowed.user_id== auth.user.id)\ (db.auth_group_allowed.active_gr=='TRUE')).update(active_gr='FALSE') db((db.auth_group_allowed.user_id== auth.user.id)\ (db.auth_group_allowed.group_id==chmbshp.vars.group_id)).update(active_gr='TRUE') db((db.auth_membership.group_id==active_gr)\ (db.auth_membership.user_id== auth.user.id))\ .update(group_id=chmbshp.vars.group_id) elif chmbshp.errors: response.flash = T('form has errors') return dict(chmbshp=chmbshp) except AttributeError: return dict(chmbshp='You are not allowed (Permission denied : sync role)') except AttributeError: return dict(chmbshp='You are not allowed (Permission denied : no alternate role)') else: return dict(chmbshp='You are not allowed (Permission denied : chrole)') I will try to make a web2py slice in the near future... Any suggestions are wellcome. Now I must find a way to tell the user which group he is permanently Richard On Thu, Sep 23, 2010 at 4:26 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: New solution much cleaner since the user does not needing to edit the auth_membership table : def chmembershiptr(): try: if db(db.auth_group_allowed.user_id==auth.user.id)\
[web2py] Re: welcome app normalize hack ie and html5 ready
hi, i followed your topic and your work is pleasing to the eye :) thx for that! but i also agree with the others about that menu gray visited links thing.
[web2py] Re: how to use web2py planet?
Mmm, maybe a cron configuration problem. I did have some issues with that too (using apache / external cron) A workaround is to add a wget .../refresh to the o.s. crontab to force updates. Would you consider this as a bug in cron?
Re: [web2py] Re: how to use web2py planet?
On Fri, Sep 24, 2010 at 3:23 PM, Tim Michelsen timmichel...@gmx-topmail.de wrote: Mmm, maybe a cron configuration problem. I did have some issues with that too (using apache / external cron) A workaround is to add a wget .../refresh to the o.s. crontab to force updates. Would you consider this as a bug in cron? I don't know, I didn't devote enough time to debug and confirm it, maybe I'm missing something in my server setup or anything else. Can you post your findings? (best if done in a separate particular thread) Best regards, Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com
[web2py] JQuery plugin
Hi, I'd like to make a button that generates a sound when clicking on it. This JQuery plugin was the best way I could found: http://plugins.jquery.com/project/sound and I wrote this code: views/default/index.html: {{extend 'layout.html'}} div onClick=jQuery(this).sound.play(/static/success.wav) /div views/layout.html: head {{response.files.append(URL(r=request,c='static',f='jquery.sound.js'))}} /head Since I'm totally new to JQuery I understand that this is completely wrong. Could anyone tell me how it should look like, please?
Re: [web2py] JQuery plugin
You should append JS files before the {{include 'web2py_ajax.html'}} views/layout.html: head {{response.files.append(URL(r=request,c='static',f='jquery.sound.js'))}} {{include 'web2py_ajax.html'}} /head and in your div the OnClick event is used in the wrong way, it is not recommended to use onclick event in a div, you should use a,span or another element, and the file URL should be build with URL helper: views/default/index.html: {{extend 'layout.html'}} div span onclick=jQuery(this).sound.play({{=URL('static',args='success.wav')}}) Click here to listen the sound /span /div 2010/9/24 Rick sababa.sab...@gmail.com Hi, I'd like to make a button that generates a sound when clicking on it. This JQuery plugin was the best way I could found: http://plugins.jquery.com/project/sound and I wrote this code: views/default/index.html: {{extend 'layout.html'}} div onClick=jQuery(this).sound.play(/static/success.wav) /div views/layout.html: head {{response.files.append(URL(r=request,c='static',f='jquery.sound.js'))}} /head Since I'm totally new to JQuery I understand that this is completely wrong. Could anyone tell me how it should look like, please? -- http://rochacbruno.com.br
[web2py] Re: JQuery plugin
Thanks! I think there are better plugins for this purpose than this sound- plugin. But now I know how to install it into my application. On Sep 24, 8:26 pm, Bruno Rocha rochacbr...@gmail.com wrote: You should append JS files before the {{include 'web2py_ajax.html'}} views/layout.html: head {{response.files.append(URL(r=request,c='static',f='jquery.sound.js'))}} {{include 'web2py_ajax.html'}} /head and in your div the OnClick event is used in the wrong way, it is not recommended to use onclick event in a div, you should use a,span or another element, and the file URL should be build with URL helper: views/default/index.html: {{extend 'layout.html'}} div span onclick=jQuery(this).sound.play({{=URL('static',args='success.wav')}}) Click here to listen the sound /span /div 2010/9/24 Rick sababa.sab...@gmail.com Hi, I'd like to make a button that generates a sound when clicking on it. This JQuery plugin was the best way I could found: http://plugins.jquery.com/project/sound and I wrote this code: views/default/index.html: {{extend 'layout.html'}} div onClick=jQuery(this).sound.play(/static/success.wav) /div views/layout.html: head {{response.files.append(URL(r=request,c='static',f='jquery.sound.js'))}} /head Since I'm totally new to JQuery I understand that this is completely wrong. Could anyone tell me how it should look like, please? -- http://rochacbruno.com.br
Re: [web2py] Re: JQuery plugin
You can use the new audio tag from HTML5, but this should not work on every browser audio src={{=URL('static',args='horse.ogg')}} controls=controls Your browser does not support the audio element. /audio 2010/9/24 Rick sababa.sab...@gmail.com Thanks! I think there are better plugins for this purpose than this sound- plugin. But now I know how to install it into my application. On Sep 24, 8:26 pm, Bruno Rocha rochacbr...@gmail.com wrote: You should append JS files before the {{include 'web2py_ajax.html'}} views/layout.html: head {{response.files.append(URL(r=request,c='static',f='jquery.sound.js'))}} {{include 'web2py_ajax.html'}} /head and in your div the OnClick event is used in the wrong way, it is not recommended to use onclick event in a div, you should use a,span or another element, and the file URL should be build with URL helper: views/default/index.html: {{extend 'layout.html'}} div span onclick=jQuery(this).sound.play({{=URL('static',args='success.wav')}}) Click here to listen the sound /span /div 2010/9/24 Rick sababa.sab...@gmail.com Hi, I'd like to make a button that generates a sound when clicking on it. This JQuery plugin was the best way I could found: http://plugins.jquery.com/project/sound and I wrote this code: views/default/index.html: {{extend 'layout.html'}} div onClick=jQuery(this).sound.play(/static/success.wav) /div views/layout.html: head {{response.files.append(URL(r=request,c='static',f='jquery.sound.js'))}} /head Since I'm totally new to JQuery I understand that this is completely wrong. Could anyone tell me how it should look like, please? -- http://rochacbruno.com.br -- http://rochacbruno.com.br
[web2py] Re: JQuery plugin
Or you could use unobtrusive Javascript http:// www.smashingmagazine.com/2008/09/16/jquery-examples-and-best-practices/, where onClick isn't necessary in the HTML because it's inserted by jQuery. On Sep 24, 4:42 pm, Bruno Rocha rochacbr...@gmail.com wrote: You can use the new audio tag from HTML5, but this should not work on every browser audio src={{=URL('static',args='horse.ogg')}} controls=controls Your browser does not support the audio element. /audio 2010/9/24 Rick sababa.sab...@gmail.com Thanks! I think there are better plugins for this purpose than this sound- plugin. But now I know how to install it into my application. On Sep 24, 8:26 pm, Bruno Rocha rochacbr...@gmail.com wrote: You should append JS files before the {{include 'web2py_ajax.html'}} views/layout.html: head {{response.files.append(URL(r=request,c='static',f='jquery.sound.js'))}} {{include 'web2py_ajax.html'}} /head and in your div the OnClick event is used in the wrong way, it is not recommended to use onclick event in a div, you should use a,span or another element, and the file URL should be build with URL helper: views/default/index.html: {{extend 'layout.html'}} div span onclick=jQuery(this).sound.play({{=URL('static',args='success.wav')}}) Click here to listen the sound /span /div 2010/9/24 Rick sababa.sab...@gmail.com Hi, I'd like to make a button that generates a sound when clicking on it. This JQuery plugin was the best way I could found: http://plugins.jquery.com/project/sound and I wrote this code: views/default/index.html: {{extend 'layout.html'}} div onClick=jQuery(this).sound.play(/static/success.wav) /div views/layout.html: head {{response.files.append(URL(r=request,c='static',f='jquery.sound.js'))}} /head Since I'm totally new to JQuery I understand that this is completely wrong. Could anyone tell me how it should look like, please? -- http://rochacbruno.com.br -- http://rochacbruno.com.br
[web2py] Re: welcome app normalize hack ie and html5 ready
I already fix this issue, and put the notification more centre. You can see the changes in: Html5 test font and edit content http://web2pytesting.appspot.com/html5 And the notification example http://web2pytesting.appspot.com/notification/ On Sep 24, 2:34 pm, dustin.b dustin.bens...@googlemouail.com wrote: hi, i followed your topic and your work is pleasing to the eye :) thx for that! but i also agree with the others about that menu gray visited links thing.
Re: [web2py] Re: welcome app normalize hack ie and html5 ready
On Sep 24, 2010, at 3:05 PM, Martin.Mulone wrote: I already fix this issue, and put the notification more centre. Nice. The web2py flash is a slightly difficult design problem, in that its size is rather unpredictable. I like Gmail's approach of reserving a bit of space for their flash to appear, but they're able to guarantee that it'll always be one short line, so it works for them. You can see the changes in: Html5 test font and edit content http://web2pytesting.appspot.com/html5 And the notification example http://web2pytesting.appspot.com/notification/ On Sep 24, 2:34 pm, dustin.b dustin.bens...@googlemouail.com wrote: hi, i followed your topic and your work is pleasing to the eye :) thx for that! but i also agree with the others about that menu gray visited links thing.
[web2py] Re: JQuery plugin
Assuming that you know how to create sound effects in regular Javascript, making your own pluggin for it doesn't seem that difficult. Lets assume that you want a pluggin that affect only div elements in a wrapped set and you want to be able to specify the sound... It'd look something like this (note that this is a quick-and-dirty piece of code... totally untested): {function($){ $.fn.AddSoundOnClick = function(SoundEffect) { return this.filter('div').bind('click',function(event){ //Stick the logic to emit the sound effect here }).end(); }; })(jQuery); Afterwards, lets say that you have a sound effect stored in the variable CowSound and a div with class SoundDiv, you could add the cow sound like this: jQuery('div.SoundDiv').AddSoundOnClick(CowSound); Here's terrific book for jQuery: http://www.amazon.ca/jQuery-Action-Second-Bear-Bibeault/dp/1935182323/ref=sr_1_1?ie=UTF8s=booksqid=1285384287sr=8-1 If you're serious about using jQuery properly, it'll be the best 30$ you ever spent. Sure learned a lot from it. On Sep 24, 4:13 pm, Rick sababa.sab...@gmail.com wrote: Hi, I'd like to make a button that generates a sound when clicking on it. This JQuery plugin was the best way I could found:http://plugins.jquery.com/project/sound and I wrote this code: views/default/index.html: {{extend 'layout.html'}} div onClick=jQuery(this).sound.play(/static/success.wav) /div views/layout.html: head {{response.files.append(URL(r=request,c='static',f='jquery.sound.js'))}} /head Since I'm totally new to JQuery I understand that this is completely wrong. Could anyone tell me how it should look like, please?
[web2py] Question about CRUD forms and compute values
Dear all, The question is that I have a compute value defined on my model this way: Field('n_lote', compute = lambda r: str(r['fecha']).replace(-, ) + str(r['cliente_id']), required = True) When I try to make a form from my controller to read the record on the database table, like this: form = crud.read(db.entradas, request.args(0)) The form is created, but, and here it comes the problem, the compute field n_lote is not shown. Why is that? How can I make CRUD to show it on the form? thanks a lot for all your help and kind regards, Bernardo
Re: [web2py] Re: welcome app normalize hack ie and html5 ready
Greetings, there is an option select multiple problems. should have at least 5 lines minimum to select various options to see -- Díaz Luis TSU Analisis de Sistemas Universidad de Carabobo
[web2py] Re: Store and retrieve blob
How are you retrieving it? Are you setting a content type and content disposition in the header? On Sep 24, 8:41 am, winti stefan.winterb...@gmail.com wrote: Thank you massimo, this i tried allready and could store the data but not retrieve in a usefull format... How is it possible for downloading this stored file in field b providing the user a link within web2py ? I allways get rubish back or a huge url with the data stored within this field. Stefan On 24 Sep., 15:21, mdipierro mdipie...@cs.depaul.edu wrote: if you have db.define_table('a',Field('b','blob')) db.a.insert(b=converted) On Sep 24, 4:34 am, winti stefan.winterb...@gmail.com wrote: Hello, i am working on a project where web2py will be used as a online/ offline frontent for mobile users ufor our ERP System. The communication from web2py to the backend system is implemented with the soap library suds. Now i am at the point to deal with exchanging files (pdf, pictures ). Within python i am able to get files from the backend system: - from suds.client import Client import base64 urlmobileservice = URL2WDSL mobileservice = Client(urlmobileservice) getdok = mobileservice.service.ZMsGetDokuFiles(SERVICEPARAMETERS) converted=base64.standard_b64decode(getdok.FileXsring) filename = /tmp/test.pdf file = open(filename, 'w') file.write(converted) file.close The file is saved correctly on the filesystem. Within web2py i would like to save the document (getdok) within the database as blob. Until now i did not find a proper way to store and retrieve this documents. Any examples ? Stefan- Zitierten Text ausblenden - - Zitierten Text anzeigen -
[web2py] Re: db.table.truncate() does not reset the id
It incorrect in the manual. On Sep 24, 10:27 am, Johann Spies johann.sp...@gmail.com wrote: I read in the manual: You can truncate the table, i.e., delete all records and reset the counter of the id. My experience is that it deletes all the records but does not resent the counter of the id. I did the following: Export a table to a csv-file. Truncate the table. db.commit() Edit the csv-file, made corrections and set all the id's to 0. Then I imported the csv-file into the empty table. The id-numbers allocated started at one higher than the previous highest. Has something changed? Regards Johann -- May grace and peace be yours in abundance through the full knowledge of God and of Jesus our Lord! His divine power has given us everything we need for life and godliness through the full knowledge of the one who called us by his own glory and excellence. 2 Pet. 1:2b,3a