Skip to content

Instantly share code, notes, and snippets.

@anb
anb / gist:872278
Created March 16, 2011 10:11
I can haz companyName in getVoipLine ?
Mar 16 11:08:08 whiskey http-8080-15: Debug : phonePlatform : syslogBehavior : techzone_VOIP : updateVoipLine : request : <netplusAPI>
<voipLineId>21086</voipLineId>
<listing>N</listing>
<advertisingBlocked>N</advertisingBlocked>
<address>
<street>Rte de la route2</street>
<houseNumber>10</houseNumber>
<postCode>396100</postCode>
<place>Sierre2</place>
<installCompanyName>Earcorp</installCompanyName>
from django.core import validators
if 'PHONE' in contact_type:
validatate_phone = validators.RegexValidator(r"[0-9]{10,15}", _("Invalid number"))
validatate_phone(self.cleaned_data.get('value', ''))
elif contact_type == 'EMAIL':
validators.validate_email(self.cleaned_data.get('value', ''))
@anb
anb / Export script
Created March 10, 2011 07:23
common/management/commands/export_data.py
if ci != None and ci.parent.parent:
network_node = ci.parent.parent.name
node = ci.parent.parent
while ci.parent.parent and node.parent.type.code == 'NODE':
node = node.parent
ubr = node.parent
network_headed = ubr.name
else:
network_node = ''
anb:~$python
Python 2.7.1 (r271:86832, Feb 11 2011, 11:47:39)
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> True = False
>>> True
False
>>> True == False
True
>>>
118 else:
119 -> rc = None
120 if noqueue:
121 rc = runner(ci, function, parameters, user, batch)
122 return rc
123 else:
124 publisher = runner.get_publisher()
(Pdb) n
> /Users/anb/manny/manny_web/manny/driver/network/__init__.py(120)execute_function()
-> if noqueue:
[2010-05-19 11:29:27] INFO WEBrick 1.3.1
[2010-05-19 11:29:27] INFO ruby 1.9.0 (2008-06-20) [x86_64-linux]
[2010-05-19 11:29:47] INFO WEBrick::HTTPServer#start: pid=22716 port=9292
NoMethodError - undefined method `default_internal' for Encoding:Class:
/usr/lib/ruby1.9/gems/1.9.0/gems/haml-3.0.4/lib/haml/engine.rb:89:in `initialize'
/usr/lib/ruby1.9/gems/1.9.0/gems/sinatra-1.0/lib/sinatra/tilt.rb:444:in `new'
/usr/lib/ruby1.9/gems/1.9.0/gems/sinatra-1.0/lib/sinatra/tilt.rb:444:in `prepare'
/usr/lib/ruby1.9/gems/1.9.0/gems/sinatra-1.0/lib/sinatra/tilt.rb:124:in `initialize'
/usr/lib/ruby1.9/gems/1.9.0/gems/sinatra-1.0/lib/sinatra/base.rb:370:in `new'
/usr/lib/ruby1.9/gems/1.9.0/gems/sinatra-1.0/lib/sinatra/base.rb:370:in `block in compile_template'