Skip to content

Instantly share code, notes, and snippets.

@Lothiraldan
Lothiraldan / gist:905390
Created Apr 6, 2011
Add support for pagination in notmyidea-cms theme
View gist:905390
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
Client socketServer
View client.py
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
View script.py
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 Oct 10, 2011
Example with for in test method and a typo in function.
View test_first_broken.py
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 Oct 10, 2011
First solution with a loop inside test method.
View test_first.py
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 Oct 10, 2011
Example with nosetest test generator.
View test_second.py
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 Oct 10, 2011
Example with nosetest test generator and a typo in the function.
View test_second_broken.py
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 Oct 10, 2011
Example with unittest templates.
View test_third.py
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 Oct 10, 2011
Example with unittest templates and a typo in the function.
View test_third_broken.py
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 Oct 27, 2011
Problem with for loop in test method
View problem_loop_inside_test_method.py
import unittest
class ListApiSet(object):
def __init__(self):
self.container = set()
def extend(self, value):
self.container.update(value)
return self.container
You can’t perform that action at this time.