Skip to content

Instantly share code, notes, and snippets.

@Lothiraldan
Lothiraldan / gist:905390
Created April 6, 2011 09:29
Add support for pagination in notmyidea-cms theme
From 8790b3702910236185f6fd08f39420ace407e69e Mon Sep 17 00:00:00 2001
From: FELD Boris <lothiraldan@gmail.com>
Date: Wed, 6 Apr 2011 11:27:22 +0200
Subject: [PATCH] Add support for pagination in notmyidea-cms theme
---
notmyidea-cms/templates/index.html | 20 +++++++++++++++-----
notmyidea-cms/templates/pagination.html | 12 ++++++++++++
2 files changed, 27 insertions(+), 5 deletions(-)
create mode 100644 notmyidea-cms/templates/pagination.html
@Lothiraldan
Lothiraldan / client.py
Created May 25, 2011 21:10
Client socketServer
import socket
import sys
HOST, PORT = "localhost", 9999
data = str(sys.argv[1])
# Create a socket (SOCK_STREAM means a TCP socket)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Connect to server and send data
@Lothiraldan
Lothiraldan / script.py
Created July 19, 2011 22:02
PYTI Minimal
from pyti.vmanager.diskhandler import *
from pyti.vmanager.vms import *
import time
import sys
from os import getcwd
from os.path import join
hd_location = join(getcwd(), sys.argv[1])
@Lothiraldan
Lothiraldan / test_first_broken.py
Created October 10, 2011 20:40
Example with for in test method and a typo in function.
import unittest
def support_http_method(method):
if method in ('POST', 'GETT'):
return True
else:
return False
class SupportHttpMethodTestCase(unittest.TestCase):
@Lothiraldan
Lothiraldan / test_first.py
Created October 10, 2011 20:28
First solution with a loop inside test method.
import unittest
def support_http_protocol(protocol):
if protocol in ('POST', 'GET'):
return True
else:
return False
class SupportHttpProtocolTestCase(unittest.TestCase):
@Lothiraldan
Lothiraldan / test_second.py
Created October 10, 2011 21:03
Example with nosetest test generator.
def support_http_method(method):
if method in ('POST', 'GET'):
return True
else:
return False
def test_support():
expected_values = {
'POST': True,
'GET': True,
@Lothiraldan
Lothiraldan / test_second_broken.py
Created October 10, 2011 21:11
Example with nosetest test generator and a typo in the function.
def support_http_method(method):
if method in ('POST', 'GETT'):
return True
else:
return False
def test_support():
expected_values = {
'POST': True,
'GET': True,
@Lothiraldan
Lothiraldan / test_third.py
Created October 10, 2011 21:29
Example with unittest templates.
import unittest
from poc import TemplateTestCase, Call, template
def support_http_method(method):
if method in ('POST', 'GET'):
return True
else:
return False
class SupportHttpMethodTestCase(unittest.TestCase):
@Lothiraldan
Lothiraldan / test_third_broken.py
Created October 10, 2011 21:32
Example with unittest templates and a typo in the function.
import unittest
from poc import TemplateTestCase, Call, template
def support_http_method(method):
if method in ('POST', 'GETT'):
return True
else:
return False
class SupportHttpMethodTestCase(unittest.TestCase):
@Lothiraldan
Lothiraldan / problem_loop_inside_test_method.py
Created October 27, 2011 18:04
Problem with for loop in test method
import unittest
class ListApiSet(object):
def __init__(self):
self.container = set()
def extend(self, value):
self.container.update(value)
return self.container