Re: [web2py] Re: Help with db query

2012-11-09 Thread Wikus van de Merwe
Assuming that request.args contains the right values, this should work: category = request.args[1].replace('_', ' ') query = (db.Supplements.Category == category) ((db.Supplements.Users == request.args[0]) | (db.Supplements.Users == Both)) records = db(query).select() Notes: - contains does

[web2py] Re: How to create long running tasks?

2012-11-06 Thread Wikus van de Merwe
Use the scheduler. It runs as an *independent* process. If the web server is running or not have no influence on the scheduler. Read more here: http://web2py.com/books/default/chapter/29/04?search=scheduler#Scheduler-%28experimental%29 --

Re: [web2py] Re: Routes - simple requirement, but how??

2012-07-03 Thread Wikus van de Merwe
You right, the prefix is what makes possible to use the same plugin code across many apps. Setting the alias for the plugin manager sounds like a good solution to me. from gluon.tools import PluginManager plugins = PluginManager() plugins.wiki.path = wiki

[web2py] Re: Routes - simple requirement, but how??

2012-07-02 Thread Wikus van de Merwe
I might be missing something but it looks to me that there is a very simple solution to your problem. Rename the controller from plugin_wiki to pretty_url. Then use the following routes.py: routers = dict( app1 = dict( domain = domain1.com, default_controller = default,

[web2py] Re: A page served by two different backends

2012-07-02 Thread Wikus van de Merwe
Your description is very confusing. Static content are the files that are not dynamically generated but simply served over the network, e.g. images, javascript, css. If you generate an HTML page using a view (template) and filling it with data from DB, that is a dynamic page generation. Now,

[web2py] Re: Routing help

2012-05-18 Thread Wikus van de Merwe
OK, so you want /myapp/args to be mapped to /myapp/default_controller/default_function/args. By default args would be interpreted as a function name and will be mapped to /myapp/default_controller/args. To change that you need to define a list of functions for the default controller. Then if

[web2py] Re: External lib import issue ( opencv )

2012-05-16 Thread Wikus van de Merwe
Where is the opencv installed in your system? When you check python interpreters in PyDev options is that path on the list? If you still struggling with it, a workaround could be to add the installation folder to the system path by hand: import sys sys.path.append(opencv)

[web2py] Re: GAE datastore: how to unindex a field?

2012-05-16 Thread Wikus van de Merwe
This is really a GAE question, not related to web2py. By default the indexes are set automatically when you run your app in dev environment depending on what queries you use. But you can do it manually to by editing the index.yaml (above the #AUTOGENERATED line). On the next deploy the indexes

[web2py] Re: How to intervene in web2py's upload process(store/retrieve/stream...) to do something with uploaded file?

2012-05-01 Thread Wikus van de Merwe
I think you need to customize the functions for storing/retrieving the uploaded file. In you model add: Field(myfile, upload, custom_store=store_myfile, custom_retrieve=retrieve_myfile) Then implement the functions: def store_myfile(uploaded_file, filename=None, path=None): buffer =

[web2py] Re: how can one replace an element in html?

2012-04-23 Thread Wikus van de Merwe
So you have an HTML code as input and would like to change some tags to some others ones. But why? You should never had the need to build the HTML page from another HTML page in web2py. You should rather simply combine the data and a view. In your example, the view could be this: pages.css

[web2py] Re: scheduler advanced question

2012-04-23 Thread Wikus van de Merwe
You can set the desired logging level in the logging.conf: [logger_scheduler] level=DEBUG handlers=consoleHandler qualname=scheduler propagate=0 If that doesn't help, you could try to play with the -D and -l options of web2py.py, To instantiate the object once, you could implement the class

[web2py] Re: CRON tasks in Google App Engine

2012-04-20 Thread Wikus van de Merwe
Not directly. You can't execute scripts on GAE, so you would have to move the checking/sending code into a controller function and set up the GAE cron to call it periodically. However, it might be easier to use the GAE queues and to delegate e-mail sending to a background task:

[web2py] Re: web2py doesn't seem to be picking up posted json

2012-04-20 Thread Wikus van de Merwe
How do you post it? I'm guessing this is the part that needs fixing.

Re: [web2py] Re: Web2py + Python 2.7 on GAE: Can I use PIL and resize an image when uploading to datastore?

2012-04-20 Thread Wikus van de Merwe
I would just queue the image processing task (using GAE queue) to have the work done in the background. Doing it right when the form is submitted is possible too but will cause delays to the user. You could insert a logo by converting the image into uncompressed format (e.g. bmp), modifying

Re: [web2py] Re: routes.py

2012-04-20 Thread Wikus van de Merwe
OK, so if I define the list of function, the situation is clear. If I don't and I want to pass arguments to the default function I need to use the default function name (/default_function/arg). Arguments alone (/arg) in that case would be treated as if it is a function name (even if it does not

[web2py] Re: Memory leak in standalone DAL (issue #731), can you please help test?

2012-04-19 Thread Wikus van de Merwe
I've tested in on Ubuntu 11.04, with web2py 1.99.2 and trunk and in both cases after 35s the memory use is 1GB and growing. Same results with DAL(sqlite://storage.db).

[web2py] Re: Web2py + Python 2.7 on GAE: Can I use PIL and resize an image when uploading to datastore?

2012-04-19 Thread Wikus van de Merwe
For simple things such as thumbnails, you can use the GAE images API (which internally uses PIL): https://developers.google.com/appengine/docs/python/images/imageclass from google.appengine.api import images blob = db.marcas(id).logotipo_marca_blob image = images.Image(blob) image.resize(32,

Re: [web2py] Re: routes.py

2012-04-19 Thread Wikus van de Merwe
Hmmm... So how does the router know if /abc is (1) function - /default_app/default_controller/abc or (2) argument - /default_app/default_controller/default_function/abc?

Re: [web2py] Re: routes.py

2012-04-17 Thread Wikus van de Merwe
Oh, so the default for functions is ALL_FUNCTIONS? In the comments it says: list of valid functions in the default controller (default None). From that I concluded (without testing I admit) that by default no function name will be mapped unless explicitly specified. It make sense to map all

[web2py] Re: routes.py

2012-04-16 Thread Wikus van de Merwe
For this type of routing where you don't use complex regular expressions, it is better to use the simple router. It could make selected functions of the default controller in the default application available directly, i.e. /f1 == /my_app/default_controller/f1 To have /rules mapped to

[web2py] Re: Questions on the scheduler

2012-04-12 Thread Wikus van de Merwe
If all what you need is to report th task progress, you could periodically write the amount of work done to db from within the task. Then query db asynchronously with ajax to show it to the user. This could be done by extending the scheduler_run table. I'm not sure if there is a way to stop a

[web2py] Re: Python Negative Popularity

2012-03-30 Thread Wikus van de Merwe
I don't agree that multiprocessing is difficult in Python. Threading is difficult, multiprocessing is easy. Together with asynchronous I/O this brings the scalability. You think node.js is multithreading? No, it's single thread with event loop and non-blocking callbacks based I/O. And so is

Re: [web2py] Re: sqlite to postgres

2012-03-29 Thread Wikus van de Merwe
Upgrade. Python 2.7 is backward compatible with 2.6. Pip install is also a good option.

[web2py] Re: DAL Challenge

2012-03-28 Thread Wikus van de Merwe
First you need to change your model. In relation database you would have: db.define_table(articles, db.Field(title), ...) db.define_table(comments, db.Field(article_id, db.articles), db.Field(author), ...) But with datastore you want to do the reverse, keep the comment ids in the article table:

[web2py] Re: DAL Challenge

2012-03-27 Thread Wikus van de Merwe
When working with GAE datastore you want to execute minimum number of queries necessary to avoid delays and limit the use of DB API calls. Fetching comments one by one is not the best option then (even if done with ajax). Probably the most efficient way would be to store the list of comment ids

[web2py] Re: Using single instance of LibreOffice to convert documents - is this safe?

2012-03-27 Thread Wikus van de Merwe
If this processing is done after the form submission you can delegate that to a background task. Having a queue of tasks end executing them one by one should solve the concurrent access problem. Check out the book section on scheduler:

[web2py] Re: difference between script src= ... and response.files.append(...)

2012-03-27 Thread Wikus van de Merwe
You *have to* set the response.files first, then include web2py_ajax.html. Look how this is done in the example app: http://code.google.com/p/web2py/source/browse/applications/welcome/views/layout.html Also notice that web2py_ajax.html already includes jquery and web2py.js:

[web2py] Re: @auth.requires(lambda: auth.has_membership(VCARD))

2012-03-27 Thread Wikus van de Merwe
You need web2py = 1.99.3 for the lambda to work.

[web2py] Re: web2py integration with python applications

2012-03-26 Thread Wikus van de Merwe
So you want a web server on a local machine with a TCP backend to control the remote device. You also want some API to be able to access the server problematically. If this is correct, you will need: - a web2py application with functions decorated as services

[web2py] Re: type 'exceptions.AttributeError' 'tuple' object has no attribute 'items'

2012-03-26 Thread Wikus van de Merwe
What do you mean by I've made skills and items unnecessary? What about these references? Field('Skills','list:reference SkillUser',default=None) Field('Items','list:reference Item',default=None) And at which point in your code the error occurs? Why you didn't include full error message? From

[web2py] Re: Is it a way to query data from GAE and then save to the upload feild as a sqlite databasefile file

2012-03-26 Thread Wikus van de Merwe
Make a simple model for storing files: db.define_table(files, db.Field(name), db.Field(content, text)) Then use a function similar to the one below to download the file: def download(): file = db.files(request.args[0]) if not file: raise HTTP(404, File not found.)

[web2py] Re: missing FROM-clause entry

2012-03-23 Thread Wikus van de Merwe
Just a blind guess but does this work any better? query = (comment.id 0) (webpage.title == 'FAQ') (comment.page_id == webpage.id) (comment.id == comment_tags.comment_id) (tag.id == comment_tags.tag_id) (tag.label == 'Agree') db(query).select()

[web2py] Re: Getting started in Web2py

2012-03-23 Thread Wikus van de Merwe
Don't use the web admin. It's for kids :P Copy welcome or example app and change the files directly. For me the selling point of web2py was the simplicity of the syntax. See this comparison: http://www.web2py.com/examples/static/web2py_vs_others.pdf

[web2py] Re: How do I group the list by value and make it table in HTML?

2012-03-22 Thread Wikus van de Merwe
You can simply loop over a sorted list (first by the state, then by name): city_list = [('Huntsville', 'AL'), ('Decatur', 'AL'), ('Anchorage', 'NV'), ('Nome', 'AK'),('Selma', 'AL'), ('Flagstaff', 'AZ'), ('Phoenix', 'AZ'), ('Tucson', 'AZ')] sorted_list = sorted(city_list, key=lambda x:

[web2py] Re: SQLForm.grid : how to change the way column are rendered

2012-03-22 Thread Wikus van de Merwe
You can use a format string to define the data representation, read this: http://web2py.com/books/default/chapter/29/6#Record-representation To get the icons, instead of a format string, pass a function that generates the required HTML code.

[web2py] Re: Conditional Fields

2012-03-22 Thread Wikus van de Merwe
There are two separated things here. One is presentation of required attributes only, the other is validation of the from. The first one could be solved with the conditional field approach described in the book. If you are not sure what are the ids for generated form elements, simply view the

[web2py] Re: efficient DB queries

2012-03-22 Thread Wikus van de Merwe
This is not the best way. It will run a separate query for each board id. On GAE you want to do as much as you can in a single query. So the best way is to construct a list of GAE keys and get all entities together. Unfortunately, AFAIK, there is no support for GAE batch queries in DAL. You

Re: [web2py] Re: {{pass}} problems

2012-03-15 Thread Wikus van de Merwe
So you are saying the problem is now solved? Can you share with us what was the cause of this strange missing pass in view error?

[web2py] Re: Download file dialog to local PC when running from PythonAnywhere

2012-03-15 Thread Wikus van de Merwe
It looks to me that when you say download you mean upload. If a user sends a file to a server, she uploads it. I recommend you to read about upload field in the book: http://web2py.com/books/default/chapter/29/7#SQLFORM-and-uploads

[web2py] Re: bug in unicode decoding/encoding upload file?

2012-03-15 Thread Wikus van de Merwe
The decoder detection seems to focus on 2-4 byte encoding. Many times you will get a text in iso-8859-1 or cp-1250 or other 1 byte encoding and none of this is covered there. I might not make sense to extend the decoder if it is not meant for 1 byte encoding. In that case adding the alternative

[web2py] Re: subdomain routes for websites

2012-03-15 Thread Wikus van de Merwe
I'm trying to use a single controller for all my functions, including the web/site controller/function. OK, but why? While it might be possible to achieve what you want to do this way too, it is definitely not going to be easier.

Re: [web2py] Re: Is there any way to calculate distance between two points(lat and long) inside of sqlite?

2012-03-15 Thread Wikus van de Merwe
You wrote you know how to do it with mysql. DAL doesn't care what db you use. Trigonometric functions are not supported by DAL anyway. So I recommend you to apply your mysql solution using raw sql queries, suggested already by Alan: http://web2py.com/books/default/chapter/29/6#Raw-sql

[web2py] Re: call function in template layout

2012-03-14 Thread Wikus van de Merwe
In a view you can only call functions defined in this view or a one being extended/included: http://web2py.com/books/default/chapter/29/5#Functions-in-views More complex data processing should be done in the controller. Views should just present the data. Make the form transformation in the

[web2py] Re: Is there any way to calculate distance between two points(lat and long) inside of sqlite?

2012-03-14 Thread Wikus van de Merwe
You can use mysql with web2py: http://web2py.com/books/default/chapter/29/6#Connection-strings

Re: [web2py] Re: Upgrading web2py in Linux

2012-03-13 Thread Wikus van de Merwe
I assume that you have only one application and you keep it separate from web2py: $HOME/workspace/my-project/src -- your application folder $HOME/workspace/my-project/web2py -- web2py folder To upgrade web2py to a desired version you can run then the following script. It pulls the changes

[web2py] Re: subdomain routes for websites

2012-03-13 Thread Wikus van de Merwe
What is the purpose of the demo version there? Wouldn't it be easier to have a separate demo controller? You could then simply define the default for the domains as: routers = dict( BASE = dict( domains = {domain.com:app, demo.domain.com:app/demo/index}, default_application =

[web2py] Re:

2012-03-12 Thread Wikus van de Merwe
What exactly are you trying to do? Why you don't use the URL function?

[web2py] Re: need help with unicode decoding/encoding upload file

2012-03-12 Thread Wikus van de Merwe
To convert a string to utf-8 you need to do two operations: - decode the string to unicode (using the original file codec) - encode the unicode string using utf-8 codec This is what decoder.decoder function is doing but it is guessing the original codec. You need to either provide the right

[web2py] Re: Can I change DAL encoding for strings?

2012-03-12 Thread Wikus van de Merwe
You could inherit from DAL and overwrite the methods with wrappers that do the decoding/encoding where needed. I guess typically only insert, update, select and the constructor have to be wrapped. There is also the db_codec keyword argument for DAL constructor defaulted to utf-8. But I'm

[web2py] Re: custom css

2012-03-12 Thread Wikus van de Merwe
Does the example app that comes with web2py show flash/errors correctly on Firefox 10 + Windows? If so, it would mean you didn't copy all the required CSS rules or you are missing a class/id/tag in your layout.

[web2py] Re: Many to Many?

2012-03-09 Thread Wikus van de Merwe
What pbreit suggested assumes that all the company servers are at the same location as the company, which I guess is not what you wanted. It think it should rather be: db.define_table('company', Field('name'), Field('location', db.location)) db.define_table('server', Field('name'),

[web2py] Re: web2py site and disabling browser right clicks

2012-03-09 Thread Wikus van de Merwe
It looks like you don't understand how the world wide web works. There is nothing you can do to stop me from seeing the HTML code of your website. Blocking right click gets you nowhere as I can still use the browser menu, numerous plugins or simply download the page code directly without even

[web2py] Re: Validating data in a CRUD form before entering into the databse

2012-03-02 Thread Wikus van de Merwe
I think the easiest is to add your validation code in the controller and then process the data after successful validation. I don't know how your data looks like but here is a simple example of a controller code with custom validation and db insert: def validate_add(form): pattern =

[web2py] Re: Using SQLFORM.grid()

2012-03-02 Thread Wikus van de Merwe
The args keywords is used to pass extra parameters to grid URLs. It is only useful if you implement your own ondelete, onupdate or oncreate functions and need to get this extra arguments from a request.

[web2py] Re: web2py resources

2012-03-01 Thread Wikus van de Merwe
Except of websites with very small user base, the use of sqlite is not recommended as it doesn't provide concurrent writes. Mysql or postgresql is usually a good first choice, but web2py supports about 10 different DBs, so you can choose something else too. The application code (including

[web2py] Re: Capture the system shut down and browser close event

2012-02-28 Thread Wikus van de Merwe
You could simply assume x minutes (eg. 15) without any user action equals to logout. Then all you need is just a small script that runs periodically by cron and does a DB update when inactivity is detected.

[web2py] Re: Passing variables from form to function to be classified and matched against DB

2012-02-28 Thread Wikus van de Merwe
If I understand you correctly, you simply want to use the matched scenario on the next stage of the form. So, after validation you need to pass the id of the matched scenario either by: a) storing it in a session (1) and reading it later in the next function (2) 1) session.scenario =

[web2py] Re: using existing DB connection inside module/class

2012-02-24 Thread Wikus van de Merwe
The code in controllers is wrapped in web2py with a try except clause that automatically commits or rolls back the changes to db. I believe this is not the case for modules and an explicit commit is needed there. Try to add db.commit to your module code.

[web2py] Re: GAE - Rendering uploaded Blob as jpeg image rather than as a string?

2012-02-24 Thread Wikus van de Merwe
You kind of do :) There is no way to embed streams in HTML directly. You need a separate function showing a single image by id (e.g. /show_image/id) and build a list with links to that function in the list_image view. {{for img in images:}} tr {{= TD(img.title) }} {{=

[web2py] Re: concurrency, web2py, and GAE

2012-02-23 Thread Wikus van de Merwe
You're probably right, access to global variables in mulithreading environment requires extra care. You might find reading this helpful: http://blog.notdot.net/2011/10/Migrating-to-Python-2-7-part-1-Threadsafe

[web2py] Re: GAE and Web2Py - Current Issues and some thoughts on Best Practices?

2012-02-23 Thread Wikus van de Merwe
Goggle bigtable support in DAL is already GAE specific. You can also access entities by id (which is returned after insert) or key using DAL. Mixing in native API is possible if needed too, as app portability is lost anyway with GAE. And the non web2py specific things such as N:N relations,

[web2py] Re: in my IE 6.0 the layout is wrong.

2012-02-23 Thread Wikus van de Merwe
I'm sorry, but I think you are on your own on this one :) Anyone who was ever involved in coding CSS workarounds for IE6 remembers this nightmare very strongly and would not go back to it even if paid lots of money :) If you need your app to work perfectly on IE6, I suggest starting the

[web2py] Re: dynamic keywords on database update

2012-02-23 Thread Wikus van de Merwe
You can pass a dictionary to a function as if you are passing keyword arguments. kwargs = {a:1, b:2} f(**kwargs) # this call is equal to f(a=1, b=3) There is similar mechanism for positional arguments in Python: args = [1, 2] f(*args) # this call is equal to f(1, 2)

[web2py] Re: crontab sytax

2012-02-21 Thread Wikus van de Merwe
I say the book works just fine: http://web2py.com/book/default/chapter/04#Cron The syntax you want to use is: @reboot * * * * root *applications/test/controllers/private.py Set that in your app/cron/crontab and make sure your controller does db.commit() at the end. Also you need SOFTCRON =

[web2py] Re: Validate the Checkbox

2012-02-21 Thread Wikus van de Merwe
The easiest way to do that is rely on web2py model - form transformation and use a validator (instead of the custom form). model -- MY_OPTIONS = [a,b,c] db.define_table(my_table, db.Field(my_options, list:string, default=MY_OPTIONS))

[web2py] Re: How to optimize the output typography of blocks in web2py views?

2012-02-21 Thread Wikus van de Merwe
You can do tricks like that, but it does not have the best readability: {{ for i in range(10): }} p text {{=i}} text /p {{ pass }}

[web2py] Re: $.ajax : how to parse data sent to the controller

2012-02-21 Thread Wikus van de Merwe
if students in request.vars: students = json.loads(request.vars.students) print students[0][student_id] For python 2.5 you might need to import the simplejson from contrib (I'm not sure if this is done automatically): import gluon.contrib.simplejson as json

[web2py] Re: deployment

2012-02-20 Thread Wikus van de Merwe
The /var/www folder is just an example. You can put the wsgi.py in your home folder as well. You can also simply use wsgihandler.py that comes with web2py. One or the other has to be set as the WSGI script in the http server configuration. To learn more on deploying web2py applications read

[web2py] Re: rendering a view

2012-02-17 Thread Wikus van de Merwe
If all what you want to do is to link to individual items from the main page, you don't need to use redirect at all. Simply add HTML code to your view that would link to /arcticles/show/[id] or /bussiness/show/[id] as needed. ul {{ for article in articles: }} {{=LI(A(article.title,

[web2py] Re: deployment

2012-02-17 Thread Wikus van de Merwe
The directory does not exist. Run mkdir /var/www first.

[web2py] Re: Why admin|examples|welcome in hgignore?

2012-02-17 Thread Wikus van de Merwe
The intention is not to track changes in user made applications (different than the default ones). ?! is the negative lookahead operator, so the first part of the expression will match applications/ only if it is not followed with any of the strings in the brackets. The the second part (.*)

[web2py] Re: rendering a view

2012-02-17 Thread Wikus van de Merwe
Right, my bad, I missed the args keyword in the URL call. It should be: URL(articles, show, args=article.id). For more details see the examples given by Anthony.

[web2py] Re: Implementing task queue using web2py

2012-02-14 Thread Wikus van de Merwe
If it worked with different controller my guess is still that the URL you are passing is wrong. Try to simplify it to: taskqueue.add(url=URL('hello'))

Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1

2012-02-14 Thread Wikus van de Merwe
You're right, if you careful enough, you can separate the changes to the CMS code required by your application and release just them. But this is just one of the abusive tactics which GPL protects against. Because how useful would that changes be to others? I believe it would make more sense

Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1

2012-02-14 Thread Wikus van de Merwe
Sorry, I was not precise. I was describing a case in which there is a dependency on a code under a license which is GPL compatible and not compatible with LGPL. So I meant simpler in that context. I agree that for projects with no such dependency there would be no difference in difficulty.

Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1

2012-02-13 Thread Wikus van de Merwe
LGPL is designed for libraries. Static or dynamic linking to LGPL code is allowed without enforcing copy-left. That means that the derivative work can even be a proprietary software. However, if you change the library code itself, you modification has to be released under LGPL. Since version 3

Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1

2012-02-10 Thread Wikus van de Merwe
With web2py being licensed under LGPL it is possible to build applications which are proprietary software. To some degree it is even possible to build another web framework that uses unchanged web2py code as back-end. In practice, however, the latter is too complicated on a technical level. The

[web2py] Re: Implementing task queue using web2py

2012-02-10 Thread Wikus van de Merwe
Check the app engine requests log to make sure the right task URL is being used.

[web2py] Re: how to deploy web2py not in the apache root (help with url rewriting)

2012-02-09 Thread Wikus van de Merwe
If you have just one application all you need to do is set the web2py WSGI script alias and serve files from the web2py folder excluding admin parts. WSGIDaemonProcess web2py display-name=%{GROUP} WSGIProcessGroup web2py WSGIScriptAlias /prefix /var/www/web2py/wsgihandler.py Directory

[web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1

2012-02-09 Thread Wikus van de Merwe
What I see you are trying to say is that by keeping the code secret one gains a temporary advantage over the competition. That might be true. But this is the way of thinking coming from the proprietary software philosophy. How much will I loose by making the software free? If this is your line

[web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1

2012-02-08 Thread Wikus van de Merwe
I'm not sure if looking at the problem of license from the business point of view is reasonable. If Bruno's goal was to make the business people happy, he would put his software into the public domain. But I'm guessing he is more interested in getting some help from others and maybe building a

[web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1

2012-02-07 Thread Wikus van de Merwe
Bruno's work is given for free, and if you don't share your changes back, keep it secret behind the server, it doesn't help the Movuca project. So for Bruno the GPL or even AGPL is a good option, as it keeps the code free (as in freedom). CMS is very different to a framework like web2py, which

[web2py] Re: Too many redirects when trying to use interactive demo

2012-02-03 Thread Wikus van de Merwe
The problem seems to be a redirection loop between this two addresses: 1) http://web2py.com/demo_admin/default/site 2) http://web2py.com/demo_admin/default/index?send=%2Fdemo_admin%2Fdefault%2Fsite Both return 303 and redirect 1 - 2, and 2 - 1 until the browser gives up with a message: Firefox

[web2py] Re: upload field value reset on form failure of another field

2011-12-05 Thread Wikus van de Merwe
So how does it work for other form elements? I'm guessing they are stored in session. So the way to go would be to store the uploaded file in session too and then on form resubmission check what to display. If file is in session the input field should look as on update of an existing object

[web2py] Re: DAL level access to GAE entities by named key

2011-10-17 Thread Wikus van de Merwe
Thanks! It works with the query using the long syntax: *db(db.table_name.id == key).select().first()* The short version *db.table_name(key)* does returns *None* as it performs a check if key is an integer first. However, using a query instead of a key also works: *db.table_name(db.table_name.id

Re: [web2py] Re: checkbox input default value

2011-10-11 Thread Wikus van de Merwe
Try to define default values for your fields: name = Field(name, boolean, default=False)

[web2py] Re: DAL level access to GAE entities by named key

2011-10-11 Thread Wikus van de Merwe
I'm getting nothing (None). If the intention was to having it work this way (by passing key as id) I'll have a look at the DAL code more closely. Maybe something affects the key outside of the select_raw function. Have this ever worked for you?

[web2py] DAL level access to GAE entities by named key

2011-10-10 Thread Wikus van de Merwe
Is there a way to use DAL to make a GAE query by entity name (not just numeric id)? I remember a discussion on the list about GAE keys with parents and a proposed patch for DAL to be able to pass GAE Key instead of if id. I see this implemented in the DAL code:

[web2py] Re: checkbox input default value

2011-10-10 Thread Wikus van de Merwe
Are you using list:string? Can you post the relevant parts of your model and controller?

Re: [web2py] Re: How to debug HTTP 500 error on GAE?

2011-07-28 Thread Wikus van de Merwe
I think you mean the default logging level set to DEBUG as we once discussed here: https://groups.google.com/forum/#!msg/web2py/N2O7WrPJdAE/trGuTFU9cssJ But here we have quite opposite problem, it's not that too much goes to the log but rather that errors were not logged.

Re: [web2py] Re: How to debug HTTP 500 error on GAE?

2011-07-28 Thread Wikus van de Merwe
I've deleted the logging.conf file.

[web2py] App-specific routes using the new router syntax

2011-07-28 Thread Wikus van de Merwe
I want to use app-specific routes to make my application more portable. Let's assume that there is no web2py/routes.py file and my application name is init. Now I created the routes.py file in web2py/applications/init/ directory and defined my simple router there: my_router = dict(

Re: [web2py] App-specific routes using the new router syntax

2011-07-28 Thread Wikus van de Merwe
Hmmm... So this means that app-specific routes are not so useful as I thought. I thought I would be able to get away without the web2py/routes.py having all rules defined per application. In other words, I was expecting the default_router to be the default when there is no web2py/routes.py. But

[web2py] Re: confused on routes.py

2011-07-27 Thread Wikus van de Merwe
Yes, if host.domain.tld/meetings/2011/ points to the MYAPP already, you don't need routes_in. Probably your outgoing routes mapping should look like this: routes_out = ( (/MYAPP/(.*), r/meetings/2011/MYAPP/\1), )

[web2py] Re: routes for crud

2011-07-27 Thread Wikus van de Merwe
Why not simply use /sr/action/id without any url remapping? What is the advantage of having an argument and function name order reversed? For viewing the record you still need to call a specific function, e.g. /sr/view/1. Anyway, if you want it your way, try this: routes_in = (

[web2py] Re: web2py GAE and memory usage

2011-07-27 Thread Wikus van de Merwe
The thing is that when you read from datastore you always read all properties of an entity. Each entity can take up to 1MB, so I can imagine reading 500 of them could hit the instance limit. The solution would be to use GAE cursor and cycle your task. In pseudo code: def request_handler():

Re: [web2py] Re: How to debug HTTP 500 error on GAE?

2011-07-27 Thread Wikus van de Merwe
Yes. There is no call to session.connect(). As I'm running the app on GAE I wanted to avoid the default file system based session. If this is not default any more and there is no session at all until explicitly created I can safely remove it. The bigger problem here are the logs though. Why

[web2py] Re: web2py GAE and memory usage

2011-07-27 Thread Wikus van de Merwe
The exact behaviour of this instance memory control mechanism was not revealed (see http://code.google.com/p/googleappengine/issues/detail?id=1646 ). From your log message it looks like it was the first request that triggered the limit so the garbage collection can hardly be blamed here. And

[web2py] Re: How to debug HTTP 500 error on GAE?

2011-07-26 Thread Wikus van de Merwe
Thanks for the hint! It was the logging indeed. Apparently the logging.conf that comes with web2py was hiding the error: ERROR2011-07-26 18:44:54,452 restricted.py:156] Traceback (most recent call last): File /home/momat/workspace/pm-cmp-python/web2py/gluon/main.py, line 531, in wsgibase

[web2py] How to debug HTTP 500 error on GAE?

2011-07-25 Thread Wikus van de Merwe
I'm using the latest GAE 1.5.2 and web2py 1.96.4. When I run the application with: python2.5 /opt/gae-python-sdk/dev_appserver.py --port 8001 ./web2py and open http://localhost:8001 in a browser I get the HTTP 500 internal server error. There is no message in the appserver console output, there

  1   2   >