Search Results

Search found 43 results on 2 pages for 'mako'.

Page 1/2 | 1 2  | Next Page >

  • Conditional operator in Mako using Pylons

    - by Antoine Leclair
    In PHP, I often use the conditional operator to add an attribute to an html element if it applies to the element in question. For example: <select name="blah"> <option value="1"<?= $blah == 1 ? ' selected="selected"' : '' ?>> One </option> <option value="2"<?= $blah == 2 ? ' selected="selected"' : '' ?>> Two </option> </select> I'm starting a project with Pylons using Mako for the templating. How can I achieve something similar? Right now, I see two possibilities that are not ideal. Solution 1: <select name="blah"> % if blah == 1: <option value="1" selected="selected">One</option> % else: <option value="1">One</option> % endif % if blah == 2: <option value="2" selected="selected">Two</option> % else: <option value="2">Two</option> % endif </select> Solution 2: <select name="blah"> <option value="1" % if blah == 1: selected="selected" % endif >One</option> <option value="2" % if blah == 2: selected="selected" % endif >Two</option> </select> In this particular case, the value is equal to the variable tested (value="1" = blah == 1), but I use the same pattern in other situations, like <?= isset($variable) ? ' value="$variable" : '' ?>. I am looking for a clean way to achieve this using Mako.

    Read the article

  • Mako "Missing parentheses in %def"

    - by michaelmior
    In trying to add a cached section to a Mako template, I get the error listed in the above question. Adding () to the end gets rid of the error, but I see no content on my page. Any help is appreciated! <%def name="test" cached="True" cache_timeout="60" cache_type="file"> Test /%def>

    Read the article

  • What should I use - Mako or Django?

    - by mridang
    Hi guys, I'm making a website that mail users when a movie or a pc game has released. It isn't too complex - users can sign up, choose movies/music or a genre and save the settings. When the movie/music is released - it mails the user. Some other functionality too but this is the jist. Now, I've been working with Python for a bit but mainly in the area of console apps. For web: what should I use, the web framework Django or the templating engine Mako? I can't seem to decide between the two. :( Thanks

    Read the article

  • Mako templates inline if statement

    - by ensnare
    I have a template variable, c.is_friend, that I would like to use to determine whether or not a class is applied. For example: if c.is_friend is True <a href="#" class="friend">link</a> if c.is_friend is False <a href="#">link</a> Is there some way to do this inline, like: <a href="#" ${if c.is_friend is True}class="friend"{/if}>link</a> Or something like that?

    Read the article

  • Setting up Mako with Cherrypy on nginx through FastCGI

    - by xuniluser
    I'm trying to use TemplateLookup from Mako, but can't seem to get it to work. Layout of the test site is: /var/www main.py templates/ index.html Nginx's config is setup as: location / { fastcgi_pass 127.0.0.1:8080; fastcgi_param SERVER_NAME $server_name; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param QUERY_STRING $query_string; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_pass_header Authorization; fastcgi_intercept_errors off; } Cherrypy's config has: [global] server.socket_port = 8080 server.thread_pool = 10 engine.autoreload_on = False tools.sessions.on = True A simple cherrypy setup in main.py seems to work fine. import cherrypy class Main: @cherrypy.expose def index(self): return 'Hello' cherrypy.tree.mount(Main(), '/', config='config') Now, if I modify this to use Mako's template lookup, I get a 500 error. I know it has something to do with serving static files, but I've tried over a dozen different configurations accoring to the cherrypy wiki, but none of them work. Here's a bare setup I have for the templates: import cherrypy from mako.template import Template from mako.lookup import TemplateLookup templates = TemplateLookup(directories=['templates'], output_encoding='utf-8') class Main: @cherrypy.expose def index(self): return templates.get_template('index.html').render(msg='hello') cherrypy.tree.mount(Main(), '/', config='config') Does anyone know how I can get this to work ?

    Read the article

  • Ternary operator

    - by Antoine Leclair
    In PHP, I often use the ternary operator to add an attribute to an html element if it applies to the element in question. For example: <select name="blah"> <option value="1"<?= $blah == 1 ? ' selected="selected"' : '' ?>> One </option> <option value="2"<?= $blah == 2 ? ' selected="selected"' : '' ?>> Two </option> </select> I'm starting a project with Pylons using Mako for the templating. How can I achieve something similar? Right now, I see two possibilities that are not ideal. Solution 1: <select name="blah"> % if blah == 1: <option value="1" selected="selected">One</option> % else: <option value="1">One</option> % endif % if blah == 2: <option value="2" selected="selected">Two</option> % else: <option value="2">Two</option> % endif </select> Solution 2: <select name="blah"> <option value="1" % if blah == 1: selected="selected" % endif >One</option> <option value="2" % if blah == 2: selected="selected" % endif >Two</option> </select> In this particular case, the value is equal to the variable tested (value="1" = blah == 1), but I use the same pattern in other situations, like <?= isset($variable) ? ' value="$variable" : '' ?>. I am looking for a clean way to achieve this using Mako.

    Read the article

  • Pylons/Routes Did url_for() change within templates?

    - by Charles Merram
    I'm getting an error: GenerationException: url_for could not generate URL. Called with args: () {} from this line of a mako template: <p>Your url is ${h.url_for()}</p> Over in my helpers.py, I do have: from routes import url_for Looking at the Routes-1.12.1-py2.6.egg/routes/util.py, I seem to go wrong about line it calls _screenargs(). This is simple functionality from the Pylons book. What silly thing am I doing wrong? Was there a new url_current()? Where?

    Read the article

  • Using rel=canonical and noindex in a 1-n partners enviroment

    - by Telemako Mako
    We sell a whole site (domain, etc) to partners that create content that is shown together at the main site. What we want to achieve is that the main site copy is the original, but the one that is indexed is the partners copy. We want to do it this way so the search results point to the partner sites but never to the main site while the main site gets all the credit for the links. We are trying setting the main site article with a noindex, follow and a link to the partner article, and in the partner article we have a rel=canonical pointing to the main site article. Are we correct or the noindex at the main site will break the canonical reference?

    Read the article

  • about freelancer in third world countries

    - by MaKo
    hello guys, one question that is been bogging me... first of all I want to say that I actually come from a third world country, so I am all up for opportunities for everybody... so here comes my consideration,,, I have been working as a programmer for Iphone apps (noob in the company), now in my new "first" world country (immigration can be good!!!), but seem to be getting more and more advertisement from sites like freelancer.com etc,,, so I would want to know what do you think about all this???, would the jobs be getting cheaper?? if a project can be done by say 10% of the cost overseas, what is stopping the employers of doing just that? is it worth it? how about the quality? from a local job and overseas job? and all other aspects I cannot think about?? I just want to know if all this years of learning are going to pay off? or if in a near future all programming jobs will just go to cheaper labor? (sweat shops??) ok hope to make sense in my ramblings,, cheers;)

    Read the article

  • rfid programming

    - by MaKo
    hi guys, I got a gift from a friend, 2 readers for RFID, and some cards (from a Chinese company called daily rfid), the kind of work, because it comes with some demo software written in Delphi, that reads the id of the card (myfare compatible, ISO14443A ) but the problem is that if I try to use the demo to write to them, it doesnt seem to work, it have another demo written in c#, (compiled and executable from /bin/debug, the DL600DemoCSharp.exe), the software opens, but when click on connect, I get this error Unhanded exception.. unable to load DLL 'BasicB.DLL' so I load the dll on windows/system32, but when I try regsvr32 BasicB.dll I get, error the module "BasicB.dll" was loaded but hte entry-point DllRegisterServer was not found. Make sure that "BasicB.dll" is a valid DLL or OCX file and then try again have written to the company but no response, I program in objective C, so I kind of understand c#, but how to make this cards work? - shall I continue with the delphi, and try to write to them with it - or with c# - either way I would have to write the code to read write to them,, or is there any software to work with this modules?? thanks a lot!

    Read the article

  • is jargon related to a frameWork (concept)

    - by MaKo
    If this is not the right place to ask this question please inform where it would belong, to change it... I have a doubt for the correct word or concept in english language [not my native], about the relationship of language to framework for example i work with objective C, with the cocoa touch frame work || python with the django frame work My comparison is between natural languages and formal languages, So would be in a natural language english and the frame work a [computer, it]jargon? Does this make sense? Or what other concept would be the relationship between natural language - framework?

    Read the article

  • Virtualize Mac OS X on a Mac

    - by Joe Mako
    I use Virtual Box on a Mac OS X 10.6.2 MacBook Pro. Can I create/run a Mac OS X 10.5 guest OS on this setup? If not, what setup would allow me to run multiple versions of Mac OS X on the same machine?

    Read the article

  • Giving a permission to write and read from /var/www

    - by mako
    I need that directory, as I want to put my sites there, so that apache can run them.. It is my virtual directory path.. and I am new to linux.. I just want to read and write from that directory.. How do I enable creating/saving/reading files/folders from that directory? What command do I give? I tried a few, but I think I need to be a super user to make the folder writtable readable. Note that I dont care about security.

    Read the article

  • Looking for a user friendly file upload service to run on my own server

    - by Joe Mako
    My goal is to allow people to upload and download large files through their web browser with a simple user interface and user password/account management. Yousendit offers a service like what I am looking for, but it does not make sense to use their service if I already have a web server. Is there an open source version of Yousendit that I can run on my own web server? What is this type of software or service called? (calling it an FTP Server does not seem to fit)

    Read the article

  • ipad tabbar rotation

    - by MaKo
    hi, please help with this noob questions but really making me go crazy if I create a project from scratch (using windows based app) for the ipad, and add a tabbar , with firstviewController, and secondviewController, it works fine, starts in landscape mode, but in info.plist I set it to Landscape(left home button), but really in simulator starts with the button on the right side! in the FirstViewController.m (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight) return YES; else { return NO; }} so it starts in landscape, and rotates as the simulator rotates, but if I create a template app for iphone tabbar, set the info.plist Initial interface orientation Landscape (left home button) and add the code above, IT DOESNT WORK!!! simulator starts with button at left but tab bar on the side, same problem that I had with an app that Im porting from iphone to ipad, (landscape intended) I get to the landscape start mode, but the tab bar remains on the side! also the only way to make the old ported app to show the simulator on the side was with UIInterfaceOrientation UIIntefaceOrientationLandscapeLeft (didnt work with Initial interface orientation), does not let me choose the value for the key, but it shows the simulator on landscape,, so,, what can I do please to show the tab bar on landscape mode??? the tabbar from scratch was made to see if the code will work , but it didnt?? why does it work in the tab bar made from windows app and not tab bar app? I just want the tab bar to show in landscape ahhh, thanks

    Read the article

  • wsgi django not working

    - by MaKo
    im installing django, the test for wsgi is ok, but when i point my default file to the django test, it doesnt work, this is the test that works fine: default: /etc/apache2/sites-available/default <VirtualHost *:80> ServerName www.example.com ServerAlias example.com ServerAdmin [email protected] DocumentRoot /var/www <Directory /var/www/documents> Order allow,deny Allow from all </Directory> WSGIScriptAlias / /home/ubuntu/djangoProj/micopiloto/application.wsgi <Directory /home/ubuntu/djangoProj/mysitio/wsgi_handler.py> Order allow,deny Allow from all </Directory> </VirtualHost> application.wsgi:: ~/djangoProj/micopiloto import os import sys sys.path.append('/srv/www/cucus/application') os.environ['PYTHON_EGG_CACHE'] = '/srv/www/cucus/.python-egg' def application(environ, start_response): status = '200 OK' output = 'Hello World!MK SS9 tkt kkk' response_headers = [('Content-type', 'text/plain'), ('Content-Length', str(len(output)))] start_response(status, response_headers) return [output] but if I change the default to point to application_sa.wsgi the django test, it doesnt work :( application_sa.wsgi import os, sys sys.path.append('/home/ubuntu/djangoProj/micopiloto') os.environ['DJANGO_SETTINGS_MODULE'] = 'micopiloto.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() I restart the apache server every time i change the wsgi to test, so what im i missing? thanks a lot!

    Read the article

  • Adding a div element inside a panel?

    - by Bar Mako
    I'm working with GWT and I'm trying to add google-maps to my website. Since I want to use google-maps V3 I'm using JSNI. In order to display the map in my website I need to create a div element with id="map" and get it in the initialization function of the map. I did so, and it worked out fine but its location on the webpage is funny and I want it to be attached to a panel I'm creating in my code. So my question is how can I do it? Can I create a div somehow with GWT inside a panel ? I've tried to do create a new HTMLPanel like this: runsPanel.add(new HTMLPanel("<div id=\"map\"></div>")); Where runsPanel is a the panel I want to to be attached to. Yet, it fails to retrive the div when I use the following initialization function: private native JavaScriptObject initializeMap() /*-{ var latLng = new $wnd.google.maps.LatLng(31.974, 34.813); //around Rishon-LeTsiyon var mapOptions = { zoom : 14, center : latLng, mapTypeId : $wnd.google.maps.MapTypeId.ROADMAP }; var mapDiv = $doc.getElementById('map'); if (mapDiv == null) { alert("MapDiv is null!"); } var map = new $wnd.google.maps.Map(mapDiv, mapOptions); return map; }-*/; (It pops the alert - "MapDiv is null!") Any ideas? Thanks

    Read the article

  • ipod touch crashing after uploading app to device

    - by MaKo
    hi, I installed a new device (the second out of the 100), on xcode, an iPod touch but when I upload the app, the iPod crashes, apple logo shows, and gets frozen for a while, and then resusitates, in the xcode, I get the message on console: The Debugger has exited due to signal 15 (SIGTERM). I tried a simple app I made, and it loaded it, (some bouncing ball) after starting again, but tried the same with another app that plays some sounds and it shows normally, but doesnt play the sounds, questions: how to fix this issue? (in MyApp-info.plist, in bundle identifier, I have: com.yourcompany.${PRODUCT_NAME:rfc1034identifier} havent changed this, is this a problem?? 1.b. I used that conf to upload to an iPad with no problem?? Do the apps play normally sounds *.m4a, in the simulator it works!, not in the iPod, is this due to the crash or not? Thank you,, edit Im using AudioToolbox framework, the question after 1.b is 2 in my editor, but appears as 1 in the post??

    Read the article

  • Aggregating a list of dates to start and end date

    - by Joe Mako
    I have a list of dates and IDs, and I would like to roll them up into periods of consucitutive dates, within each ID. For a table with the columns "testid" and "pulldate" in a table called "data": | A79 | 2010-06-02 | | A79 | 2010-06-03 | | A79 | 2010-06-04 | | B72 | 2010-04-22 | | B72 | 2010-06-03 | | B72 | 2010-06-04 | | C94 | 2010-04-09 | | C94 | 2010-04-10 | | C94 | 2010-04-11 | | C94 | 2010-04-12 | | C94 | 2010-04-13 | | C94 | 2010-04-14 | | C94 | 2010-06-02 | | C94 | 2010-06-03 | | C94 | 2010-06-04 | I want to generate a table with the columns "testid", "group", "start_date", "end_date": | A79 | 1 | 2010-06-02 | 2010-06-04 | | B72 | 2 | 2010-04-22 | 2010-04-22 | | B72 | 3 | 2010-06-03 | 2010-06-04 | | C94 | 4 | 2010-04-09 | 2010-04-14 | | C94 | 5 | 2010-06-02 | 2010-06-04 | This is the the code I came up with: SELECT t2.testid, t2.group, MIN(t2.pulldate) AS start_date, MAX(t2.pulldate) AS end_date FROM(SELECT t1.pulldate, t1.testid, SUM(t1.check) OVER (ORDER BY t1.testid,t1.pulldate) AS group FROM(SELECT data.pulldate, data.testid, CASE WHEN data.testid=LAG(data.testid,1) OVER (ORDER BY data.testid,data.pulldate) AND data.pulldate=date (LAG(data.pulldate,1) OVER (PARTITION BY data.testid ORDER BY data.pulldate)) + integer '1' THEN 0 ELSE 1 END AS check FROM data ORDER BY data.testid, data.pulldate) AS t1) AS t2 GROUP BY t2.testid,t2.group ORDER BY t2.group; I use the use the LAG windowing function to compare each row to the previous, putting a 1 if I need to increment to start a new group, I then do a running sum of that column, and then aggregate to the combinations of "group" and "testid". Is there a better way to accomplish my goal, or does this operation have a name? I am using PostgreSQL 8.4

    Read the article

  • Pylons and Facebook

    - by Nayan Jain
    The following is my oauth template top.location.href='https://graph.facebook.com/oauth/authorize?client_id=${config['facebook.appid']}&redirect_uri=${config['facebook.callbackurl']}&display=page&scope=publish_stream'; Click here to authorize this application When I hit the page I am prompted to login (desired), upon login I am redirected in a loop between a permissions page and an app page. My controller looks like: class RootController(BaseController): def __before__(self): tmpl_context.user = None if request.params.has_key('session'): access_token = simplejson.loads(request.params['session'])['access_token'] graph = facebook.GraphAPI(access_token) tmpl_context.user = graph.get_object("me") def index(self): if not tmpl_context.user: return render('/oauth_redirect.mako') return render('/index.mako') I'm guessing my settings are off somewhere, probably with the callback. Not to sure if it is an issue with my code or the python sdk for facebook.

    Read the article

  • 'cannot find -lboost_iostreams' while trying to install Deluge 1.3.3

    - by Muhammad
    While trying to install deluge 1.3.3 (I need this specific version) I get an error. I install all the needed packages through sudo apt-get install g++ make python-all-dev python-all python-dbus \ python-gtk2 python-notify librsvg2-common python-xdg python-support \ subversion libboost-dev libboost-python-dev \ libboost-thread-dev libboost-date-time-dev libboost-filesystem-dev \ libssl-dev zlib1g-dev python-setuptools \ python-mako python-twisted-web python-chardet python-simplejson I then build it $ python setup.py build and $ sudo python setup.py install then I get a long list at the end of which there is the error /usr/bin/ld: cannot find -lboost_iostreams collect2: ld returned 1 exit status error: command 'gcc' failed with exit status 1 Can you help me out with this?

    Read the article

1 2  | Next Page >