Search Results

Search found 576 results on 24 pages for 'erik nelson'.

Page 12/24 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • LINQ list of sublist

    - by Nelson
    I'm trying to get all the sublists that don't inherit from a specified class and also get the parent/root list type. I can't quite figure out the syntax. Here's an example of the sort of thing I'm looking for. Thanks for any help you can give! public class Foo { public IList<Type> Bar { get; private set; } } List<Foo> test = new List<Foo>(); // Initialize, add values, etc. var result = from f in test from b in f.Bar where !b.IsSubclassOf(typeof(AnotherClass)) select f.GetType(), b

    Read the article

  • How to implement YQL paging?

    - by Erik Vold
    I've read the YQL guide, and I keep reviewing http://developer.yahoo.com/yql/guide/yql-o...entables-paging and I have been looking at a few examples, but I'm still left pretty confused how YQL paging works. The problem that I am trying to tackle is creating a YQL open data table for the Mozilla labs Jetpack Gallery's jetpacks pages http://jetpackgallery.mozillalabs.com/jetpacks You flip through the pages of jetpacks with the ?page query variable and there is an order_by query variable. You can only see 10 results per page. Questions: List item Should I use or ? How do I specify the query parameter that indicates the page? in this case it is the 'page' query parameter. I am assuming I should use: <urls><url>http://jetpackgallery.mozillalabs.com/jetpacks</url></urls> is this correct? In the execute element, I will need to extract the details for each jetpack on the page? if so how would I organize that for the response.object? Can anyone provide some help? or perhaps point to a data table that I can look at as a reference? or better documentation on how paging works?

    Read the article

  • Joomla, passing a querystring parameter to a link in an article

    - by Pete Nelson
    We have some banner ads linking to an article in Joomla and they are passing a reference code in the URL, like this: index.php?option=com_content&view=article&id=378&Itemid=249&ReferenceCode=WB6074 Inside the article, we're linking to a signup form on another web site and we need to pass the reference code in that URL's querystring. How do I do this? Is there a way to embed PHP in an article? If so, then I could just use $_GET["ReferenceCode"] to stick that parameter in the URL.

    Read the article

  • Enumerating all strings in resx

    - by Erik Hesselink
    We would like to enumerate all strings in a resource file in .NET (resx file). We want this to generate a javascript object containing all these key-value pairs. We do this now for satellite assemblies with code like this (this is VB.NET, but any example code is fine): Dim rm As ResourceManager rm = New ResourceManager([resource name], [your assembly]) Dim Rs As ResourceSet Rs = rm.GetResourceSet(Thread.CurrentThread.CurrentCulture, True, True) For Each Kvp As DictionaryEntry In Rs [Write out Kvp.Key and Kvp.Value] Next However, we haven't found a way to do this for .resx files yet, sadly. How can we enumerate all localization strings in a resx file? UPDATE: Following Dennis Myren's comment and the ideas from here, I built a ResXResourceManager. Now I can do the same with .resx files as I did with the embedded resources. Here is the code. Note that Microsoft made a needed constructor private, so I use reflection to access it. You need full trust when using this. Imports System.Globalization Imports System.Reflection Imports System.Resources Imports System.Windows.Forms Public Class ResXResourceManager Inherits ResourceManager Public Sub New(ByVal BaseName As String, ByVal ResourceDir As String) Me.New(BaseName, ResourceDir, GetType(ResXResourceSet)) End Sub Protected Sub New(ByVal BaseName As String, ByVal ResourceDir As String, ByVal UsingResourceSet As Type) Dim BaseType As Type = Me.GetType().BaseType Dim Flags As BindingFlags = BindingFlags.NonPublic Or BindingFlags.Instance Dim Constructor As ConstructorInfo = BaseType.GetConstructor(Flags, Nothing, New Type() { GetType(String), GetType(String), GetType(Type) }, Nothing) Constructor.Invoke(Me, Flags, Nothing, New Object() { BaseName, ResourceDir, UsingResourceSet }, Nothing) End Sub Protected Overrides Function GetResourceFileName(ByVal culture As CultureInfo) As String Dim FileName As String FileName = MyBase.GetResourceFileName(culture) If FileName IsNot Nothing AndAlso FileName.Length > 10 Then Return FileName.Substring(0, FileName.Length - 10) & ".resx" End If Return Nothing End Function End Class

    Read the article

  • nHibernate strategies in a web farm

    - by Pete Nelson
    Our current project at work is a new MVC web site that will use a WCF service primarily to access a 3rd party billing system via a web service as well as a small SQL database for user personalization. The WCF service uses nHibernate for the SQL database. We'd like to implement some sort of web farm for load balancing as well as failover and maintenance. I'm trying to decide the best way to handle nHibernate's caching and database concurrency if there are multiple WCF services running. Some scenarios I've been thinking about... 1) Multiple IIS servers, one WCF server. With this setup, the WCF server would be a single point of failure, but there would be no issues with nHibernate caching or database concurrency. 2) Multiple IIS servers, each with it's own WCF service. This removes a single point of failure, but now nHibernate on one machine would not know about database changes done by another machine. Some solutions to number 2 would be to use an IStatelessSession so we're not doing any caching and nHibernate is always fetching directly from the database. This might be the most feasible as our personalization database has very few objects in it. I'm also considering a 2nd-level cache such as memcached or Velocity, but it may be overkill for this system. I'm putting this out there to see if anyone has experience doing this sort of architecture and to get some ideas for a solution. Thanks!

    Read the article

  • Silverlight client never calls WCF Service

    - by Doug Nelson
    Hi all, This one has me completed stumped. I have developed a silverlight application that calls back to WCF services ( it's a silverlight - basicHttpBinding) The site works perfectly fine from my development machine, but when it is deployed to the developement server. The application is delivered with the XAP just fine, but it never attempts to talk to the service. I have a service call in the bootstrapper so it should be calling this when the client starts up. The services are healthy. They can be browsed to and show the standard WCF service display. We have been through the bindings many times and everything seems to be ok. I have added an extensive amount of error handling for displaying any errors, but on this dev server, no service calls and no errors are being raised. Fiddler shows the page being loaded up, but my client never issues a call to the service. The service is in the same folder as the default.aspx which hosts the Silverlight client. This is a Silverlight 3.0 app. Anybody ever seen anything similar?

    Read the article

  • Edit dialog, with bindings and OK/Cancel in WPF

    - by Erik
    How can i have a dialog for editing the properties of a class with binding, and have OK-Cancel in the dialog? My first idea was this: public partial class EditServerDialog : Window { private NewsServer _newsServer; public EditServerDialog(NewsServer newsServer) { InitializeComponent(); this.DataContext = (_newsServer = newsServer).Clone(); } private void ButtonClick(object sender, RoutedEventArgs e) { switch (((Button)e.OriginalSource).Content.ToString()) { case "OK": _newsServer = (NewsServer)this.DataContext; this.Close(); break; case "Cancel": this.Close(); break; } } } When in the switch, case "OK", the DataContext contains the correct information, but the originally passed NewsServer instance does not change.

    Read the article

  • Regex not operator

    - by Erik Goens
    I need to use a regex to pull a value out a url domain that will exclude everything but the host (ex: wordpress) and domain type (ex .com). The urls are dynamic and contain 2-3 values for each result (www.example.com or example.org). I am trying to use this expression, but I am only getting back the first letter of every item I am attempting to exclude: Expresssion (?!wordpress|com|www)(\w+|\d+) String example.wordpress.com Results example ordpress om Desired Result example Any assistance would be greatly appreciated

    Read the article

  • Where should I declare my CDI resources?

    - by Laird Nelson
    JSR-299 (CDI) introduces the (unfortunately named) concept of a resource: http://docs.jboss.org/weld/reference/1.0.0/en-US/html/resources.html#d0e4373 You can think of a resource in this nomenclature as a bridge between the Java EE 6 brand of dependency injection (@EJB, @Resource, @PersistenceContext and the like) and CDI's brand of dependency injection. The general gist seems to be that somewhere (and this will be the root of my question) you declare what amounts to a bridge class: it contains fields annotated both with Java EE's @EJB or @PersistenceContext or @Resource annotations and with CDI's @Produces annotations. The net effect is that Java EE 6 injects a persistence context, say, where it's called for, and CDI recognizes that injected PersistenceContext as a source for future injections down the line (handled by @Inject). My question is: what is the community's consensus--or is there one--on: what this bridge class should be named where this bridge class should live whether it's best to localize all this stuff into one class or make several of them ...? Left to my own devices, I was thinking of declaring a single class called CDIResources and using that as the One True Place to link Java EE's DI with CDI's DI. Many examples do something similar, but I'm not clear on whether they're "just" examples or whether that's a good way to do it. Thanks.

    Read the article

  • How do I dynamically create a document for download in Javascript?

    - by Nelson
    I'm writing some Javascript code that generates an XML document in the client (via Google Earth plugin). I'd like the user to be able to click a button on the page and be prompted to save that XML to a new file. If I were generating the XML server-side this would be easy, just make the button open the link. But the XML is generated client-side. I've come up with a couple of hacks that half-work, inspired in part by this StackOverflow question. But neither completely work. Here's a demo HTML with embedded code: <html><head><script> function getData() { return '<?xml version="1.0" encoding="UTF-8"?><doc>Hello</doc>'; } function dlDataURI() { window.open("data:text/xml;charset=utf-8," + getData()); } function dlWindow() { var w = window.open(); w.document.open(); w.document.write(getData()); w.document.close(); } </script><body> <div onclick="dlDataURI()">Click for Data URL</div> <div onclick="dlWindow()">Click for Window</div> </body></html> The dlDataURI() version works great in Firefox, poorly in Chrome (can't save), and not at all in IE. The Window() version works OK in Firefox and IE, and not well in Chrome (can't save, XML embedded inside HTML). Neither version ever prompts a user download, it always opens a new window trying to display the XML. Is there a good way to do what I want in client side Javascript? I'd like this to work in today's browsers, ideally Firefox, MSIE 8, and Chrome.

    Read the article

  • NHibernate, transactions and TransactionScope

    - by Erik
    I'm trying to find the best solution to handle transaction in a web application that uses NHibernate. We use a IHttpModule and at HttpApplication.BeginRequest we open a new session and we bind it to the HttpContext with ManagedWebSessionContext.Bind(context, session); We close and unbind the session on HttpApplication.EndRequest. In our Repository base class, we always wrapped a transaction around our SaveOrUpdate, Delete, Get methods like, according to best practice: public virtual void Save(T entity) { var session = DependencyManager.Resolve<ISession>(); using (var transaction = session.BeginTransaction()) { session.SaveOrUpdate(entity); transaction.Commit(); } } But then this doesn't work, if you need to put a transaction somewhere in e.g. a Application service to include several repository calls to Save, Delete, etc.. So what we tried is to use TransactionScope (I didn't want to write my own transactionmanager). To test that this worked, I use an outer TransactionScope that doesn't call .Complete() to force a rollback: Repository Save(): public virtual void Save(T entity) { using (TransactionScope scope = new TransactionScope()) { var session = Depe.ndencyManager.Resolve<ISession>(); session.SaveOrUpdate(entity); scope.Complete(); } } The block that uses the repository: TestEntity testEntity = new TestEntity { Text = "Test1" }; ITestRepository testRepository = DependencyManager.Resolve<ITestRepository>(); testRepository.Save(testEntity); using (var scope = new TransactionScope()) { TestEntity entityToChange = testRepository.GetById(testEntity.Id); entityToChange.Text = "TestChanged"; testRepository.Save(entityToChange); } TestEntity entityChanged = testRepository.GetById(testEntity.Id); Assert.That(entityChanged.Text, Is.EqualTo("Test1")); This doesn't work. But to me if NHibernate supports TransactionScope it would! What happens is that there is no ROLLBACK at all in the database but when the testRepository.GetById(testEntity.Id); statement is executed a UPDATE with SET Text = "TestCahgned" is fired instead (It should have been fired between BEGIN TRAN and ROLLBACK TRAN). NHibernate reads the value from the level1 cache and fires a UPDATE to the database. Not expected behaviour!? From what I understand whenever a rollback is done in the scope of NHibernate you also need to close and unbind the current session. My question is: Does anyone know of a good way to do this using TransactionScope and ManagedWebSessionContext?

    Read the article

  • Android & SQLite: "Table audios has no column named downloaded"

    - by Erik
    I get this weird exception when i run my app on both the emulator and a USB connected device. i can see the table inside the shell, but when I try to insert a record from the Activity acton I get this exception: android.database.sqlite.SQLiteException: table audios has no column named downloaded I am mostly running on an emulator with Android 1.5. The predominant part of my code is linked to this tutorial - http://www.devx.com/wireless/Article/40842/1954. This is the create statement I use: private static final String DATABASE_CREATE = "create table audios ( _id integer primary key autoincrement, " + "user_name text not null, title text not null, file_path text not null, download integer not null, " + "created_at integer not null, downloaded_at integer not null );"; This is the insert code I use: //--- insert a title into the database --- public long insertTitle(String user_name, String title, String file_path, Integer downloaded, long created_at, String downloaded_at ) { ContentValues initialValues = new ContentValues(); initialValues.put(KEY_USER_NAME, user_name); initialValues.put(KEY_TITLE, title); initialValues.put(KEY_FILE, file_path); initialValues.put(KEY_DOWNLOADED, downloaded); initialValues.put(KEY_CREATED_AT, created_at); initialValues.put(KEY_DOWNLOADED_AT, downloaded_at); return db.insert(DATABASE_TABLE, null, initialValues); }

    Read the article

  • How do I correctly install dulwich to get hg-git working on Cygwin?

    - by Erik Vold
    I have a similar issue as in this issue, but in my case I am trying to use cygwin. First I followed the instructions here, and I ran: $ easy_install hg-git The I created ~/.hgrc, with: [extensions] hgext.bookmarks = hggit = Then when I typed 'hg' at a command prompt, I'd see: "* failed to import extension hggit: No module named hggit" So I did a search for "hggit" and found /cygdrive/c/Python26/Lib/site-packages/hg_git-0.2.1-py2.6.egg/hggit, so I updated .hgrc: [extensions] hgext.bookmarks = hggit = /cygdrive/c/Python26/Lib/site-packages/hg_git-0.2.1-py2.6.egg/hggit Then when I type 'hg' I get "No module named dulwich.errors" If you read this question, it's the same problem. In python shell I cannot import dulwich: >>> import dulwich Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named dulwich I checked out my easy-install.pth and it does contain the dulwich egg: import sys; sys.__plen = len(sys.path) ./hg_git-0.2.1-py2.6.egg ./dulwich-0.5.0-py2.6-win32.egg import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new) So how can I fix this so that import dulwich works, which should fix my problem using hg-git I assume..

    Read the article

  • howto use JFormattedTextField allowing only letters and numbers

    - by Erik
    I have this code and cannot get MaskFormatter right maskformatter MaskFormatter formatter = null; try { formatter = new MaskFormatter("HHHHHHH"); } catch (ParseException e) { e.printStackTrace(); } txtTroll = new JFormattedTextField(formatter); I need Any hex character (0-9, a-f or A-F) and the "H" should give me only (0-9, a-f or A-F) but im getting it wrong. When i type text only capital letters are typed and it's slow to and when i click away from the txtTroll all letters vanish

    Read the article

  • example of a utf-8 format octet string

    - by erik
    I'm working w/ a function that expects a string formatted as a utf-8 encoded octet string. Can someone give me an example of what a utf-8 encoded octet string would look like? Put another way, if I convert 'foo' to bytes, I get 112, 111, 111. What would these char codes look like as a utf-8 encoded octet string? Would it be "0x70 0x6f 0x6f"? Thanks

    Read the article

  • Does ActiveRecord make Ruby on Rails code hard to test?

    - by Erik Öjebo
    I've spent most of my time in statically typed languages (primarily C#). I have some bad experiences with the Active Record pattern and unit testing, because of the static methods and the mix of entities and data access code. Since the Ruby community probably is the most test driven of the communities out there, and the Rails ActiveRecord seems popular, there must be some way of combining TDD and ActiveRecord based code in Ruby on Rails. I would guess that the problem goes away in dynamic languages, somehow, but I don't see how. So, what's the trick?

    Read the article

  • Horrible WPF performance!

    - by Erik
    Why am i using over 80% CPU when just hovering some links? As you can see in the video i uploaded: http://www.youtube.com/watch?v=3ALF9NquTRE the CPU goes to 80% CPU when i move my mouse over the links. My style for the items are as follows <Style x:Key="LinkStyle" TargetType="{x:Type Hyperlink}"> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Foreground" Value="White" /> </Trigger> </Style.Triggers> <Setter Property="TextBlock.TextDecorations" Value="{x:Null}" /> <Setter Property="Foreground" Value="#FFDDDDDD"/> <Setter Property="Cursor" Value="Arrow" /> </Style> Why?

    Read the article

  • Rails 3 memory issue

    - by Erik
    Hello! I'm developing a new site based on Ruby on Rails 3 beta. I knew this might be a bad idea considering it's just beta, but I still thought it might work. Now though I'm having HUGE problems with Rails consuming huge ammounts of memory. For my application today it consumes about 10 mb per request and it doesn't seem to release it either. So I thought this might be because of bloat in my application and thus I created a test app just to compare. For my test app I just generated a model with a scaffold and then created about 20 records on this model. I then went to the index page and hit refresh and I could immediately see memory taking off! Less than my app but still about 1-3 mb per request. I'm working in OSX Leopard, with Ruby 1.8.7, Rails 3.0.0.beta and a SQLLite db for development. Does anyone recognize my problem? I would really appreciate some help here. :/ Thanks!

    Read the article

  • Is it possible to distribute STDIN over parallel processes?

    - by Erik
    Given the following example input on STDIN: foo bar bar baz === qux bla === def zzz yyy Is it possible to split it on the delimiter (in this case '===') and feed it over stdin to a command running in parallel? So the example input above would result in 3 parallel processes (for example a command called do.sh) where each instance received a part of the data on STDIN, like this: do.sh (instance 1) receives this over STDIN: foo bar bar baz do.sh (instance 2) receives this over STDIN: qux bla do.sh (instance 3) receives this over STDIN: def zzz yyy I suppose something like this is possible using xargs or GNU parallel, but I do not know how.

    Read the article

  • Finding distance to the closest point in a point cloud on an uniform grid

    - by erik
    I have a 3D grid of size AxBxC with equal distance, d, between the points in the grid. Given a number of points, what is the best way of finding the distance to the closest point for each grid point (Every grid point should contain the distance to the closest point in the point cloud) given the assumptions below? Assume that A, B and C are quite big in relation to d, giving a grid of maybe 500x500x500 and that there will be around 1 million points. Also assume that if the distance to the nearest point exceds a distance of D, we do not care about the nearest point distance, and it can safely be set to some large number (D is maybe 2 to 10 times d) Since there will be a great number of grid points and points to search from, a simple exhaustive: for each grid point: for each point: if distance between points < minDistance: minDistance = distance between points is not a good alternative. I was thinking of doing something along the lines of: create a container of size A*B*C where each element holds a container of points for each point: define indexX = round((point position x - grid min position x)/d) // same for y and z add the point to the correct index of the container for each grid point: search the container of that grid point and find the closest point if no points in container and D > 0.5d: search the 26 container indices nearest to the grid point for a closest point .. continue with next layer until a point is found or the distance to that layer is greater than D Basically: put the points in buckets and do a radial search outwards until a points is found for each grid point. Is this a good way of solving the problem, or are there better/faster ways? A solution which is good for parallelisation is preferred.

    Read the article

  • Django FileField not saving to upload_to location

    - by Erik
    I have an Attachment model that has a FileField in a Django 1.4.1 app. This FileField has a callable upload_to parameter which, per the Django docs should be called when the form (and therefore the model) is saved. When I run FormTest below, the upload_to callable is never called and the file therefore does not appear in the location provided by the upload_to method. What am I doing wrong? Notice that in the passing tests in ModelTest (also below), the upload_to method works as expected. Test: from core.forms.attachments import AttachmentForm from django.test import TestCase import unittest from django.core.files.uploadedfile import SimpleUploadedFile from django.core.files.storage import default_storage def suite(): return unittest.TestSuite( [ unittest.TestLoader().loadTestsFromTestCase(FormTest), ] ) class FormTest(TestCase): def test_form_1(self): filename = 'filename' f = file(filename) data = {'name':'name',} file_data = {'attachment_file':SimpleUploadedFile(f.name,f.read()),} form = AttachmentForm(data=data,files=file_data) self.assertTrue(form.is_valid()) attachment = form.save() root_directory = 'attachments' upload_location = root_directory + '/' + attachment.directory + '/' + filename self.assertTrue(attachment.attachment_file) # Fails self.assertTrue(default_storage.exists(upload_location)) # Fails Attachment Model: from django.db import models from parent_mixins import Parent_Mixin import uuid from django.db.models.signals import pre_delete,pre_save from dirtyfields import DirtyFieldsMixin def upload_to(instance,filename): return 'attachments/' + instance.directory + '/' + filename def uuid_directory_name(): return uuid.uuid4().hex class Attachment(DirtyFieldsMixin,Parent_Mixin,models.Model): attachment_file = models.FileField(blank=True,null=True,upload_to=upload_to) directory = models.CharField(blank=False,default=uuid_directory_name,null=False,max_length=32) name = models.CharField(blank=False,default=None,null=False,max_length=128) class Meta: app_label = 'core' def __str__(self): return unicode(self).encode('utf-8') def __unicode__(self): return unicode(self.name) @models.permalink def get_absolute_url(self): return('core_attachments_update',(),{'pk': self.pk}) # def save(self,*args,**kwargs): # super(Attachment,self).save(*args,**kwargs) def pre_delete_callback(sender, instance, *args, **kwargs): if not isinstance(instance, Attachment): return if not instance.attachment_file: return instance.attachment_file.delete(save=False) def pre_save_callback(sender, instance, *args, **kwargs): if not isinstance(instance, Attachment): return if not instance.attachment_file: return if instance.is_dirty(): dirty_fields = instance.get_dirty_fields() if 'attachment_file' in dirty_fields: old_attachment_file = dirty_fields['attachment_file'] old_attachment_file.delete() pre_delete.connect(pre_delete_callback) pre_save.connect(pre_save_callback) Attachment Form: from ..models.attachments import Attachment from crispy_forms.helper import FormHelper from crispy_forms.layout import Div,Layout,HTML,Field,Fieldset,Button,ButtonHolder,Submit from django import forms class AttachmentFormHelper(FormHelper): form_tag=False layout = Layout( Div( Div( Field('name',css_class='span4'), Field('attachment_file',css_class='span4'), css_class='span4', ), css_class='row', ), ) class AttachmentForm(forms.ModelForm): helper = AttachmentFormHelper() class Meta: fields=('attachment_file','name') model = Attachment class AttachmentInlineFormHelper(FormHelper): form_tag=False form_style='inline' layout = Layout( Div( Div( Field('name',css_class='span4'), Field('attachment_file',css_class='span4'), Field('DELETE',css_class='span4'), css_class='span4', ), css_class='row', ), ) class AttachmentInlineForm(forms.ModelForm): helper = AttachmentInlineFormHelper() class Meta: fields=('attachment_file','name') model = Attachment UPDATE I also do testing on the Attachment model class with these unit tests -- which all pass: from core.models.attachments import Attachment from core.models.attachments import upload_to from django.test import TestCase import unittest from django.core.files.storage import default_storage from django.core.files.base import ContentFile def suite(): return unittest.TestSuite( [ unittest.TestLoader().loadTestsFromTestCase(ModelTest), ] ) class ModelTest(TestCase): def test_model_minimum_fields(self): attachment = Attachment(name='name') attachment.attachment_file.save('test.txt',ContentFile("hello world")) attachment.save() self.assertEqual(str(attachment),'name') self.assertEqual(unicode(attachment),'name') self.assertTrue(attachment.directory) # def test_model_full_fields(self): # attachment = Attachment() # attachement.save() def test_file_operations_basic(self): root_directory = 'attachments' filename = 'test.txt' attachment = Attachment(name='name') attachment.attachment_file.save(filename,ContentFile('test')) attachment.save() upload_location = root_directory + '/' + attachment.directory + '/' + filename self.assertEqual(upload_to(attachment,filename),upload_location) self.assertTrue(default_storage.exists(upload_location)) def test_file_operations_delete(self): root_directory = 'attachments' filename = 'test.txt' attachment = Attachment(name='name') attachment.attachment_file.save(filename,ContentFile('test')) attachment.save() upload_location = upload_to(attachment,filename) attachment.delete() self.assertFalse(default_storage.exists(upload_location)) def test_file_operations_change(self): root_directory = 'attachments' filename_1 = 'test_1.txt' attachment = Attachment(name='name') attachment.attachment_file.save(filename_1,ContentFile('test')) attachment.save() upload_location_1 = upload_to(attachment,filename_1) self.assertTrue(default_storage.exists(upload_location_1)) filename_2 = 'test_2.txt' attachment.attachment_file.save(filename_2,ContentFile('test')) attachment.save() upload_location_2 = upload_to(attachment,filename_2) self.assertTrue(default_storage.exists(upload_location_2)) self.assertFalse(default_storage.exists(upload_location_1))

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >