Skip to content

Instantly share code, notes, and snippets.

In [2]: pytz.common_timezones
Out[2]: ['Africa/Abidjan', 'Africa/Accra', 'Africa/Addis_Ababa', 'Africa/Algiers', 'Africa/Asmara', 'Africa/Bamako', 'Africa/Bangui', 'Africa/Banjul', 'Africa/Bissau', 'Africa/Blantyre', 'Africa/Brazzaville', 'Africa/Bujumbura', 'Africa/Cairo', 'Africa/Casablanca', 'Africa/Ceuta', 'Africa/Conakry', 'Africa/Dakar', 'Africa/Dar_es_Salaam', 'Africa/Djibouti', 'Africa/Douala', 'Africa/El_Aaiun', 'Africa/Freetown', 'Africa/Gaborone', 'Africa/Harare', 'Africa/Johannesburg', 'Africa/Juba', 'Africa/Kampala', 'Africa/Khartoum', 'Africa/Kigali', 'Africa/Kinshasa', 'Africa/Lagos', 'Africa/Libreville', 'Africa/Lome', 'Africa/Luanda', 'Africa/Lubumbashi', 'Africa/Lusaka', 'Africa/Malabo', 'Africa/Maputo', 'Africa/Maseru', 'Africa/Mbabane', 'Africa/Mogadishu', 'Africa/Monrovia', 'Africa/Nairobi', 'Africa/Ndjamena', 'Africa/Niamey', 'Africa/Nouakchott', 'Africa/Ouagadougou', 'Africa/Porto-Novo', 'Africa/Sao_Tome', 'Africa/Tripoli', 'Africa/Tunis', 'Africa/Windhoek', 'America/Adak', 'America/Anc
@jvzammit
jvzammit / copy.py
Created October 30, 2019 18:09
Copy CMD
"""
Copies FlaggedLead model items and associated models "back" into the
Lead model and associated models.
Leaves FlaggedLead model items and associated models untouched.
"""
from django.core.management.base import BaseCommand
from django.db import transaction
from lead.models import (

Challenges, Limitations and Future Work

Current Setup

Currently set up to get data for 17 "important" URLs as defined by Jess (http://bi.consumeraffairs.com/admin/urldata/url/). These indicate the URLs we have to really keep an eye on.

Challenges

  • still figuring out WebPageTest
# -*- coding: utf-8 -*-
import bs4
from django.core.management import setup_environ
from ca import settings
setup_environ(settings)
from buyers_guide.models import (
@jvzammit
jvzammit / SEO9.py
Last active December 2, 2015 12:03
# -*- coding: utf-8 -*-
import bs4
import csv
from django.core.management import setup_environ
from ca import settings
setup_environ(settings)
@jvzammit
jvzammit / php_error.md
Last active August 29, 2015 14:04
PHP error

The error below materializes when calling some PHP site URLs directly (e.g. /ajax/questions/process-delete-question):

Fatal error: Call to a member function num_rows() on a non-object in
/var/www/html/noodle/noodle_ci/application/models/config_model.php on line 76

It's this code basically in /var/www/html/noodle/noodle_ci/application/models/config_model.php:

 66         $res = $this->db->query('
 67 SELECT 
@jvzammit
jvzammit / failing_tests.md
Last active August 29, 2015 14:04
failing tests travis

An update on progress:

Ran 709 tests in 269.906s
FAILED (failures=1, errors=277)

The full log is attached with the email sent.

I grouped the "easier to spot" 277 errors in the categories below:

96 errors: AttributeError: 'SolrResponse' object has no attribute ...

Steps:

1. Unit test changes

Rework all unit tests data creation to use noodleauth.tests.data function create_test_user to which optional parameters can be passed to override default field values used to create test user. Once this effort is complete, rest of team should start using this function to create users within unit tests. Unit tests won't be affected by "internal" noodleauth changes ("internal" in this context means changes that are within immediate app only).